Skip to main content

run_mid_frequency_pipeline

Function run_mid_frequency_pipeline 

Source
pub fn run_mid_frequency_pipeline(
    input: ResearchPipelineInput<'_>,
    config: &ResearchPipelineConfig,
) -> Result<ResearchPipelineOutput, PipelineError>
Expand description

Runs the events → signals → portfolio → risk → backtest pipeline on one instrument (see the module documentation for the stages and conventions, and for a worked example).

§Errors

  • PipelineError::EmptyInput if timestamps, close or model_probabilities is empty.
  • PipelineError::LengthMismatch if close and timestamps, model_probabilities and close, model_sides and close, the rows of asset_prices and timestamps, or asset_names and the columns of asset_prices differ in length.
  • PipelineError::InvalidParameter if asset_prices has fewer than 2 rows or no columns, cusum_threshold <= 0, num_classes < 2, confidence_level is outside [0, 1] (NaN included), or periods_per_year is not finite and > 0.
  • PipelineError::NoEvents if the CUSUM filter selects no bar (including when close has a single bar).
  • PipelineError::InvalidParameter also if a model_probabilities entry is outside [0, 1], or cusum_threshold or step_size is NaN, infinite or <= 0.
  • PipelineError::PortfolioAllocation if the max-Sharpe optimisation on asset_prices fails.
  • PipelineError::Risk is part of the signature but not reachable after validation. It is kept so that a risk-metric failure would surface as a typed error, not a panic, should the validation above and the risk metrics’ own checks ever drift apart.