class Cryptoexchange::Exchanges::Gdac::Services::Market
Public Class Methods
supports_individual_ticker_query?()
click to toggle source
# File lib/cryptoexchange/exchanges/gdac/services/market.rb, line 6 def supports_individual_ticker_query? false end
Public Instance Methods
adapt(market_data)
click to toggle source
# File lib/cryptoexchange/exchanges/gdac/services/market.rb, line 28 def adapt(market_data) target, base = market_data['marketName'].split('-') ticker = Cryptoexchange::Models::Ticker.new ticker.base = base ticker.target = target ticker.market = Gdac::Market::NAME ticker.ask = NumericHelper.to_d(market_data['ask']) ticker.bid = NumericHelper.to_d(market_data['bid']) ticker.last = NumericHelper.to_d(market_data['last']) ticker.high = NumericHelper.to_d(market_data['high']) ticker.low = NumericHelper.to_d(market_data['low']) ticker.volume = NumericHelper.to_d(market_data['volume']) ticker.timestamp = nil ticker.payload = market_data ticker end
adapt_all(output)
click to toggle source
# File lib/cryptoexchange/exchanges/gdac/services/market.rb, line 24 def adapt_all(output) output['result'].map { |market_data| adapt(market_data) } end
fetch()
click to toggle source
# File lib/cryptoexchange/exchanges/gdac/services/market.rb, line 11 def fetch ctx = OpenSSL::SSL::SSLContext.new ctx.verify_mode = OpenSSL::SSL::VERIFY_NONE result = HTTP.get(ticker_url, ssl_context: ctx) output = JSON.parse(result) adapt_all(output) end
ticker_url()
click to toggle source
# File lib/cryptoexchange/exchanges/gdac/services/market.rb, line 20 def ticker_url "#{Cryptoexchange::Exchanges::Gdac::Market::API_URL}/public/marketsummaries" end