Add optional callback to pollRate
This commit is contained in:
parent
5b53d59cba
commit
8276d87e2a
1 changed files with 6 additions and 2 deletions
|
|
@ -182,15 +182,19 @@ Trader.prototype.pollBalance = function (callback) {
|
|||
});
|
||||
};
|
||||
|
||||
Trader.prototype.pollRate = function () {
|
||||
Trader.prototype.pollRate = function (callback) {
|
||||
var self = this;
|
||||
|
||||
var currency = self.config.exchanges.settings.currency;
|
||||
self.logger.info('polling for rate...');
|
||||
self.tickerExchange.ticker(currency, function(err, rate) {
|
||||
if (err) return;
|
||||
if (err) {
|
||||
return callback && callback(err);
|
||||
}
|
||||
|
||||
self.logger.info('Rate update:', rate);
|
||||
self.rates[currency] = {rate: rate, timestamp: new Date()};
|
||||
callback && callback(null, self.rates[currency]);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue