Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

Commit

Permalink
Fix Volume in Bittrex Adapter (#729)
Browse files Browse the repository at this point in the history
* Correction for Incorrect Volume in Bittrex

* Cleanup error message (#715)

Cleaned up the error message so that the console.log is gone and rely on the retry error message instead.
  • Loading branch information
KryptoNova authored and DeviaVir committed Nov 18, 2017
1 parent 7715fbc commit 561957e
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions extensions/exchanges/bittrex/exchange.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module.exports = function container(get, set, clear) {
var timeout = 2500
}

console.error(('\Bittrex API error - unable to call ' + method + ' (' + error + '), retrying in ' + timeout / 1000 + 's').red)
console.error(('\Bittrex API error - unable to call ' + method + ' (' + error.message + '), retrying in ' + timeout / 1000 + 's').red)
setTimeout(function () {
exchange[method].apply(exchange, args)
}, timeout)
Expand All @@ -63,7 +63,6 @@ module.exports = function container(get, set, clear) {

bittrex_public.getmarkethistory(args, function( data ) {
if (!shownWarning) {
console.log('please note: do not be alarmed if you see an error "returned duplicate results"')
console.log('please note: the bittrex api does not support backfilling (trade/paper only).')
console.log('please note: make sure to set the --period=1m to make sure data for trade/paper is fetched.')
shownWarning = true
Expand All @@ -85,17 +84,18 @@ module.exports = function container(get, set, clear) {
try {
Object.keys(data.result).forEach(function (i) {
var trade = data.result[i]
trades.push({
trade_id: trade.Id,
time: moment(trade.TimeStamp).valueOf(),
size: parseFloat(trade.Quantity),
price: parseFloat(trade.Price),
side: trade.OrderType == 'BUY' ? 'buy' : 'sell'
})
if (isNaN(opts.from) || moment(trade.TimeStamp).valueOf() > opts.from) {
trades.push({
trade_id: trade.Id,
time: moment(trade.TimeStamp).valueOf(),
size: parseFloat(trade.Quantity),
price: parseFloat(trade.Price),
side: trade.OrderType == 'BUY' ? 'buy' : 'sell'
})
}
})
} catch (e) {
console.log('bittrex API (getmarkethistory). Retry in progress. Error:' + e);
return retry('getTrades', func_args, {message: e.toString()});
return retry('getTrades', func_args, {message: 'Error: ' + e});
}
cb(null, trades)
})
Expand Down Expand Up @@ -302,7 +302,7 @@ module.exports = function container(get, set, clear) {

// return the property used for range querying.
getCursor: function (trade) {
return Math.floor((trade.time || trade) / 1000)
return (trade.time || trade);
}
}
return exchange
Expand Down

0 comments on commit 561957e

Please sign in to comment.