-
Notifications
You must be signed in to change notification settings - Fork 2k
Fix live trading for GDAX (and others) add a message to improve low volume pre-roll #470
Conversation
@@ -114,11 +114,10 @@ module.exports = function container (get, set, clear) { | |||
limit: 1000 | |||
} | |||
if (db_cursor) { | |||
trade_cursor = db_cursor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line isn't actually necessary, was added in a previous PR I sent. This conditional branch once getNext is called following any valid data. The function passed to engine.update which set the db_cursor will also properly set the trade_cursor using a call to s.exchange.getCursor as one would expect.
opts.query.time = {$gt: db_cursor} | ||
} | ||
else { | ||
trade_cursor = query_start |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line however is necessary, since we may quit pre-roll after 1 iteration and no data may be present. In that case we would have an invalid trade_cursor once we started updating the engine causing exchange.getTrades to return and process as many results as possible in a single API call.
…olume pre-roll (DeviaVir#470) * Show a message now while waiting for first live trade * Fixing pre-roll trade_cursor for exchanges that don't paginate on timestamps
This is an improvement to the previous low volume fix. In low volume markets there may not be any trades during the pre_roll or initial live trading periods, it is not possible to show reports in that case which gives the impression that the bot it broken. Now we will at least show a message indicating that we are waiting for data before reporting starts.
Also provide a fix for broken trading GDAX. The exchange doesn't use timestamps so it is necessary to call getCursor when setting the trade_cursor.