class Cryptoexchange::Exchanges::Gopax::Services::Market
Public Class Methods
supports_individual_ticker_query?()
click to toggle source
# File lib/cryptoexchange/exchanges/gopax/services/market.rb, line 6 def supports_individual_ticker_query? true end
Public Instance Methods
adapt(ticker1, ticker2, market_pair)
click to toggle source
# File lib/cryptoexchange/exchanges/gopax/services/market.rb, line 25 def adapt(ticker1, ticker2, market_pair) ticker = Cryptoexchange::Models::Ticker.new ticker.base = market_pair.base ticker.target = market_pair.target ticker.market = Gopax::Market::NAME ticker.ask = NumericHelper.to_d(ticker1['ask']) ticker.bid = NumericHelper.to_d(ticker1['bid']) ticker.last = NumericHelper.to_d(ticker1['price']) ticker.high = NumericHelper.to_d(ticker2['high']) ticker.low = NumericHelper.to_d(ticker2['low']) ticker.volume = NumericHelper.to_d(ticker1['volume']) ticker.timestamp = DateTime.parse(ticker2['time']).to_time.to_i ticker.payload = [ticker1, ticker2] ticker end
fetch(market_pair)
click to toggle source
Calls superclass method
Cryptoexchange::Services::Market#fetch
# File lib/cryptoexchange/exchanges/gopax/services/market.rb, line 11 def fetch(market_pair) ticker1 = super(ticker_url_one(market_pair)) ticker2 = super(ticker_url_two(market_pair)) adapt(ticker1, ticker2, market_pair) end
ticker_url_one(market_pair)
click to toggle source
# File lib/cryptoexchange/exchanges/gopax/services/market.rb, line 17 def ticker_url_one(market_pair) "#{Cryptoexchange::Exchanges::Gopax::Market::API_URL}/trading-pairs/#{market_pair.base}-#{market_pair.target}/ticker" end
ticker_url_two(market_pair)
click to toggle source
# File lib/cryptoexchange/exchanges/gopax/services/market.rb, line 21 def ticker_url_two(market_pair) "#{Cryptoexchange::Exchanges::Gopax::Market::API_URL}/trading-pairs/#{market_pair.base}-#{market_pair.target}/stats" end