Class: Cryptoexchange::Exchanges::Lakebtc::Services::Market
- Inherits:
-
Services::Market
- Object
- Services::Market
- Cryptoexchange::Exchanges::Lakebtc::Services::Market
- Defined in:
- lib/cryptoexchange/exchanges/lakebtc/services/market.rb
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Services::Market
Class Method Details
.supports_individual_ticker_query? ⇒ Boolean
6 7 8 |
# File 'lib/cryptoexchange/exchanges/lakebtc/services/market.rb', line 6 def supports_individual_ticker_query? false end |
Instance Method Details
#adapt_all(output) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# 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. = nil ticker.payload = ticker_json tickers << ticker end end tickers end |
#fetch ⇒ Object
11 12 13 14 |
# File 'lib/cryptoexchange/exchanges/lakebtc/services/market.rb', line 11 def fetch output = super(ticker_url) adapt_all(output) end |
#ticker_url ⇒ Object
16 17 18 |
# File 'lib/cryptoexchange/exchanges/lakebtc/services/market.rb', line 16 def ticker_url "#{Cryptoexchange::Exchanges::Lakebtc::Market::API_URL}/ticker" end |