pub struct RiskConfig {
pub max_portfolio_risk_usd: f64,
pub max_risk_per_trade_usd: f64,
pub max_trades_per_day: u32,
pub allowed_underlyings: Vec<String>,
pub max_open_per_underlying: HashMap<String, u32>,
pub re_entry_after_stop_loss: ReEntryAfterStopLoss,
pub blocked_events: Vec<String>,
pub blocked_dates: Vec<BlockedDate>,
pub correlation_groups: Vec<CorrelationGroupConfig>,
pub max_drawdown_halt_pct: Option<f64>,
pub drawdown_sleeve_usd: Option<f64>,
}Fields§
§max_portfolio_risk_usd: f64§max_risk_per_trade_usd: f64§max_trades_per_day: u32Soft churn cap. Prefer max_open_positions + portfolio/trade risk as hard gates.
0 = unlimited (no daily trade-count pause).
allowed_underlyings: Vec<String>§max_open_per_underlying: HashMap<String, u32>Optional per-symbol open-slot caps (e.g. SPY: 2, IWM: 1). Keys are case-insensitive.
re_entry_after_stop_loss: ReEntryAfterStopLoss§blocked_events: Vec<String>Manual hard pause: any non-empty list blocks all new entries until cleared.
Not a calendar — use blocked_dates for FOMC/CPI/NFP blackouts.
blocked_dates: Vec<BlockedDate>Date-aware entry blackout (macro/Fed calendar). Blocks when
event_date - lead_days <= today <= event_date (inclusive).
correlation_groups: Vec<CorrelationGroupConfig>Correlated underlyings — cap concurrent open positions per group.
max_drawdown_halt_pct: Option<f64>Halt new entries when sleeve drawdown from HWM reaches this % (e.g. 15.0).
null / omit / 0 = disabled. Exits always continue.
drawdown_sleeve_usd: Option<f64>Sleeve equity base for drawdown HWM. Defaults to max_portfolio_risk_usd
(or sim starting budget). Set to the real options cash sleeve (e.g. 4000).
Implementations§
Source§impl RiskConfig
impl RiskConfig
pub fn max_open_for_underlying(&self, underlying: &str) -> Option<u32>
Sourcepub fn active_blocked_date_labels(&self, today: NaiveDate) -> Vec<String>
pub fn active_blocked_date_labels(&self, today: NaiveDate) -> Vec<String>
Labels of blocked_dates entries active on today (inclusive lead window).
Sourcepub fn correlation_group_for(
&self,
underlying: &str,
) -> Option<&CorrelationGroupConfig>
pub fn correlation_group_for( &self, underlying: &str, ) -> Option<&CorrelationGroupConfig>
Group containing underlying, if any.
Trait Implementations§
Source§impl Clone for RiskConfig
impl Clone for RiskConfig
Source§fn clone(&self) -> RiskConfig
fn clone(&self) -> RiskConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RiskConfig
impl Debug for RiskConfig
Source§impl Default for RiskConfig
impl Default for RiskConfig
Source§impl<'de> Deserialize<'de> for RiskConfigwhere
RiskConfig: Default,
impl<'de> Deserialize<'de> for RiskConfigwhere
RiskConfig: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for RiskConfig
impl RefUnwindSafe for RiskConfig
impl Send for RiskConfig
impl Sync for RiskConfig
impl Unpin for RiskConfig
impl UnsafeUnpin for RiskConfig
impl UnwindSafe for RiskConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more