-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds handling of FOK orders status getting stuck #684
Adds handling of FOK orders status getting stuck #684
Conversation
@@ -29,6 +29,9 @@ def execute_place( | |||
if instruction_report.status == "SUCCESS": | |||
if instruction_report.order_status == "PENDING": | |||
pass # async request pending processing | |||
elif instruction_report.order_status == "EXPIRED": |
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.
I'm not sure how this may effect other orders
Awesome work! Do you have responses from the Betfair order stream when placing FOK bets (matched/cancelled) by any chance? I assumed the order goes straight from PENDING -> EXECUTION_COMPLETE when implementing FOK simulation, but I would like to verify that against a live market. |
flumine/order/process.py
Outdated
order.responses.placed() | ||
order.bet_id = current_order.bet_id | ||
log_control(OrderEvent(order)) | ||
# pickup FOK orders |
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.
Why doesn't a FOK order have a bet_id in the place response?
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.
That is a good point. It is provided by Betfair: #681 (comment)
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 seems to happen when the order comes back in the stream before we get the instruction report and set the bet_id. Just tested and think the fix in betfairexecution.py should be enough.
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.
That would explain the stochastic nature of this bug. However, I am quite surprised this has not been picked up on earlier because it's not just FOK bets that are affected by the place response arriving later than the order update.
Fixes #681