Expand description
Order types for the trading domain model.
Each order type wraps an OrderCore carrying the state common to all of them and adds its
own type-specific fields. OrderAny dispatches over the concrete types.
Orders are event sourced. OrderCore::apply validates the status transition, runs the
handler for that event, then appends it, so OrderAny::from_events replays a stream to
reconstruct its event-derived state.
A fill-void correction rebuilds the derived fill state from the fills that survive it.
avg_px retains the chronological Decimal notional and quantity fold between fills and
keeps the quotient at that precision. Corrections rebuild the fold rather than subtracting
from saturated or rounded totals. Deserialized orders rebuild the cached fold from stored
events on the next fill. slippage derives from avg_px in the same arithmetic.
Re-exports§
pub use crate::orders::builder::OrderTestBuilder;pub use crate::orders::any::LimitOrderAny;pub use crate::orders::any::OrderAny;pub use crate::orders::any::OrderReplayError;pub use crate::orders::any::PassiveOrderAny;pub use crate::orders::any::StopOrderAny;pub use crate::orders::limit::LimitOrder;pub use crate::orders::limit_if_touched::LimitIfTouchedOrder;pub use crate::orders::list::OrderList;pub use crate::orders::list::OrderListValidationError;pub use crate::orders::market::MarketOrder;pub use crate::orders::market_if_touched::MarketIfTouchedOrder;pub use crate::orders::market_to_limit::MarketToLimitOrder;pub use crate::orders::stop_limit::StopLimitOrder;pub use crate::orders::stop_market::StopMarketOrder;pub use crate::orders::trailing_stop_limit::TrailingStopLimitOrder;pub use crate::orders::trailing_stop_market::TrailingStopMarketOrder;
Modules§
- any
- builder
- limit
- limit_
if_ touched - list
- market
- market_
if_ touched - market_
to_ limit - stop_
limit - stop_
market - stubs
- trailing_
stop_ limit - trailing_
stop_ market
Structs§
- Order
Core - Common event-sourced state shared by order types.
Enums§
Constants§
- LIMIT_
ORDER_ TYPES - Order types that have limit prices.
- LOCAL_
ACTIVE_ ORDER_ STATUSES - Order statuses for locally active orders (pre-submission to venue).
- STOP_
ORDER_ TYPES - Order types that have stop/trigger prices.
- TRIGGERABLE_
ORDER_ TYPES - Order types that support the TRIGGERED order status.
Traits§
Functions§
- str_
indexmap_ to_ ustr - Converts an
IndexMapwithStringkeys and values toUstrkeys and values. - ustr_
indexmap_ to_ str - Converts an
IndexMapwithUstrkeys and values toStringkeys and values.