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

Commit

Permalink
Fix to date in emitted trades
Browse files Browse the repository at this point in the history
  • Loading branch information
werkkrew authored and askmike committed Feb 3, 2018
1 parent 29666c1 commit 2a07c60
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions plugins/trader/portfolioManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,10 +344,10 @@ Manager.prototype.relayOrder = function(done) {

var price = 0;
var amount = 0;
var date = moment(0);
var date = moment().unix();

_.each(res.filter(o => !_.isUndefined(o) && o.amount), order => {
date = _.max([moment(order.date), date]);
date = _.max([moment(order.date).unix(), date]);
price = ((price * amount) + (order.price * order.amount)) / (order.amount + amount);
amount += +order.amount;
});
Expand Down

0 comments on commit 2a07c60

Please sign in to comment.