class Cryptoexchange::Exchanges::Lakebtc::Services::Market

Public Class Methods

supports_individual_ticker_query?() click to toggle source
# File lib/cryptoexchange/exchanges/lakebtc/services/market.rb, line 6
def supports_individual_ticker_query?
  false
end

Public Instance Methods

adapt_all(output) click to toggle source
# File lib/cryptoexchange/exchanges/lakebtc/services/market.rb, line 20
def adapt_all(output)
  tickers = []

  output.keys.each do |pair|
    if pair.include?('btc') || pair.include?('eth')
      ticker_json = output[pair]
      ticker = Cryptoexchange::Models::Ticker.new
      ticker.base = pair[0..2]
      ticker.target = pair[3..-1]
      ticker.market = Lakebtc::Market::NAME

      # NOTE: apparently it can be nil
      ticker.ask    = NumericHelper.to_d(ticker_json['ask'])
      ticker.bid    = NumericHelper.to_d(ticker_json['bid'])
      ticker.last   = NumericHelper.to_d(ticker_json['last'])
      ticker.high   = NumericHelper.to_d(ticker_json['high'])
      ticker.low    = NumericHelper.to_d(ticker_json['low'])
      ticker.volume = NumericHelper.to_d(ticker_json['volume'])

      ticker.timestamp = nil
      ticker.payload = ticker_json

      tickers << ticker
    end
  end

  tickers
end
fetch() click to toggle source
Calls superclass method Cryptoexchange::Services::Market#fetch
# File lib/cryptoexchange/exchanges/lakebtc/services/market.rb, line 11
def fetch
  output = super(ticker_url)
  adapt_all(output)
end
ticker_url() click to toggle source
# File lib/cryptoexchange/exchanges/lakebtc/services/market.rb, line 16
def ticker_url
  "#{Cryptoexchange::Exchanges::Lakebtc::Market::API_URL}/ticker"
end