Skip to content

Commit

Permalink
fix coinzest (coingecko#1459)
Browse files Browse the repository at this point in the history
  • Loading branch information
wenjieyek authored and wongy91 committed Apr 4, 2019
1 parent 5361767 commit c14a277
Show file tree
Hide file tree
Showing 6 changed files with 295 additions and 1,932 deletions.
2 changes: 1 addition & 1 deletion lib/cryptoexchange/exchanges/coinzest/services/market.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def adapt(market_pair, output)
ticker.high = NumericHelper.to_d(output['High'])
ticker.low = NumericHelper.to_d(output['Low'])
ticker.volume = NumericHelper.to_d(output['BaseVolume']/output['Last'])
ticker.timestamp = output['TimeStamp']/1000
ticker.timestamp = nil
ticker.payload = output
ticker
end
Expand Down
18 changes: 8 additions & 10 deletions lib/cryptoexchange/exchanges/coinzest/services/pairs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,21 @@ module Cryptoexchange::Exchanges
module Coinzest
module Services
class Pairs < Cryptoexchange::Services::Pairs
PAIRS_URL = "#{Cryptoexchange::Exchanges::Coinzest::Market::API_URL}/market"
PAIRS_URL = "#{Cryptoexchange::Exchanges::Coinzest::Market::API_URL}/market_summary"

def fetch
ctx = OpenSSL::SSL::SSLContext.new
ctx.verify_mode = OpenSSL::SSL::VERIFY_NONE
result = HTTP.get(PAIRS_URL, ssl_context: ctx)
output = JSON.parse(result)
market_pairs = []
output['list'].each do |pair|
market_pairs << Cryptoexchange::Models::MarketPair.new(
base: pair['trdCoinName'],
target: pair['mrkCoinName'],
inst_id: "#{pair['mrkCoin']}-#{pair['trdCoin']}",
market: Coinzest::Market::NAME
)
output['result'].map do |pair|
target, base = pair['MarketName'].split('-')
Cryptoexchange::Models::MarketPair.new(
base: base,
target: target,
market: Coinzest::Market::NAME
)
end
market_pairs
end
end
end
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c14a277

Please sign in to comment.