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

Commit

Permalink
Restore onTrade() bail-out in a way that works (#2345)
Browse files Browse the repository at this point in the history
This fix undoes #2334 and fixes the problem it tried to fix, the right way, by restoring bailing out of onTrade when an old trade comes in, but this time with the callback that went missing in the changes in 17e9758#diff-a41b519e7979a713e894ef8d1b3fe568R347-R349 .

Because of the missing call on the callback function, the async queue chain would break when an old trade came in. This PR restores resuming operations when a trade comes in that belongs to a previous period.

The bug, and these changes, affected only those running paper trades in very short timeframes such as 1s or 5s.
  • Loading branch information
jorisw authored Aug 27, 2020
1 parent b192628 commit 3be1c33
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -909,6 +909,9 @@ module.exports = function (s, conf) {
}

function onTrade(trade, is_preroll, cb) {
if (s.period && trade.time < s.period.time) {
return cb()
}
var day = (new Date(trade.time)).getDate()
if (s.last_day && day !== s.last_day) {
s.day_count++
Expand Down

0 comments on commit 3be1c33

Please sign in to comment.