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

Fix live trading for GDAX (and others) add a message to improve low volume pre-roll #470

Merged
merged 2 commits into from
Aug 14, 2017
Merged

Fix live trading for GDAX (and others) add a message to improve low volume pre-roll #470

merged 2 commits into from
Aug 14, 2017

Conversation

cmroche
Copy link
Contributor

@cmroche cmroche commented Aug 13, 2017

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.

@@ -114,11 +114,10 @@ module.exports = function container (get, set, clear) {
limit: 1000
}
if (db_cursor) {
trade_cursor = db_cursor
Copy link
Contributor Author

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
Copy link
Contributor Author

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.

@cmroche cmroche changed the title SHow a message while waiting for first live trade Fix live trading for GDAX (and others) add a message to improve low volume pre-roll Aug 14, 2017
@DeviaVir DeviaVir merged commit 23b3cab into DeviaVir:master Aug 14, 2017
@cmroche cmroche deleted the low_volume_imrpovements branch August 17, 2017 16:40
supersabbath pushed a commit to supersabbath/zenbot that referenced this pull request Oct 2, 2017
…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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants