Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

money-bank-cryptocompare

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

money-bank-cryptocompare

  • 0.1.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Money::Bank::Cryptocompare

Money gem's Bank implementation to Cryptocompare API to do cryptocurrency exchange, like converting Bitcoin to Ethereum.

Installation

Add this line to your application's Gemfile:

gem 'money-bank-cryptocompare'

And then execute:

$ bundle

Or install it yourself as:

$ gem install money-bank-cryptocompare

Usage

First you need to define the cryptocurrency you need:

require 'money'

curr = {
  :priority            => 1,
  :iso_code            => "IOT",
  :name                => "IOT",
  :subunit             => "IOT",
  :subunit_to_unit     => 1,
}
Money::Currency.register(curr)

Initialize the bank, and call exchange_to as you normally would.

require 'money/bank/cryptocompare'
bank = Money::Bank::Cryptocompare.new
bank.exchange_with(Money.new(100_000_000,'BTC'), 'IOT')

# Set default bank to allow auto currency conversion
Money.default_bank = bank
Money.new(100_000_000,'BTC').exchange_to('IOT')

Cryptocompare offers some options, such as using specific exchange for rate lookup. This can be set when initializing the bank:

Money::Bank::Cryptocompare.new(options: {'e' => 'Kraken'})

A list of supported exchanges are listed here.

If we want to set a rates store, pass it with the :rates_store key (different to standard bank method signature):

Money::Bank::Cryptocompare.new(rates_store: rates_store)

FAQs

Package last updated on 08 Dec 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc