class BitcoinTicker::Bitbay

Constants

SUPPORTED_BITCURRENCIES
SUPPORTED_CURRENCIES

Public Class Methods

name() click to toggle source
# File lib/bitcoin_ticker/exchanges/bitbay.rb, line 8
def self.name
  "BitBay"
end

Private Class Methods

get_rate() click to toggle source
# File lib/bitcoin_ticker/exchanges/bitbay.rb, line 21
def self.get_rate
  client = BitcoinTicker::Client.new(link)

  response = client.get(ticker_endpoint)

  BitcoinTicker::Rate.new(@bitcurrency, @currency, normalize_api_response(response[:body]))
end
normalize_api_response(hash) click to toggle source
# File lib/bitcoin_ticker/exchanges/bitbay.rb, line 30
def self.normalize_api_response hash
  {
    last: hash[:last],
    high: hash[:max],
    low: hash[:min],
    vwap: hash[:vwap],
    volume: hash[:volume],
    bid: hash[:bid],
    ask: hash[:ask]
  }
end
ticker_endpoint() click to toggle source
# File lib/bitcoin_ticker/exchanges/bitbay.rb, line 16
def self.ticker_endpoint
  "/API/Public/#{@bitcurrency}#{@currency}/ticker.json"
end