pub struct RiskEngine { /* private fields */ }Expand description
Pre-trade risk engine.
Implementations§
Source§impl RiskEngine
impl RiskEngine
Sourcepub fn new(config: RiskConfig) -> Self
pub fn new(config: RiskConfig) -> Self
Create a new risk engine with the given config.
§Panics
Panics if config fails validation (e.g., NaN fields, out-of-range values).
This is intentional — fail-fast at construction, not at check time.
Sourcepub fn config(&self) -> &RiskConfig
pub fn config(&self) -> &RiskConfig
Access the current config.
Sourcepub fn check_order(
&self,
symbol: &Symbol,
side: BrokerSide,
quantity: u64,
price_cents: i64,
account: &Account,
current_positions: &[(Symbol, i64)],
) -> RiskReport
pub fn check_order( &self, symbol: &Symbol, side: BrokerSide, quantity: u64, price_cents: i64, account: &Account, current_positions: &[(Symbol, i64)], ) -> RiskReport
Check a single order against risk limits.
A lightweight check for one order — validates position concentration and order size.
Sourcepub fn check_batch(
&self,
orders: &[(Symbol, BrokerSide, u64, i64)],
account: &Account,
current_positions: &[(Symbol, i64)],
target_weights: &[(Symbol, f64)],
) -> RiskReport
pub fn check_batch( &self, orders: &[(Symbol, BrokerSide, u64, i64)], account: &Account, current_positions: &[(Symbol, i64)], target_weights: &[(Symbol, f64)], ) -> RiskReport
Check a batch of orders (e.g., a full rebalance).
Validates all risk limits including leverage, short exposure, and aggregate position limits.
Trait Implementations§
Source§impl Clone for RiskEngine
impl Clone for RiskEngine
Source§fn clone(&self) -> RiskEngine
fn clone(&self) -> RiskEngine
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto 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