Skip to content
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

Multiple orders for single trade simulation #354

Open
joeledwardson opened this issue Dec 26, 2020 · 1 comment
Open

Multiple orders for single trade simulation #354

joeledwardson opened this issue Dec 26, 2020 · 1 comment
Labels

Comments

@joeledwardson
Copy link

I have come across an unusual bug:
When backtesting, if a situation is created for a historical event where:

  1. Trade created, back Order created with trade
  2. back Order reaches EXECUTION_COMPLETE
  3. New Trade created, lay Order created with new trade
  4. lay Order reaches EXECUTION_COMPLETE

However, if this is exact same execution is modified so that in step 3. the lay Order is created with the same Trade used in step 1. for the back Order, then the lay Order never reaches EXECUTION_COMPLETE?

@joeledwardson
Copy link
Author

I think I have found the bug: in FlumineBacktest._process_backtest_orders(), it has

            if order.trade.status.value == "Complete":
                blotter.complete_order(order)

However, if a Trade has one complete Order then its status will go to Complete, and only after a new Order has been placed will the Trade status go back to LIVE, at which point the blotter has already deemed the Order as Complete

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants