Class: Cryptoexchange::Exchanges::Cybex::Services::Market
- Inherits:
-
Services::Market
- Object
- Services::Market
- Cryptoexchange::Exchanges::Cybex::Services::Market
- Defined in:
- lib/cryptoexchange/exchanges/cybex/services/market.rb
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Services::Market
Class Method Details
.supports_individual_ticker_query? ⇒ Boolean
6 7 8 |
# File 'lib/cryptoexchange/exchanges/cybex/services/market.rb', line 6 def supports_individual_ticker_query? true end |
Instance Method Details
#adapt(output, market_pair) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# 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. = nil ticker.payload = data ticker end |
#fetch(market_pair) ⇒ Object
11 12 13 14 15 |
# 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 ⇒ Object
17 18 19 |
# File 'lib/cryptoexchange/exchanges/cybex/services/market.rb', line 17 def ticker_url "#{Cryptoexchange::Exchanges::Cybex::Market::API_URL}" end |