Module: CryptoTicker

Defined in:
lib/crypto_ticker.rb,
lib/crypto_ticker/version.rb

Overview

This module bundles crypto-currency exchange public data API sources. (e.g. Bitcoin exchange rate, Litecoin, etc.)

Defined Under Namespace

Classes: BTCe, Bitstamp, FXPair, MtGox, Symbol, Vircurex

Constant Summary collapse

VERSION =
"0.0.3"
@@h =
{
  'btce'     => CryptoTicker::BTCe,
  'mtgox'    => CryptoTicker::MtGox,
  'vircurex' => CryptoTicker::Vircurex,
  'bitstamp' => CryptoTicker::Bitstamp,
}

Class Method Summary collapse

Class Method Details

.get_class_for(exchange_name) ⇒ Object



262
263
264
# File 'lib/crypto_ticker.rb', line 262

def get_class_for(exchange_name)
  @@h[ exchange_name.gsub('-', '').downcase ]
end

.makepair(base, quote = '') ⇒ Object



266
267
268
269
270
271
272
273
274
# File 'lib/crypto_ticker.rb', line 266

def makepair(base, quote='')
  if base =~ /([a-z]{3})\/([a-z]{3})/i
    base, quote = $1, $2
  end
  # assume user entered either a fxpair array or a fxpair string
  # TODO: error-checking on input
  pair = FXPair.new("#{base.upcase}/#{quote.upcase}")
  pair
end