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

Transactions to all fail or all validate as a group #542

Open
jsphon opened this issue Dec 23, 2021 · 3 comments
Open

Transactions to all fail or all validate as a group #542

jsphon opened this issue Dec 23, 2021 · 3 comments

Comments

@jsphon
Copy link
Contributor

jsphon commented Dec 23, 2021

When placing multiple orders within a single trade, it would be nice if it was possible to make Flumine reject all the orders if any of them fail to validate. I am currently using this hacky code to achieve the desired result:


  with market.transaction() as t:
                            all_valid = all(
                                t._validate_controls(order, OrderPackageType.PLACE)
                                for order in entry_trade.orders
                            )
                            if all_valid:
                                if runner_context.live_trade_count+len(entry_trade.orders)<self.max_live_trade_count:
                                    for order in entry_trade.orders:
                                        t.place_order(order)
                                else:
                                    logger.error('This would invalidate the max trade count')
@liampauling
Copy link
Member

The problem here is that it is easy to add some logic to check a list of orders against the controls but I assume you also went to check them against themselves ie. two orders to be placed A & B:

  • Does placing order A result in order B violating

To do this A has to be 'placed' and added to the blotter but then violated along with B if there is an issue. Trying to think of a clean way of doing this.

@jsphon
Copy link
Contributor Author

jsphon commented Jan 7, 2022 via email

@jsphon
Copy link
Contributor Author

jsphon commented May 25, 2022

I've attempted to address this with:

#590

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

No branches or pull requests

2 participants