Add optional callback to pollBalance
This commit is contained in:
parent
926e10da01
commit
5b53d59cba
1 changed files with 7 additions and 1 deletions
|
|
@ -155,7 +155,7 @@ Trader.prototype.stopPolling = function () {
|
|||
clearInterval(this.rateInterval);
|
||||
};
|
||||
|
||||
Trader.prototype.pollBalance = function () {
|
||||
Trader.prototype.pollBalance = function (callback) {
|
||||
var self = this;
|
||||
|
||||
self.logger.info('collecting balance');
|
||||
|
|
@ -170,9 +170,15 @@ Trader.prototype.pollBalance = function () {
|
|||
self.tradeExchange.balance(next);
|
||||
}
|
||||
}, function (err, balance) {
|
||||
if (err) {
|
||||
return callback && callback(err);
|
||||
}
|
||||
|
||||
balance.timestamp = Date.now();
|
||||
self.logger.info('Balance update:', balance);
|
||||
self.balance = balance;
|
||||
|
||||
callback && callback(null, balance);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue