pub trait Strategy: DataActor {
Show 57 methods
// Provided methods
fn external_order_claims(&self) -> Option<Vec<InstrumentId>> { ... }
fn strategy_id(&self) -> Option<StrategyId>
where Self: StrategyNative { ... }
fn order(&self) -> OrderApi<'_>
where Self: StrategyNative { ... }
fn portfolio(&self) -> PortfolioApi<'_>
where Self: StrategyNative { ... }
fn submit_order(
&mut self,
order: OrderAny,
position_id: Option<PositionId>,
client_id: Option<ClientId>,
params: Option<Params>,
) -> Result<()>
where Self: StrategyNative { ... }
fn submit_order_list(
&mut self,
orders: Vec<OrderAny>,
position_id: Option<PositionId>,
client_id: Option<ClientId>,
params: Option<Params>,
) -> Result<()>
where Self: StrategyNative { ... }
fn modify_order(
&mut self,
client_order_id: ClientOrderId,
quantity: Option<Quantity>,
price: Option<Price>,
trigger_price: Option<Price>,
client_id: Option<ClientId>,
params: Option<Params>,
) -> Result<()>
where Self: StrategyNative { ... }
fn modify_orders(
&mut self,
updates: Vec<BatchModifyOrder>,
client_id: Option<ClientId>,
params: Option<Params>,
) -> Result<()>
where Self: StrategyNative { ... }
fn cancel_order(
&mut self,
client_order_id: ClientOrderId,
client_id: Option<ClientId>,
params: Option<Params>,
) -> Result<()>
where Self: StrategyNative { ... }
fn cancel_orders(
&mut self,
client_order_ids: Vec<ClientOrderId>,
client_id: Option<ClientId>,
params: Option<Params>,
) -> Result<()>
where Self: StrategyNative { ... }
fn mark_order_pending_update(&mut self, order: &OrderAny) -> Result<bool>
where Self: StrategyNative { ... }
fn mark_order_pending_cancel(&mut self, order: &OrderAny) -> Result<bool>
where Self: StrategyNative { ... }
fn generate_order_pending_update(
&mut self,
order: &OrderAny,
) -> OrderPendingUpdate
where Self: StrategyNative { ... }
fn generate_order_pending_cancel(
&mut self,
order: &OrderAny,
) -> OrderPendingCancel
where Self: StrategyNative { ... }
fn cancel_all_orders(
&mut self,
instrument_id: InstrumentId,
order_side: Option<OrderSide>,
client_id: Option<ClientId>,
params: Option<Params>,
) -> Result<()>
where Self: StrategyNative { ... }
fn close_position(
&mut self,
position: &Position,
client_id: Option<ClientId>,
tags: Option<Vec<Ustr>>,
time_in_force: Option<TimeInForce>,
reduce_only: Option<bool>,
quote_quantity: Option<bool>,
) -> Result<()>
where Self: StrategyNative { ... }
fn close_all_positions(
&mut self,
instrument_id: InstrumentId,
position_side: Option<PositionSide>,
client_id: Option<ClientId>,
tags: Option<Vec<Ustr>>,
time_in_force: Option<TimeInForce>,
reduce_only: Option<bool>,
quote_quantity: Option<bool>,
) -> Result<()>
where Self: StrategyNative { ... }
fn query_account(
&mut self,
account_id: AccountId,
client_id: Option<ClientId>,
params: Option<Params>,
) -> Result<()>
where Self: StrategyNative { ... }
fn query_order(
&mut self,
order: &OrderAny,
client_id: Option<ClientId>,
params: Option<Params>,
) -> Result<()>
where Self: StrategyNative { ... }
fn handle_order_event(&mut self, event: OrderEventAny)
where Self: StrategyNative { ... }
fn handle_position_event(&mut self, event: PositionEvent)
where Self: StrategyNative { ... }
fn on_start(&mut self) -> Result<()>
where Self: StrategyNative { ... }
fn on_time_event(&mut self, event: &TimeEvent) -> Result<()>
where Self: StrategyNative { ... }
fn on_order_initialized(&mut self, event: OrderInitialized) { ... }
fn on_order_event(&mut self, event: OrderEventAny) { ... }
fn on_order_denied(&mut self, event: OrderDenied) { ... }
fn on_order_emulated(&mut self, event: OrderEmulated) { ... }
fn on_order_released(&mut self, event: OrderReleased) { ... }
fn on_order_submitted(&mut self, event: OrderSubmitted) { ... }
fn on_order_rejected(&mut self, event: OrderRejected) { ... }
fn on_order_accepted(&mut self, event: OrderAccepted) { ... }
fn on_order_expired(&mut self, event: OrderExpired) { ... }
fn on_order_triggered(&mut self, event: OrderTriggered) { ... }
fn on_order_pending_update(&mut self, event: OrderPendingUpdate) { ... }
fn on_order_pending_cancel(&mut self, event: OrderPendingCancel) { ... }
fn on_order_modify_rejected(&mut self, event: OrderModifyRejected) { ... }
fn on_order_cancel_rejected(&mut self, event: OrderCancelRejected) { ... }
fn on_order_updated(&mut self, event: OrderUpdated) { ... }
fn on_position_opened(&mut self, event: PositionOpened) { ... }
fn on_position_event(&mut self, event: PositionEvent) { ... }
fn on_position_changed(&mut self, event: PositionChanged) { ... }
fn on_position_closed(&mut self, event: PositionClosed) { ... }
fn on_market_exit(&mut self) { ... }
fn post_market_exit(&mut self) { ... }
fn is_exiting(&self) -> bool
where Self: StrategyNative { ... }
fn market_exit(&mut self) -> Result<()>
where Self: StrategyNative { ... }
fn check_market_exit(&mut self, _event: TimeEvent)
where Self: StrategyNative { ... }
fn finalize_market_exit(&mut self)
where Self: StrategyNative { ... }
fn cancel_market_exit(&mut self)
where Self: StrategyNative { ... }
fn stop(&mut self) -> bool
where Self: StrategyNative { ... }
fn deny_order(&mut self, order: &OrderAny, reason: Ustr)
where Self: StrategyNative { ... }
fn deny_order_list(&mut self, orders: &[OrderAny], reason: Ustr)
where Self: StrategyNative { ... }
fn set_gtd_expiry(&mut self, order: &OrderAny) -> Result<()>
where Self: StrategyNative { ... }
fn cancel_gtd_expiry(&mut self, client_order_id: &ClientOrderId)
where Self: StrategyNative { ... }
fn has_gtd_expiry_timer(&mut self, client_order_id: &ClientOrderId) -> bool
where Self: StrategyNative { ... }
fn expire_gtd_order(&mut self, event: TimeEvent)
where Self: StrategyNative { ... }
fn reactivate_gtd_timers(&mut self)
where Self: StrategyNative { ... }
}Expand description
Core trait for implementing trading strategies in NautilusTrader.
Strategies are specialized [DataActor]s that combine data ingestion capabilities with
order and position management functionality. By implementing this trait,
custom strategies gain access to the full trading execution stack including order
submission, modification, cancellation, and position management.
§Key Capabilities
- All [
DataActor] capabilities (data subscriptions, event handling, timers). - Order lifecycle management (submit, modify, cancel).
- Position management (open, close, monitor).
- Access to the trading cache and portfolio.
- Event routing for orders and emulator events.
§Implementation
Use the nautilus_strategy! macro to generate the native runtime wiring
and Strategy implementations. Normal strategy logic should call facade
methods such as strategy_id(), clock(), cache(), order(), and
portfolio(). Native runtime code that needs the internal core should use
StrategyNative. For strategies that override additional trait methods,
pass them in a block:
nautilus_strategy!(MyStrategy, {
fn on_order_rejected(&mut self, event: OrderRejected) {
// custom handling
}
});Default methods that read or mutate native runtime state carry explicit
StrategyNative bounds. Strategy implementations that only need core-free
callbacks can implement this trait with their own [Component]
implementation, while runtime-registered strategies keep using native
wiring.
Provided Methods§
Sourcefn external_order_claims(&self) -> Option<Vec<InstrumentId>>
fn external_order_claims(&self) -> Option<Vec<InstrumentId>>
Returns the external order claims for this strategy.
These are instrument IDs whose external orders should be claimed by this strategy during reconciliation.
Sourcefn strategy_id(&self) -> Option<StrategyId>where
Self: StrategyNative,
fn strategy_id(&self) -> Option<StrategyId>where
Self: StrategyNative,
Returns the runtime strategy ID, when configured or registered.
Sourcefn order(&self) -> OrderApi<'_>where
Self: StrategyNative,
fn order(&self) -> OrderApi<'_>where
Self: StrategyNative,
Returns the user-facing order creation API.
Sourcefn portfolio(&self) -> PortfolioApi<'_>where
Self: StrategyNative,
fn portfolio(&self) -> PortfolioApi<'_>where
Self: StrategyNative,
Returns the user-facing portfolio read API.
Sourcefn submit_order(
&mut self,
order: OrderAny,
position_id: Option<PositionId>,
client_id: Option<ClientId>,
params: Option<Params>,
) -> Result<()>where
Self: StrategyNative,
fn submit_order(
&mut self,
order: OrderAny,
position_id: Option<PositionId>,
client_id: Option<ClientId>,
params: Option<Params>,
) -> Result<()>where
Self: StrategyNative,
Submits an order.
§Errors
Returns an error if the strategy is not registered or order submission fails.
Sourcefn submit_order_list(
&mut self,
orders: Vec<OrderAny>,
position_id: Option<PositionId>,
client_id: Option<ClientId>,
params: Option<Params>,
) -> Result<()>where
Self: StrategyNative,
fn submit_order_list(
&mut self,
orders: Vec<OrderAny>,
position_id: Option<PositionId>,
client_id: Option<ClientId>,
params: Option<Params>,
) -> Result<()>where
Self: StrategyNative,
Submits an order list.
§Errors
Returns an error if the strategy is not registered, the order list is invalid, or order list submission fails.
Sourcefn modify_order(
&mut self,
client_order_id: ClientOrderId,
quantity: Option<Quantity>,
price: Option<Price>,
trigger_price: Option<Price>,
client_id: Option<ClientId>,
params: Option<Params>,
) -> Result<()>where
Self: StrategyNative,
fn modify_order(
&mut self,
client_order_id: ClientOrderId,
quantity: Option<Quantity>,
price: Option<Price>,
trigger_price: Option<Price>,
client_id: Option<ClientId>,
params: Option<Params>,
) -> Result<()>where
Self: StrategyNative,
Modifies an order.
§Errors
Returns an error if the strategy is not registered or order modification fails.
Sourcefn modify_orders(
&mut self,
updates: Vec<BatchModifyOrder>,
client_id: Option<ClientId>,
params: Option<Params>,
) -> Result<()>where
Self: StrategyNative,
fn modify_orders(
&mut self,
updates: Vec<BatchModifyOrder>,
client_id: Option<ClientId>,
params: Option<Params>,
) -> Result<()>where
Self: StrategyNative,
Batch modifies multiple orders for the same instrument.
Each tuple is (client_order_id, quantity, price, trigger_price).
§Errors
Returns an error if the strategy is not registered, the orders span multiple instruments, contain emulated/local orders, or a child modify is invalid.
Sourcefn cancel_order(
&mut self,
client_order_id: ClientOrderId,
client_id: Option<ClientId>,
params: Option<Params>,
) -> Result<()>where
Self: StrategyNative,
fn cancel_order(
&mut self,
client_order_id: ClientOrderId,
client_id: Option<ClientId>,
params: Option<Params>,
) -> Result<()>where
Self: StrategyNative,
Cancels an order.
§Errors
Returns an error if the strategy is not registered or order cancellation fails.
Sourcefn cancel_orders(
&mut self,
client_order_ids: Vec<ClientOrderId>,
client_id: Option<ClientId>,
params: Option<Params>,
) -> Result<()>where
Self: StrategyNative,
fn cancel_orders(
&mut self,
client_order_ids: Vec<ClientOrderId>,
client_id: Option<ClientId>,
params: Option<Params>,
) -> Result<()>where
Self: StrategyNative,
Batch cancels multiple orders for the same instrument.
§Errors
Returns an error if the strategy is not registered, the orders span multiple instruments, or contain emulated/local orders.
Sourcefn mark_order_pending_update(&mut self, order: &OrderAny) -> Result<bool>where
Self: StrategyNative,
fn mark_order_pending_update(&mut self, order: &OrderAny) -> Result<bool>where
Self: StrategyNative,
Marks an order as pending update locally before the modify command leaves the strategy.
§Errors
Returns an error if applying the pending update event to the cache fails.
Sourcefn mark_order_pending_cancel(&mut self, order: &OrderAny) -> Result<bool>where
Self: StrategyNative,
fn mark_order_pending_cancel(&mut self, order: &OrderAny) -> Result<bool>where
Self: StrategyNative,
Marks an order as pending cancel locally before the cancel command leaves the strategy.
§Errors
Returns an error if applying the pending cancel event to the cache fails.
Sourcefn generate_order_pending_update(
&mut self,
order: &OrderAny,
) -> OrderPendingUpdatewhere
Self: StrategyNative,
fn generate_order_pending_update(
&mut self,
order: &OrderAny,
) -> OrderPendingUpdatewhere
Self: StrategyNative,
Generates an OrderPendingUpdate event for an order.
Sourcefn generate_order_pending_cancel(
&mut self,
order: &OrderAny,
) -> OrderPendingCancelwhere
Self: StrategyNative,
fn generate_order_pending_cancel(
&mut self,
order: &OrderAny,
) -> OrderPendingCancelwhere
Self: StrategyNative,
Generates an OrderPendingCancel event for an order.
Sourcefn cancel_all_orders(
&mut self,
instrument_id: InstrumentId,
order_side: Option<OrderSide>,
client_id: Option<ClientId>,
params: Option<Params>,
) -> Result<()>where
Self: StrategyNative,
fn cancel_all_orders(
&mut self,
instrument_id: InstrumentId,
order_side: Option<OrderSide>,
client_id: Option<ClientId>,
params: Option<Params>,
) -> Result<()>where
Self: StrategyNative,
Cancels all open orders for the given instrument.
§Errors
Returns an error if the strategy is not registered or order cancellation fails.
Sourcefn close_position(
&mut self,
position: &Position,
client_id: Option<ClientId>,
tags: Option<Vec<Ustr>>,
time_in_force: Option<TimeInForce>,
reduce_only: Option<bool>,
quote_quantity: Option<bool>,
) -> Result<()>where
Self: StrategyNative,
fn close_position(
&mut self,
position: &Position,
client_id: Option<ClientId>,
tags: Option<Vec<Ustr>>,
time_in_force: Option<TimeInForce>,
reduce_only: Option<bool>,
quote_quantity: Option<bool>,
) -> Result<()>where
Self: StrategyNative,
Closes a position by submitting a market order for the opposite side.
§Errors
Returns an error if the strategy is not registered or position closing fails.
Sourcefn close_all_positions(
&mut self,
instrument_id: InstrumentId,
position_side: Option<PositionSide>,
client_id: Option<ClientId>,
tags: Option<Vec<Ustr>>,
time_in_force: Option<TimeInForce>,
reduce_only: Option<bool>,
quote_quantity: Option<bool>,
) -> Result<()>where
Self: StrategyNative,
fn close_all_positions(
&mut self,
instrument_id: InstrumentId,
position_side: Option<PositionSide>,
client_id: Option<ClientId>,
tags: Option<Vec<Ustr>>,
time_in_force: Option<TimeInForce>,
reduce_only: Option<bool>,
quote_quantity: Option<bool>,
) -> Result<()>where
Self: StrategyNative,
Closes all open positions for the given instrument.
§Errors
Returns an error if the strategy is not registered or position closing fails.
Sourcefn query_account(
&mut self,
account_id: AccountId,
client_id: Option<ClientId>,
params: Option<Params>,
) -> Result<()>where
Self: StrategyNative,
fn query_account(
&mut self,
account_id: AccountId,
client_id: Option<ClientId>,
params: Option<Params>,
) -> Result<()>where
Self: StrategyNative,
Queries account state from the execution client.
Creates a [QueryAccount] command and sends it to the execution engine,
which will request the current account state from the execution client.
§Errors
Returns an error if the strategy is not registered.
Sourcefn query_order(
&mut self,
order: &OrderAny,
client_id: Option<ClientId>,
params: Option<Params>,
) -> Result<()>where
Self: StrategyNative,
fn query_order(
&mut self,
order: &OrderAny,
client_id: Option<ClientId>,
params: Option<Params>,
) -> Result<()>where
Self: StrategyNative,
Queries order state from the execution client.
Creates a [QueryOrder] command and sends it to the execution engine,
which will request the current order state from the execution client.
§Errors
Returns an error if the strategy is not registered.
Sourcefn handle_order_event(&mut self, event: OrderEventAny)where
Self: StrategyNative,
fn handle_order_event(&mut self, event: OrderEventAny)where
Self: StrategyNative,
Handles an order event, dispatching to the appropriate handler.
Sourcefn handle_position_event(&mut self, event: PositionEvent)where
Self: StrategyNative,
fn handle_position_event(&mut self, event: PositionEvent)where
Self: StrategyNative,
Handles a position event, dispatching to the appropriate handler.
Sourcefn on_start(&mut self) -> Result<()>where
Self: StrategyNative,
fn on_start(&mut self) -> Result<()>where
Self: StrategyNative,
Called when the strategy is started.
Override this method to implement custom initialization logic.
The default implementation reactivates GTD timers if manage_gtd_expiry is enabled.
§Errors
Returns an error if strategy initialization fails.
Sourcefn on_time_event(&mut self, event: &TimeEvent) -> Result<()>where
Self: StrategyNative,
fn on_time_event(&mut self, event: &TimeEvent) -> Result<()>where
Self: StrategyNative,
Called when a time event is received.
Routes GTD expiry timer events to the expiry handler and market exit timer events to the market exit checker.
§Errors
Returns an error if time event handling fails.
Sourcefn on_order_initialized(&mut self, event: OrderInitialized)
fn on_order_initialized(&mut self, event: OrderInitialized)
Called when an order is initialized.
Override this method to implement custom logic when an order is first created.
Sourcefn on_order_event(&mut self, event: OrderEventAny)
fn on_order_event(&mut self, event: OrderEventAny)
Called when any order event is received after the specific order handler runs.
Override this method to implement custom logic for all order events.
Sourcefn on_order_denied(&mut self, event: OrderDenied)
fn on_order_denied(&mut self, event: OrderDenied)
Called when an order is denied by the system.
Override this method to implement custom logic when an order is denied before submission.
Sourcefn on_order_emulated(&mut self, event: OrderEmulated)
fn on_order_emulated(&mut self, event: OrderEmulated)
Called when an order is emulated.
Override this method to implement custom logic when an order is taken over by the emulator.
Sourcefn on_order_released(&mut self, event: OrderReleased)
fn on_order_released(&mut self, event: OrderReleased)
Called when an order is released from emulation.
Override this method to implement custom logic when an emulated order is released.
Sourcefn on_order_submitted(&mut self, event: OrderSubmitted)
fn on_order_submitted(&mut self, event: OrderSubmitted)
Called when an order is submitted to the venue.
Override this method to implement custom logic when an order is submitted.
Sourcefn on_order_rejected(&mut self, event: OrderRejected)
fn on_order_rejected(&mut self, event: OrderRejected)
Called when an order is rejected by the venue.
Override this method to implement custom logic when an order is rejected.
Sourcefn on_order_accepted(&mut self, event: OrderAccepted)
fn on_order_accepted(&mut self, event: OrderAccepted)
Called when an order is accepted by the venue.
Override this method to implement custom logic when an order is accepted.
Sourcefn on_order_expired(&mut self, event: OrderExpired)
fn on_order_expired(&mut self, event: OrderExpired)
Called when an order expires.
Override this method to implement custom logic when an order expires.
Sourcefn on_order_triggered(&mut self, event: OrderTriggered)
fn on_order_triggered(&mut self, event: OrderTriggered)
Called when an order is triggered.
Override this method to implement custom logic when a stop or conditional order is triggered.
Sourcefn on_order_pending_update(&mut self, event: OrderPendingUpdate)
fn on_order_pending_update(&mut self, event: OrderPendingUpdate)
Called when an order modification is pending.
Override this method to implement custom logic when an order is pending modification.
Sourcefn on_order_pending_cancel(&mut self, event: OrderPendingCancel)
fn on_order_pending_cancel(&mut self, event: OrderPendingCancel)
Called when an order cancellation is pending.
Override this method to implement custom logic when an order is pending cancellation.
Sourcefn on_order_modify_rejected(&mut self, event: OrderModifyRejected)
fn on_order_modify_rejected(&mut self, event: OrderModifyRejected)
Called when an order modification is rejected.
Override this method to implement custom logic when an order modification is rejected.
Sourcefn on_order_cancel_rejected(&mut self, event: OrderCancelRejected)
fn on_order_cancel_rejected(&mut self, event: OrderCancelRejected)
Called when an order cancellation is rejected.
Override this method to implement custom logic when an order cancellation is rejected.
Sourcefn on_order_updated(&mut self, event: OrderUpdated)
fn on_order_updated(&mut self, event: OrderUpdated)
Called when an order is updated.
Override this method to implement custom logic when an order is modified.
Sourcefn on_position_opened(&mut self, event: PositionOpened)
fn on_position_opened(&mut self, event: PositionOpened)
Called when a position is opened.
Override this method to implement custom logic when a position is opened.
Sourcefn on_position_event(&mut self, event: PositionEvent)
fn on_position_event(&mut self, event: PositionEvent)
Called after a position opened, changed, or closed handler runs.
Override this method to implement custom logic for all position events.
Sourcefn on_position_changed(&mut self, event: PositionChanged)
fn on_position_changed(&mut self, event: PositionChanged)
Called when a position is changed (quantity or price updated).
Override this method to implement custom logic when a position changes.
Sourcefn on_position_closed(&mut self, event: PositionClosed)
fn on_position_closed(&mut self, event: PositionClosed)
Called when a position is closed.
Override this method to implement custom logic when a position is closed.
Sourcefn on_market_exit(&mut self)
fn on_market_exit(&mut self)
Called when a market exit has been initiated.
Override this method to implement custom logic when a market exit begins.
Sourcefn post_market_exit(&mut self)
fn post_market_exit(&mut self)
Called after a market exit has completed.
Override this method to implement custom logic after a market exit completes.
Sourcefn is_exiting(&self) -> boolwhere
Self: StrategyNative,
fn is_exiting(&self) -> boolwhere
Self: StrategyNative,
Returns whether the strategy is currently executing a market exit.
Strategies can check this to avoid submitting new orders during exit.
Sourcefn market_exit(&mut self) -> Result<()>where
Self: StrategyNative,
fn market_exit(&mut self) -> Result<()>where
Self: StrategyNative,
Initiates an iterative market exit for the strategy.
Will cancel all open orders and close all open positions, and wait for all in-flight orders to resolve and positions to close. The strategy remains running after the exit completes.
The on_market_exit hook is called when the exit process begins.
The post_market_exit hook is called when the exit process completes.
Uses market_exit_time_in_force and market_exit_reduce_only from
the strategy config for closing market orders.
§Errors
Returns an error if the market exit cannot be initiated.
Sourcefn check_market_exit(&mut self, _event: TimeEvent)where
Self: StrategyNative,
fn check_market_exit(&mut self, _event: TimeEvent)where
Self: StrategyNative,
Checks if the market exit is complete and finalizes if so.
This method is called by the market exit timer.
Sourcefn finalize_market_exit(&mut self)where
Self: StrategyNative,
fn finalize_market_exit(&mut self)where
Self: StrategyNative,
Finalizes the market exit process.
Cancels the market exit timer, resets state, calls the post_market_exit hook,
and stops the strategy if a stop was pending.
Sourcefn cancel_market_exit(&mut self)where
Self: StrategyNative,
fn cancel_market_exit(&mut self)where
Self: StrategyNative,
Cancels an active market exit without calling hooks.
Used when stop() is called during an active market exit to avoid state leaks.
Sourcefn stop(&mut self) -> boolwhere
Self: StrategyNative,
fn stop(&mut self) -> boolwhere
Self: StrategyNative,
Stops the strategy with optional managed stop behavior.
If manage_stop is enabled in the config, the strategy will first complete
any active market exit (or initiate one) before stopping. If manage_stop
is disabled, the strategy stops immediately, cleaning up any active market
exit state.
§Returns
Returns true if the strategy should proceed with stopping, false if
the stop is being deferred until market exit completes.
Sourcefn deny_order(&mut self, order: &OrderAny, reason: Ustr)where
Self: StrategyNative,
fn deny_order(&mut self, order: &OrderAny, reason: Ustr)where
Self: StrategyNative,
Denies an order by generating an OrderDenied event.
This method creates an OrderDenied event, applies it to the order,
and updates the cache.
Sourcefn deny_order_list(&mut self, orders: &[OrderAny], reason: Ustr)where
Self: StrategyNative,
fn deny_order_list(&mut self, orders: &[OrderAny], reason: Ustr)where
Self: StrategyNative,
Denies all orders in an order list.
This method denies each non-closed order in the list.
Sourcefn set_gtd_expiry(&mut self, order: &OrderAny) -> Result<()>where
Self: StrategyNative,
fn set_gtd_expiry(&mut self, order: &OrderAny) -> Result<()>where
Self: StrategyNative,
Sets a GTD expiry timer for an order.
Creates a timer that will automatically cancel the order when it expires.
§Errors
Returns an error if timer creation fails.
Sourcefn cancel_gtd_expiry(&mut self, client_order_id: &ClientOrderId)where
Self: StrategyNative,
fn cancel_gtd_expiry(&mut self, client_order_id: &ClientOrderId)where
Self: StrategyNative,
Cancels a GTD expiry timer for an order.
Sourcefn has_gtd_expiry_timer(&mut self, client_order_id: &ClientOrderId) -> boolwhere
Self: StrategyNative,
fn has_gtd_expiry_timer(&mut self, client_order_id: &ClientOrderId) -> boolwhere
Self: StrategyNative,
Checks if a GTD expiry timer exists for an order.
Sourcefn expire_gtd_order(&mut self, event: TimeEvent)where
Self: StrategyNative,
fn expire_gtd_order(&mut self, event: TimeEvent)where
Self: StrategyNative,
Handles GTD order expiry by canceling the order.
This method is called when a GTD expiry timer fires.
Sourcefn reactivate_gtd_timers(&mut self)where
Self: StrategyNative,
fn reactivate_gtd_timers(&mut self)where
Self: StrategyNative,
Reactivates GTD timers for open orders on strategy start.
Queries the cache for all open GTD orders and creates timers for those that haven’t expired yet. Orders that have already expired are canceled immediately.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".