Class: Cryptoexchange::Exchanges::FiftyEightCoin::Services::Trades
Instance Method Summary
collapse
#fetch_using_post, supports_individual_ticker_query?
Instance Method Details
#adapt(response, market_pair) ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/cryptoexchange/exchanges/fifty_eight_coin/services/trades.rb', line 16
def adapt(response, market_pair)
response['result'].collect do |trade|
tr = Cryptoexchange::Models::Trade.new
tr.base = market_pair.base
tr.target = market_pair.target
tr.trade_id = nil
tr.type = trade[3]
tr.price = trade[1]
tr.amount = trade[2]
tr.timestamp = trade[0]
tr.payload = trade
tr.market = FiftyEightCoin::Market::NAME
tr
end
end
|
#fetch(market_pair) ⇒ Object
5
6
7
8
|
# File 'lib/cryptoexchange/exchanges/fifty_eight_coin/services/trades.rb', line 5
def fetch(market_pair)
response = super(trades_url(market_pair))
adapt(response, market_pair)
end
|
#trades_url(market_pair) ⇒ Object
10
11
12
13
14
|
# File 'lib/cryptoexchange/exchanges/fifty_eight_coin/services/trades.rb', line 10
def trades_url(market_pair)
base = market_pair.base.downcase
target = market_pair.target.downcase
"#{Cryptoexchange::Exchanges::FiftyEightCoin::Market::API_URL}/spot/trades?symbol=#{base}_#{target}"
end
|