pub struct PortfolioSupervisor { /* private fields */ }Expand description
Portfolio risk supervisor for one account.
Implementations§
Source§impl PortfolioSupervisor
impl PortfolioSupervisor
Sourcepub fn new(
policies: Vec<RiskPolicy>,
groups: Vec<CorrelationGroup>,
) -> Result<Self, RiskConfigError>
pub fn new( policies: Vec<RiskPolicy>, groups: Vec<CorrelationGroup>, ) -> Result<Self, RiskConfigError>
Validate the policies and groups and build a supervisor with no halt in force.
pub fn policies(&self) -> &[RiskPolicy]
Sourcepub fn caps_group_risk(&self) -> bool
pub fn caps_group_risk(&self) -> bool
Whether any policy caps the risk of a group, which requires every counted risk to be measurable.
Sourcepub fn day_start(&self) -> Option<NaiveDateTime>
pub fn day_start(&self) -> Option<NaiveDateTime>
Start of the current daily-loss window, or None when no daily policy is declared or no time has been observed.
Sourcepub fn begin(&mut self, now: NaiveDateTime, balance: f64)
pub fn begin(&mut self, now: NaiveDateTime, balance: f64)
Observe the account before anything happens at now, which rolls the daily window when a reset instant has passed.
Sourcepub fn on_boundary(&mut self, facts: &PortfolioFacts<'_>) -> Vec<HaltCommand>
pub fn on_boundary(&mut self, facts: &PortfolioFacts<'_>) -> Vec<HaltCommand>
Evaluate the halt policies against the facts at a boundary and return the bulk actions a new halt asks for, in execution order.
Sourcepub fn review(
&self,
facts: &PortfolioFacts<'_>,
intent: &ExposureIntent<'_>,
) -> Verdict
pub fn review( &self, facts: &PortfolioFacts<'_>, intent: &ExposureIntent<'_>, ) -> Verdict
Approve or reject one request for new exposure against the facts at the moment of review.
Sourcepub fn finish(self) -> Vec<HaltInterval>
pub fn finish(self) -> Vec<HaltInterval>
Every halt interval in start order; an interval without an end was still in force when the supervisor finished.
Sourcepub fn intervals(&self) -> &[HaltInterval]
pub fn intervals(&self) -> &[HaltInterval]
Halt intervals recorded so far, with those still in force left open.