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

Commit

Permalink
refresh portfolio stats every 11 minutes
Browse files Browse the repository at this point in the history
some users would prefer the cex.io portfolio balance should be refreshed periodically with more current BTC balance (as a result of BTC withdraw, deposit, mining new coin with the GHS, etc.)

this commit will affect all exchanges, not just cex.io

refresh period is 20 minutes
  • Loading branch information
kuzetsa committed Dec 5, 2013
1 parent 46bafeb commit fa9f8f2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions portfolioManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,17 @@ var Manager = function(conf, checker) {
this.emit('ready');
};

// callback function to refresh portfolio stats
var refreshPortfolio = function() {
log.info('refreshed', this.exchange.name, 'portfolio:');
_.each(this.portfolio, function(fund) {
log.info('\t', fund.name + ':', fund.amount);
});
};

// refresh portfolio stats every 11 minutes
setInterval(_.bind(refreshPortfolio, this), util.minToMs( 11 ));

async.series([
this.setPortfolio,
this.setFee
Expand Down

0 comments on commit fa9f8f2

Please sign in to comment.