Skip to content

Commit

Permalink
add letsdocoinz trade_page_url, fix fake timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
wongy91 committed Oct 31, 2018
1 parent 5865ce0 commit aa127a1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions lib/cryptoexchange/exchanges/letsdocoinz/market.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ module Letsdocoinz
class Market < Cryptoexchange::Models::Market
NAME = 'letsdocoinz'
API_URL = 'http://api.letsdocoinz.com'

def self.trade_page_url(args={})
"https://letsdocoinz.com/#{args[:base]}-#{args[:target]}"
end
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def adapt(market_pair, output)
ticker.ask = NumericHelper.to_d(output['ask'])
ticker.volume = NumericHelper.to_d(output['volume'])
ticker.change = NumericHelper.to_d(output['change'])
ticker.timestamp = DateTime.parse(output['timestamp']).to_time.to_i
ticker.timestamp = nil
ticker.payload = output
ticker
end
Expand Down
8 changes: 6 additions & 2 deletions spec/exchanges/letsdocoinz/integration/market_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
let(:client) { Cryptoexchange::Client.new }
let(:pk_btc_pair) { Cryptoexchange::Models::MarketPair.new(base: 'PK', target: 'BTC', market: 'letsdocoinz') }

it 'give trade url' do
trade_page_url = client.trade_page_url pk_btc_pair.market, base: pk_btc_pair.base, target: pk_btc_pair.target
expect(trade_page_url).to eq "https://letsdocoinz.com/PK-BTC"
end

it 'fetch pairs' do
pairs = client.pairs('letsdocoinz')
expect(pairs).not_to be_empty
Expand All @@ -25,8 +30,7 @@
expect(ticker.ask).to be_a Numeric
expect(ticker.change).to be_a Numeric
expect(ticker.volume).to be_a Numeric
expect(ticker.timestamp).to be_a Numeric
expect(2000..Date.today.year).to include(Time.at(ticker.timestamp).year)
expect(ticker.timestamp).to be nil
expect(ticker.payload).to_not be nil
end
#
Expand Down

0 comments on commit aa127a1

Please sign in to comment.