class Cryptoexchange::Exchanges::Coinut::Services::Market
Public Class Methods
supports_individual_ticker_query?()
click to toggle source
# File lib/cryptoexchange/exchanges/coinut/services/market.rb, line 6 def supports_individual_ticker_query? true end
Public Instance Methods
adapt(output, market_pair)
click to toggle source
# File lib/cryptoexchange/exchanges/coinut/services/market.rb, line 32 def adapt(output, market_pair) ticker = Cryptoexchange::Models::Ticker.new ticker.base = market_pair.base ticker.target = market_pair.target ticker.market = Coinut::Market::NAME ticker.last = NumericHelper.to_d(output['last']) ticker.high = NumericHelper.to_d(output['highest_buy']) ticker.low = NumericHelper.to_d(output['lowest_sell']) ticker.volume = NumericHelper.to_d(output['volume24']) ticker.timestamp = nil ticker.payload = output ticker end
fetch(market_pair)
click to toggle source
# File lib/cryptoexchange/exchanges/coinut/services/market.rb, line 11 def fetch(market_pair) authentication = Cryptoexchange::Exchanges::Coinut::Authentication.new( :market, Cryptoexchange::Exchanges::Coinut::Market::NAME ) authentication.validate_credentials! payload_ = payload(market_pair) headers = authentication.headers(payload_) output = fetch_using_post(ticker_url, payload_, headers) adapt(output, market_pair) end
payload(market_pair)
click to toggle source
# File lib/cryptoexchange/exchanges/coinut/services/market.rb, line 24 def payload(market_pair) '{"nonce":' + SecureRandom.random_number(99999).to_s + ',"request":"inst_tick", "inst_id":' + market_pair.inst_id + ' }' end
ticker_url()
click to toggle source
# File lib/cryptoexchange/exchanges/coinut/services/market.rb, line 28 def ticker_url Cryptoexchange::Exchanges::Coinut::Market::API_URL end