class Cryptoexchange::Exchanges::Coinrail::Services::Market
Public Class Methods
supports_individual_ticker_query?()
click to toggle source
# File lib/cryptoexchange/exchanges/coinrail/services/market.rb, line 6 def supports_individual_ticker_query? false end
Public Instance Methods
adapt(output, market_pair)
click to toggle source
# File lib/cryptoexchange/exchanges/coinrail/services/market.rb, line 41 def adapt(output, market_pair) ticker = Cryptoexchange::Models::Ticker.new ticker.base = market_pair.base ticker.target = market_pair.target ticker.market = Coinrail::Market::NAME ticker.last = NumericHelper.to_d(output["last24_price"]) ticker.volume = NumericHelper.to_d(output["trade_amount"]) ticker.timestamp = nil ticker.payload = output ticker end
adapt_all(output)
click to toggle source
# File lib/cryptoexchange/exchanges/coinrail/services/market.rb, line 29 def adapt_all(output) output.map do |pair| base, target = pair["currency"].split("-") market_pair = Cryptoexchange::Models::MarketPair.new( base: base, target: target, market: Coinrail::Market::NAME ) adapt(pair, market_pair) end end
fetch()
click to toggle source
Calls superclass method
Cryptoexchange::Services::Market#fetch
# File lib/cryptoexchange/exchanges/coinrail/services/market.rb, line 11 def fetch raw_output = super(ticker_url) output = [] raw_output.map do |market| if market[0] == "btc_market" || market[0] == "krw_market" market[1].each { |pair| output.push(pair) } end end adapt_all(output) end
ticker_url()
click to toggle source
# File lib/cryptoexchange/exchanges/coinrail/services/market.rb, line 24 def ticker_url # No API endpoint available to obtain tickers (as at 29/01/2018), hence the URL below: "#{Cryptoexchange::Exchanges::Coinrail::Market::TICKER_URL}" end