(&self, f: &mut core::fmt::Formatter<'_>)
| 107 | //! assert!((out.backtest.equity_curve[4] - 1.02 * 0.98 * 1.02).abs() < 1e-12); |
| 108 | //! // One 2% drawdown from the high at bar 2, under water for the last two days. |
| 109 | //! assert!((out.backtest.drawdowns[0] - 0.02).abs() < 1e-12); |
| 110 | //! assert!((out.backtest.time_under_water_years[0] - 2.0 / 365.25).abs() < 1e-12); |
| 111 | //! // The 5% "higher" quantile of [-0.02, 0, 0.02, 0.02] is 0; the returns below it average -0.02. |
| 112 | //! assert!(out.risk.value_at_risk.abs() < 1e-12); |
| 113 | //! assert!((out.risk.expected_shortfall + 0.02).abs() < 1e-12); |
| 114 | //! // Mean 0.005, sample std 0.01915: 0.2611 per bar, 4.145 annualised with the default 252. |
| 115 | //! assert!((out.risk.realized_sharpe - 4.1451).abs() < 1e-4); |
| 116 | //! // A single asset takes the whole portfolio. |
| 117 | //! assert!((out.portfolio.weights[0] - 1.0).abs() < 1e-9); |
| 118 | //! assert!(out.leakage_checks.timestamps_increasing); |
| 119 | //! # Ok::<(), openquant::pipeline::PipelineError>(()) |
| 120 | //! ``` |
| 121 | |
| 122 | use chrono::NaiveDateTime; |
| 123 | use nalgebra::DMatrix; |
nothing calls this directly
no outgoing calls
no test coverage detected