-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Add price protection support for market orders #3065
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
base: develop
Are you sure you want to change the base?
Add price protection support for market orders #3065
Conversation
…trader into enhancement/price_protection_for_market
|
Hi @Antifrajz Thanks for the contribution! Looks like the pre-commit failed, but this is easy to fix. Just run the following and push any changes to the same PR: or (if you're on Windows): Also consider running the following to install the git hook which will run the pre-commit automatically on commit: |
Done, thank you @cjdsellers Edit: I will resolve confilcts asap, I'm on a vacation now |
|
Hi @Antifrajz I think a |
|
Hi @Antifrajz Thank you for your work on this 🙏. Since it's quite a large change, I'll start reviewing properly after the next release (which is imminent 1-2 days). We'd also need the CLA signing prior to merge as well. |
Hi @cjdsellers , Thank you for your help. I made the last changes just before I went to sleep, hoping the pipelines would pass in the meantime. No problem at all on the review timing; please take your time. We can do the CLA signing when we're both available. Best |
|
Hi, the CLA is an online form, you just need to sign it (if you want), there's no need to wait for @cjdsellers on this. |
Hello @faysou |
|
The pull request still shows the CLA as not signed, maybe you can try again. |
Update CI wheel counts after dropping Python 3.11.
Use isort for import sorting instead of ruff's built-in import sorting (rule "I"). This allows separate line_length configurations: code uses 100 chars (ruff) while imports use 150 chars (isort) to prevent unwanted multi-line hanging indent formatting. isort provides more granular control over import formatting for now.
- Add interactive Plotly tearsheets with performance metrics and charts - Add CAGR, CalmarRatio, MaxDrawdown portfolio statistics - Standardize uv pip commands
- Pin cargo-deny/nextest/llvm-cov/audit versions - Enable license checks in CI - Clarify implied-vol MIT license with hash verification - Update workspace license from deprecated LGPL-3.0 to LGPL-3.0-or-later
- Add `_sorted` flag and `sort=False` parameter to defer sorting - Add presorted parameter to data iterator to skip redundant sorts - Optimize `BacktestNode` to sort once after loading all data configs - Add test coverage and documentation for deferred sorting
- Implement Rust reconciliation engine for continuous position sync - Add lifecycle tracking with zero-crossing detection for avg price - Add backwards-solving to reconstruct missing opening fills - Add test coverage (28 Python + 51 Rust tests)
Not yet operational.
- Replace all f64 parsing with Decimal to reduce rounding errors - Fix MARGIN position parsing to handle quote-to-base conversion
Remove dead code causing warnings.
65838a6 to
5e52e49
Compare
There is a problem with my email. I fixed it |
Pull Request
NautilusTrader prioritizes correctness and reliability, please follow existing patterns for validation and testing.
CONTRIBUTING.mdand followed the established practicesSummary
In this PR, the concept of Market and Stop Market orders with protection is introduced. It basically converts any Market or Stop Market order, once triggered, into a Limit xor Stop Limit order using the protection points from the market configuration and the best opposite limit on the order book.
Related Issues/PRs
Resolves #1082
Type of change
Testing
Ensure new or changed logic is covered by tests.
I added Unit tests for calucation and all affected code paths