Class: Cryptoexchange::Exchanges::Axnet::Services::Trades

Inherits:
Services::Market show all
Defined in:
lib/cryptoexchange/exchanges/axnet/services/trades.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Services::Market

#fetch_using_post

Class Method Details

.supports_individual_ticker_query?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/cryptoexchange/exchanges/axnet/services/trades.rb', line 6

def supports_individual_ticker_query?
  true
end

Instance Method Details

#adapt(output) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/cryptoexchange/exchanges/axnet/services/trades.rb', line 22

def adapt(output)
  output.collect do |trade|
    tr = Cryptoexchange::Models::Trade.new
    tr.trade_id  = nil
    tr.base      = trade['token']
    tr.target    = trade['basetoken']
    tr.type      = trade['type']
    tr.price     = trade['price']
    tr.amount    = trade['amount']
    tr.timestamp = trade['timestamp']
    tr.payload   = trade
    tr.market    = Axnet::Market::NAME
    tr
  end
end

#fetch(market_pair) ⇒ Object



11
12
13
14
# File 'lib/cryptoexchange/exchanges/axnet/services/trades.rb', line 11

def fetch(market_pair)
  output = super(trade_history_url(market_pair))
  adapt(output)
end

#trade_history_url(market_pair) ⇒ Object



16
17
18
19
20
# File 'lib/cryptoexchange/exchanges/axnet/services/trades.rb', line 16

def trade_history_url(market_pair)
  base = market_pair.base
  target = market_pair.target
  "#{Cryptoexchange::Exchanges::Axnet::Market::API_URL}/return24Trades?market=#{base}_#{target}"
end