Skip to content

Commit

Permalink
[#fix] Latoken base/target reversed order convention
Browse files Browse the repository at this point in the history
  • Loading branch information
tmlee committed Mar 17, 2018
1 parent d241ac8 commit 045fc24
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions lib/cryptoexchange/exchanges/latoken/services/market.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def fetch(market_pair)
end

def ticker_url(market_pair)
"#{Cryptoexchange::Exchanges::Latoken::Market::API_URL}/v1/coingecko/market/#{market_pair.base}/#{market_pair.target}"
"#{Cryptoexchange::Exchanges::Latoken::Market::API_URL}/v1/coingecko/market/#{market_pair.target}/#{market_pair.base}"
end

def adapt(output, market_pair)
Expand All @@ -27,7 +27,7 @@ def adapt(output, market_pair)
ticker.last = NumericHelper.to_d(output['last_price'])
ticker.high = NumericHelper.to_d(output['high'])
ticker.low = NumericHelper.to_d(output['low'])
ticker.volume = NumericHelper.to_d(output['volume'])
ticker.volume = NumericHelper.to_d(output['volume']) / ticker.last
ticker.timestamp = output['timestamp'].to_i
ticker.payload = output
ticker
Expand Down
4 changes: 2 additions & 2 deletions lib/cryptoexchange/exchanges/latoken/services/pairs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ def adapt(output)
market_pairs = []
output.each do |pair|
market_pairs << Cryptoexchange::Models::MarketPair.new(
base: pair["baseSymbol"],
target: pair["targetSymbol"],
base: pair["targetSymbol"],
target: pair["baseSymbol"],
market: Latoken::Market::NAME
)
end
Expand Down
6 changes: 3 additions & 3 deletions spec/exchanges/latoken/integration/market_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

RSpec.describe 'Latoken integration specs' do
client = Cryptoexchange::Client.new
let(:la_eth_pair) { Cryptoexchange::Models::MarketPair.new(base: 'eth', target: 'la', market: 'latoken') }
let(:la_eth_pair) { Cryptoexchange::Models::MarketPair.new(base: 'la', target: 'eth', market: 'latoken') }

it 'fetch pairs' do
pairs = client.pairs('latoken')
Expand All @@ -17,8 +17,8 @@
it 'fetch ticker' do
ticker = client.ticker(la_eth_pair)

expect(ticker.base).to eq 'ETH'
expect(ticker.target).to eq 'LA'
expect(ticker.base).to eq 'LA'
expect(ticker.target).to eq 'ETH'
expect(ticker.market).to eq 'latoken'
expect(ticker.last).to be_a Numeric
expect(ticker.bid).to be_a Numeric
Expand Down

0 comments on commit 045fc24

Please sign in to comment.