Santh
Santh
## Summary - `calc_metrics` raised `TypeError: ... not 'complex'` and crashed whenever a backtest ended with negative equity. - The annualised-return step raised a non-positive base to a fractional power,...
### Describe the bug `backtest/metrics.py::calc_metrics` computes the annualised return as: ```python ann_ret = float((1 + total_ret) ** (bpy / max(n, 1)) - 1) ``` A leveraged or short book can...
Two related robustness gaps that let non-finite values into backtest outputs. ## 1. `initial_cash` is not validated → `inf` metrics `BacktestConfigSchema` uses `extra="allow"` and never declares `initial_cash`, so a config...
## Problem The three validation tools in `agent/backtest/validation.py` read their count/seed knobs directly from user `config["validation"]` (via `run_validation` → the engine), but none of them validate the values. A single...
### Problem `calc_metrics` (`agent/backtest/metrics.py`) computes the Sortino denominator with a small-sample guard: ```python downside_std = float(downside.std()) if len(downside) > 1 else 1e-10 ``` but the **Sharpe** and **information-ratio** denominators use...
A backtest that ends with negative equity crashes instead of reporting metrics: ``` TypeError: type complex doesn't define __round__ method ``` ## Cause A short's loss is unbounded (`return_pct =...
Adds the Momentum analyst from the roadmap (Analysts > Quantitative models). ## What A pure-math `QuantModel` (same interface as PEAD) that measures trailing price return over the past ~12 months...
Trade journal `filter_expr` values like `2026-03 to 2026-01` parsed cleanly but selected zero rows, so analysis ran on an empty frame with no error. Ascending ranges are the documented examples,...
`doc_reader` page specs like `10-5` produced an empty index list, so the PDF path returned success with no text. Ascending ranges are the documented grammar, and `alpha_bench` already rejects inverted...
When max_len is 0 or negative, the cut pointer never advances and split_message loops forever. Return the content unsplit so outbound IM adapters cannot wedge. Repro: split_message("hello world", max_len=0).