pub struct RiskCheckedOrderExecutor { /* private fields */ }Expand description
An OrderExecutor decorator that enforces pre-trade risk checks before
delegating to an inner executor.
If the risk check fails the order is rejected with ExecutionError::OrderRejected
and the violation is recorded to the alert history. Cancel, fill-check, and
close operations are passed through without additional checks.
Implementations§
Source§impl RiskCheckedOrderExecutor
impl RiskCheckedOrderExecutor
Sourcepub fn new(inner: Box<dyn OrderExecutor>) -> Self
pub fn new(inner: Box<dyn OrderExecutor>) -> Self
Wrap an existing executor with risk enforcement using the on-disk config.
Sourcepub fn with_config(inner: Box<dyn OrderExecutor>, config: RiskConfig) -> Self
pub fn with_config(inner: Box<dyn OrderExecutor>, config: RiskConfig) -> Self
Wrap an existing executor with a specific risk config.
Sourcepub fn update_account_state(&self, state: AccountState)
pub fn update_account_state(&self, state: AccountState)
Update the account state snapshot used for risk evaluation.
Trait Implementations§
Source§impl OrderExecutor for RiskCheckedOrderExecutor
impl OrderExecutor for RiskCheckedOrderExecutor
fn place_order<'life0, 'life1, 'async_trait>(
&'life0 self,
params: &'life1 PlaybookOrderParams,
) -> Pin<Box<dyn Future<Output = Result<String, ExecutionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn cancel_order<'life0, 'life1, 'async_trait>(
&'life0 self,
order_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), ExecutionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn is_filled<'life0, 'life1, 'async_trait>(
&'life0 self,
order_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, ExecutionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn close_position<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
position_id: &'life1 str,
reason: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<String, ExecutionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Auto Trait Implementations§
impl !Freeze for RiskCheckedOrderExecutor
impl !RefUnwindSafe for RiskCheckedOrderExecutor
impl Send for RiskCheckedOrderExecutor
impl Sync for RiskCheckedOrderExecutor
impl Unpin for RiskCheckedOrderExecutor
impl UnsafeUnpin for RiskCheckedOrderExecutor
impl !UnwindSafe for RiskCheckedOrderExecutor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more