class Cryptoexchange::Exchanges::Cybex::Services::Market

Public Class Methods

supports_individual_ticker_query?() click to toggle source
# File lib/cryptoexchange/exchanges/cybex/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/cybex/services/market.rb, line 21
def adapt(output, market_pair)
  data   = output['result']

  ticker           = Cryptoexchange::Models::Ticker.new
  ticker.base      = market_pair.base
  ticker.target    = market_pair.target
  ticker.market    = Cybex::Market::NAME
  ticker.last      = NumericHelper.to_d(data['latest'])
  ticker.bid       = NumericHelper.to_d(data['highest_bid'])
  ticker.ask       = NumericHelper.to_d(data['lowest_ask'])
  ticker.volume    = NumericHelper.to_d(data['quote_volume'])
  ticker.change    = NumericHelper.to_d(data['percent_change'])
  ticker.timestamp = nil
  ticker.payload   = data
  ticker
end
fetch(market_pair) click to toggle source
# File lib/cryptoexchange/exchanges/cybex/services/market.rb, line 11
def fetch(market_pair)
  base, target = Cybex::Market.prepend_symbol_prefix(market_pair)
  output       = fetch_using_post(ticker_url, { "jsonrpc": "2.0", "method": "get_ticker", "params": ["#{target}", "#{base}"], "id": 1 })
  adapt(output, market_pair)
end
ticker_url() click to toggle source
# File lib/cryptoexchange/exchanges/cybex/services/market.rb, line 17
def ticker_url
  "#{Cryptoexchange::Exchanges::Cybex::Market::API_URL}"
end