Skip to content

Commit

Permalink
Fix bug with kraken getTrades
Browse files Browse the repository at this point in the history
  • Loading branch information
cmroche authored and askmike committed Oct 4, 2017
1 parent 3188082 commit b115af3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions exchanges/kraken.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ Trader.prototype.retry = function(method, args) {

Trader.prototype.getTrades = function(since, callback, descending) {
var args = _.toArray(arguments);
var startTs = !_.isNull(since) ? moment(since).valueOf() : null;
var startTs = (since) ? moment(since).valueOf() : null;

var process = function(err, trades) {
if (err || !trades || trades.length === 0) {
Expand Down Expand Up @@ -145,7 +145,7 @@ Trader.prototype.getTrades = function(since, callback, descending) {
pair: this.pair
};

if(!_.isNull(since)) {
if(since) {
// Kraken wants a tid, which is found to be timestamp_ms * 1000000 in practice. No clear documentation on this though
reqData.since = startTs * 1000000;
}
Expand Down Expand Up @@ -254,7 +254,7 @@ Trader.prototype.addOrder = function(tradeType, amount, price, callback) {
err = data.error;

if(err) {
log.error('unable to ' + tradeType.toLowerCase(), err);
log.error('unable to ' + _.lowerCase(tradeType), err);
return this.retry(this.addOrder, args);
}

Expand All @@ -266,7 +266,7 @@ Trader.prototype.addOrder = function(tradeType, amount, price, callback) {

this.kraken.api('AddOrder', {
pair: this.pair,
type: tradeType.toLowerCase(),
type: _.lowerCase(tradeType),
ordertype: 'limit',
price: price,
volume: amount.toString()
Expand Down

0 comments on commit b115af3

Please sign in to comment.