-
Notifications
You must be signed in to change notification settings - Fork 1k
Inconsistency in account updates across event hooks #2513
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
Comments
Thanks for the report. This required some deeper investigation. It was found that in the case of The fix involves centralizing the following into a single code block:
The way Now on You should now see the account state consistently updated as events arrive at the strategy. Please report if you see any further issues. |
Consistent ordering of event types is now verified per #2554. See initial black box MRE style test. These test asserts are just the minimum necessary to verify the behavior, there is much scope for improvement but at least this issue is now resolved. |
Reopened due commit 5f6b89f which partially reverted the refactoring to consolidate account events based on position events. |
Bug Report
In the given file, there is a Strategy, which sends two orders one after another (market, then limit).
Expected Behavior
Account is updated consistently on on_portfolio_changed, on_order_filled and on_order_accepted hooks. (Either all before or all after - I would personally prefer the before approach as you can operate with the correct numbers in the time the hook is called)
Actual Behavior
After the market order is filled, the on_order_filled hook shows the old locked balance value. The on_order_accepted and on_portfolio_changed hooks shows current locked balance value.
Steps to Reproduce the Problem
Specifications
The text was updated successfully, but these errors were encountered: