Skip to content

Commit ac7bb90

Browse files
committed
feat: expand performance report diagnostics
1 parent 9b050f6 commit ac7bb90

6 files changed

Lines changed: 721 additions & 50 deletions

File tree

PERFORMANCE.md

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ Use a licensed or otherwise permitted wide adjusted-close CSV:
1212
```bash
1313
PYTHONPATH=. python scripts/generate_report.py \
1414
--prices-csv local_data/rotation_prices.csv \
15-
--start 2018 --end 2025 --n-trials 10
15+
--start 2018 --end 2025 --n-trials 10 \
16+
--data-provider "$DATA_PROVIDER" \
17+
--permission-basis "$DATA_PERMISSION_BASIS" \
18+
--retrieved-at "$DATA_RETRIEVED_AT" \
19+
--adjustment-method "$DATA_ADJUSTMENT_METHOD"
1620
```
1721

1822
The required columns are documented in `local_data/README.md`. The command
@@ -23,6 +27,9 @@ state into the requested evaluation window, and excludes the pre-roll returns
2327
from reported metrics. The source must contain at least 274 pre-evaluation
2428
sessions. Use `--warmup-years 0` only when a deliberately cold-started report
2529
is appropriate; that override is disclosed in the generated settings.
30+
The provenance options record owner-supplied facts and assertions; they do not
31+
constitute independent verification that publication or redistribution is
32+
permitted. Missing fields are labeled incomplete in the report.
2633

2734
For an explicitly requested live download:
2835

@@ -38,21 +45,34 @@ exact reproduction matters.
3845

3946
## Generated Artifacts
4047

41-
The reference report currently produces three plots:
48+
The command writes `reports/report.md` plus these plots under `reports/img/`:
4249

50+
- `report_overview.png`: equity, drawdown, allocation, turnover, and costs in a
51+
compact review image.
4352
- `equity_vs_benchmarks.png`: strategy net of modeled costs versus gross SPY
4453
and equal-weight buy-and-hold benchmarks.
4554
- `drawdown.png`: the strategy underwater curve.
4655
- `rolling_sharpe.png`: trailing 126-session Sharpe.
47-
48-
It also prints performance metrics, evaluation settings, data provenance, and a
49-
monthly-return table. Outputs remain ignored under `reports/`; do not copy them
50-
into the README without a redistributable input dataset and complete provenance.
51-
52-
For an external investment review, also generate exposure/cash, turnover and
53-
cumulative cost, rolling volatility and beta, walk-forward boundary, and
54-
liquidity/capacity sensitivity diagnostics. Those plots require additional
55-
inputs or engine semantics and are not implied by the current report command.
56+
- `rolling_risk.png`: trailing 126-session annualized volatility and beta to
57+
SPY.
58+
- `allocation_and_exposure.png`: post-trade asset weights, invested gross
59+
exposure, and cash.
60+
- `turnover_and_costs.png`: executed one-way turnover and the cumulative sum of
61+
modeled per-period cost fractions.
62+
- `monthly_returns.png`: monthly net-return heatmap.
63+
- `return_distribution.png`: daily net-return histogram, historical tail
64+
markers, and a normal Q-Q diagnostic.
65+
66+
The Markdown report links every plot and includes performance metrics,
67+
evaluation settings, data provenance, and the monthly-return table. Outputs
68+
remain ignored; do not copy them into the README without a redistributable input
69+
dataset and complete provenance.
70+
71+
The current command must not fabricate diagnostics it cannot support. Add
72+
walk-forward or live-start boundaries only when the run records those regimes;
73+
capacity and slippage curves only with spread, volume, and order-size inputs;
74+
factor attribution only with validated factor returns/exposures; and fill
75+
quality only from authenticated order and execution records.
5676

5777
## Reporting Requirements
5878

README.md

Lines changed: 45 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,37 @@ against appropriate benchmarks. See [PERFORMANCE.md](PERFORMANCE.md).
3333

3434
---
3535

36+
## Project Demo
37+
38+
The best demonstration is a locally generated, provenance-bearing report rather
39+
than a permanent equity curve detached from its input data. With an authorized
40+
price file, run:
41+
42+
```bash
43+
PYTHONPATH=. python scripts/generate_report.py \
44+
--prices-csv local_data/rotation_prices.csv \
45+
--start 2018 --end 2025 --n-trials 10 \
46+
--data-provider "$DATA_PROVIDER" \
47+
--permission-basis "$DATA_PERMISSION_BASIS" \
48+
--retrieved-at "$DATA_RETRIEVED_AT" \
49+
--adjustment-method "$DATA_ADJUSTMENT_METHOD"
50+
```
51+
52+
Open `reports/report.md`. It links a compact diagnostic overview and detailed
53+
performance, drawdown, rolling-risk, allocation, exposure, turnover, cost,
54+
monthly-return, and tail-distribution plots. The report also records the input
55+
digest, evaluation window, warm-up, cost assumptions, DSR settings, and whether
56+
all publication metadata was supplied. Metadata records the owner's assertions;
57+
the tool does not determine whether a license permits redistribution.
58+
59+
The architecture diagram below is safe to publish because it is independent of
60+
market data. A generated `report_overview.png` should be added to this README
61+
only when the input license permits publication of derived images and the
62+
adjacent text identifies the source, date window, file digest, costs, benchmark
63+
treatment, and true research trial count. Never publish an equity curve alone.
64+
65+
---
66+
3667
## Getting Started
3768

3869
The scientific core, test suite, broker mocks, and labeled paper-trading dry run
@@ -110,14 +141,15 @@ python scripts/paper_trade_cycle.py --offline # labeled synthetic dry-run; no br
110141

111142
`validate_performance.py` explicitly fetches live yfinance data; `--pit` uses a
112143
fixed start-date cohort from historical index membership. `generate_report.py`
113-
accepts either an owner-supplied wide CSV or explicit live yfinance, writes three
114-
charts under ignored `reports/img/`, and prints source metadata plus markdown
115-
tables. Its default report requires at least 274 pre-evaluation sessions for
116-
full signal initialization; `--warmup-years 0` explicitly permits and labels a
117-
cold start. `survivorship_demo.py` requires the same explicit live-data opt-in and
118-
shows the current pricing gap for past index members. `verify_brokers.py` checks
119-
Alpaca/IB/CCXT request construction and response parsing against SDK-shaped
120-
mocks; it does not verify a live SDK or authenticated connection.
144+
accepts either an owner-supplied wide CSV or explicit live yfinance, writes a
145+
Markdown report plus nine plots under ignored `reports/`, and prints source
146+
metadata plus markdown tables. Its default report requires at least 274
147+
pre-evaluation sessions for full signal initialization; `--warmup-years 0`
148+
explicitly permits and labels a cold start. `survivorship_demo.py` requires the
149+
same explicit live-data opt-in and shows the current pricing gap for past index
150+
members. `verify_brokers.py` checks Alpaca/IB/CCXT request construction and
151+
response parsing against SDK-shaped mocks; it does not verify a live SDK or
152+
authenticated connection.
121153
`paper_trade_cycle.py` runs the full execution path (use
122154
`--live-yfinance --submit` with `ALPACA_*` set to place paper orders). It
123155
refuses unresolved open orders, records deterministic client order IDs before
@@ -162,11 +194,11 @@ PYTHONPATH=. python scripts/generate_report.py \
162194
The report records the file path, SHA-256 digest, observed date window, cost
163195
assumptions, signal warm-up, DSR trial count/variance assumption, and whether
164196
liquidity constraints are active.
165-
Each run writes `equity_vs_benchmarks.png`, `drawdown.png`, and
166-
`rolling_sharpe.png` under ignored `reports/img/`, and prints performance and
167-
monthly-return tables. These are local research evidence, not repository
168-
fixtures. The README intentionally contains no fixed performance plot because
169-
the repository does not ship a redistributable input dataset. See
197+
Each run writes `reports/report.md`, a compact `report_overview.png`, and eight
198+
detailed diagnostics under ignored `reports/img/`. These are local research
199+
evidence, not repository fixtures. The README intentionally contains no fixed
200+
performance plot because the repository does not ship a redistributable input
201+
dataset. See
170202
[PERFORMANCE.md](PERFORMANCE.md) for interpretation requirements and known
171203
limitations.
172204

local_data/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ For a performance report, include at least the requested pre-evaluation warm-up
2929
history (two calendar years by default); the loader cannot reconstruct signal
3030
history that is absent from the file.
3131

32+
For a report intended for external review, also pass `--data-provider`,
33+
`--permission-basis`, `--retrieved-at`, and `--adjustment-method`. These fields
34+
record the owner's provenance assertions but do not independently establish
35+
that redistribution is permitted.
36+
3237
## Single-Symbol OHLCV CSV
3338

3439
Notebook 02 also requires actual OHLCV data when using local files:

0 commit comments

Comments
 (0)