Class: Cryptoexchange::Exchanges::Crxzone::Services::Market
- Inherits:
-
Services::Market
- Object
- Services::Market
- Cryptoexchange::Exchanges::Crxzone::Services::Market
- Defined in:
- lib/cryptoexchange/exchanges/crxzone/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/crxzone/services/market.rb', line 6 def supports_individual_ticker_query? true end |
Instance Method Details
#adapt(output, market_pair) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/cryptoexchange/exchanges/crxzone/services/market.rb', line 25 def adapt(output, market_pair) ticker = Cryptoexchange::Models::Ticker.new ticker.base = market_pair.base ticker.target = market_pair.target ticker.market = Crxzone::Market::NAME ticker.ask = NumericHelper.to_d(output['Ask']) ticker.bid = NumericHelper.to_d(output['Bid']) ticker.last = NumericHelper.to_d(output['Last']) ticker.high = NumericHelper.to_d(output['High']) ticker.low = NumericHelper.to_d(output['Low']) ticker.volume = NumericHelper.to_d(output['Volume']) ticker. = output['TimeStamp'] ticker.payload = output ticker end |
#fetch(market_pair) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/cryptoexchange/exchanges/crxzone/services/market.rb', line 11 def fetch(market_pair) result = IdFetcher.get_id(market_pair.base.upcase, market_pair.target.upcase) if result.length > 0 pair = result.first pair_id = pair["ID"] output = super(ticker_url(pair_id)) adapt(output["Result"], market_pair) end end |
#ticker_url(pair_id) ⇒ Object
21 22 23 |
# File 'lib/cryptoexchange/exchanges/crxzone/services/market.rb', line 21 def ticker_url(pair_id) "#{Cryptoexchange::Exchanges::Crxzone::Market::API_URL}/Ticker?currencyPairID=#{pair_id}" end |