pub trait RiskManager: Send + Sync {
// Required methods
fn validate_signal<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
signal: &'life1 Signal,
portfolio_value: Decimal,
positions: &'life2 [Position],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn calculate_position_size<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
signal: &'life1 Signal,
portfolio_value: Decimal,
risk_params: &'life2 StrategyRiskParameters,
) -> Pin<Box<dyn Future<Output = Result<Decimal>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn check_daily_loss_limit<'life0, 'async_trait>(
&'life0 self,
current_pnl: Decimal,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn check_max_drawdown<'life0, 'async_trait>(
&'life0 self,
peak_equity: Decimal,
current_equity: Decimal,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn calculate_risk_metrics<'life0, 'life1, 'async_trait>(
&'life0 self,
positions: &'life1 [Position],
) -> Pin<Box<dyn Future<Output = Result<RiskMetrics>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Trait for risk management systems
Validates signals and orders before execution to ensure risk limits are met.
Required Methods§
Sourcefn validate_signal<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
signal: &'life1 Signal,
portfolio_value: Decimal,
positions: &'life2 [Position],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn validate_signal<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
signal: &'life1 Signal,
portfolio_value: Decimal,
positions: &'life2 [Position],
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Sourcefn calculate_position_size<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
signal: &'life1 Signal,
portfolio_value: Decimal,
risk_params: &'life2 StrategyRiskParameters,
) -> Pin<Box<dyn Future<Output = Result<Decimal>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn calculate_position_size<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
signal: &'life1 Signal,
portfolio_value: Decimal,
risk_params: &'life2 StrategyRiskParameters,
) -> Pin<Box<dyn Future<Output = Result<Decimal>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Sourcefn check_daily_loss_limit<'life0, 'async_trait>(
&'life0 self,
current_pnl: Decimal,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn check_daily_loss_limit<'life0, 'async_trait>(
&'life0 self,
current_pnl: Decimal,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Check if daily loss limit has been exceeded
Sourcefn check_max_drawdown<'life0, 'async_trait>(
&'life0 self,
peak_equity: Decimal,
current_equity: Decimal,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn check_max_drawdown<'life0, 'async_trait>(
&'life0 self,
peak_equity: Decimal,
current_equity: Decimal,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Check if maximum drawdown has been exceeded
Sourcefn calculate_risk_metrics<'life0, 'life1, 'async_trait>(
&'life0 self,
positions: &'life1 [Position],
) -> Pin<Box<dyn Future<Output = Result<RiskMetrics>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn calculate_risk_metrics<'life0, 'life1, 'async_trait>(
&'life0 self,
positions: &'life1 [Position],
) -> Pin<Box<dyn Future<Output = Result<RiskMetrics>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Calculate portfolio risk metrics