pub struct RiskEngine {
pub throttled_submit_order: Throttler<SubmitOrder, Box<dyn Fn(SubmitOrder)>>,
pub throttled_modify_order: Throttler<ModifyOrder, Box<dyn Fn(ModifyOrder)>>,
/* private fields */
}
Expand description
Central risk management engine that validates and controls trading operations.
The RiskEngine
provides comprehensive pre-trade risk checks including order validation,
balance verification, position sizing limits, and trading state management. It acts as
a gateway between strategy orders and execution, ensuring all trades comply with
defined risk parameters and regulatory constraints.
Fields§
§throttled_submit_order: Throttler<SubmitOrder, Box<dyn Fn(SubmitOrder)>>
§throttled_modify_order: Throttler<ModifyOrder, Box<dyn Fn(ModifyOrder)>>
Implementations§
Source§impl RiskEngine
impl RiskEngine
Sourcepub fn new(
config: RiskEngineConfig,
portfolio: Portfolio,
clock: Rc<RefCell<dyn Clock>>,
cache: Rc<RefCell<Cache>>,
) -> Self
pub fn new( config: RiskEngineConfig, portfolio: Portfolio, clock: Rc<RefCell<dyn Clock>>, cache: Rc<RefCell<Cache>>, ) -> Self
Creates a new RiskEngine
instance.
Sourcepub fn execute(&mut self, command: TradingCommand)
pub fn execute(&mut self, command: TradingCommand)
Executes a trading command through the risk management pipeline.
Sourcepub fn process(&mut self, event: OrderEventAny)
pub fn process(&mut self, event: OrderEventAny)
Processes an order event for risk monitoring and state updates.
Sourcepub fn set_trading_state(&mut self, state: TradingState)
pub fn set_trading_state(&mut self, state: TradingState)
Sets the trading state for risk control enforcement.
Sourcepub fn set_max_notional_per_order(
&mut self,
instrument_id: InstrumentId,
new_value: Decimal,
)
pub fn set_max_notional_per_order( &mut self, instrument_id: InstrumentId, new_value: Decimal, )
Sets the maximum notional value per order for the specified instrument.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RiskEngine
impl !RefUnwindSafe for RiskEngine
impl !Send for RiskEngine
impl !Sync for RiskEngine
impl Unpin for RiskEngine
impl !UnwindSafe for RiskEngine
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