If it is possible to modify existing order by id using current interface #2908
Unanswered
daviddwlee84
asked this question in
Q&A
Replies: 1 comment
-
Hi @daviddwlee84, Thanks for reaching out with your thoughtful feedback and questions. I don't think we should consider maintaining a separate map of quantity by order ID in the book (for performance overhead reasons), but we could consider adding a method to at least expose a way of querying that (would be a couple of calls to get to it). I agree this would be more efficient than maintaining a mapping or book in parallel, especially in Python. Do you have a suggested API? Otherwise, if you wanted to make a PR including tests then this would be appreciated and I'd be happy to review 👍 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Based on my current understanding (considering the L3_MBO scenario), the OrderBook’s underlying BookLadder maintains a cache keyed by order_id that points to a BookLevel, and each BookLevel implements a FIFO queue of the original BookOrders.
However, with the current interface, modifying an order requires using
OrderBookDelta
, and the only implemented operation related to this I see isBookAction.Update
.The issue is that update expects the target volume after the change; if the exchange/data source only provides a volume delta (e.g. some exchanges send ticks that amend orders by order_id (e.g., change volume)), I need a way to fetch the original volume for that order_id.
In these cases, I find myself maintaining an additional table to track each order’s remaining quantity or filled status (with logic possibly living in the Actor/Strategy). This feels like duplicating dummy information, and the maintenance overhead ends up being comparable to running a second OrderBook in parallel.
Any recommended approaches or patterns to address this?
For example, would it make sense to expose a query to retrieve the current volume by order_id, or to support delta-based updates directly in OrderBookDelta?
nautilus_trader/nautilus_trader/core/nautilus_pyo3.pyi
Lines 3706 to 3785 in a9e985b
nautilus_trader/crates/model/src/orderbook/ladder.rs
Lines 141 to 209 in a9e985b
nautilus_trader/crates/model/src/orderbook/level.rs
Lines 31 to 42 in a9e985b
nautilus_trader/nautilus_trader/core/nautilus_pyo3.pyi
Lines 823 to 865 in a9e985b
nautilus_trader/nautilus_trader/core/nautilus_pyo3.pyi
Lines 1286 to 1290 in a9e985b
Beta Was this translation helpful? Give feedback.
All reactions