Skip to content

Commit 9b050f6

Browse files
committed
docs: clarify reports and production readiness
1 parent 54c0499 commit 9b050f6

3 files changed

Lines changed: 115 additions & 21 deletions

File tree

PERFORMANCE.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,24 @@ Review Yahoo's terms and the
3636
Live historical data may be revised, so preserve your own permitted input if
3737
exact reproduction matters.
3838

39+
## Generated Artifacts
40+
41+
The reference report currently produces three plots:
42+
43+
- `equity_vs_benchmarks.png`: strategy net of modeled costs versus gross SPY
44+
and equal-weight buy-and-hold benchmarks.
45+
- `drawdown.png`: the strategy underwater curve.
46+
- `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+
3957
## Reporting Requirements
4058

4159
- Report the data provider, license or permission basis, retrieval date, date

README.md

Lines changed: 49 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
66
[![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/)
77
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
8+
[![CI](https://github.com/magnaquant/quantcortex/actions/workflows/ci.yml/badge.svg)](https://github.com/magnaquant/quantcortex/actions/workflows/ci.yml)
89

910
---
1011

@@ -46,13 +47,16 @@ broker SDKs, and storage clients remain lazy imports.
4647
git clone https://github.com/magnaquant/quantcortex.git
4748
cd quantcortex
4849
python3.11 -m venv .venv && source .venv/bin/activate
50+
python -m pip install --upgrade pip
4951

50-
# Core (required) - enough to run the full test suite
51-
pip install numpy pandas scipy scikit-learn matplotlib pyarrow pytest
52-
pip install -e . --no-deps # make quantcortex importable from scripts
52+
# Install the package and its scientific core.
53+
python -m pip install -e .
54+
55+
# Development, CI, and notebook tools.
56+
python -m pip install pytest pytest-cov ruff jupyter nbconvert ipykernel
5357

5458
# Optional accelerators / integrations (Poetry extras):
55-
poetry install -E all # or, with pip: pip install '.[all]'
59+
python -m pip install -e '.[all]' # or: poetry install -E all
5660
# ml -> xgboost, lightgbm, catboost (GBDT cross-sectional alpha)
5761
# nlp -> transformers, torch (FinBERT sentiment)
5862
# rl -> stable-baselines3, gymnasium (PPO DRL allocator)
@@ -70,7 +74,8 @@ poetry install -E all # or, with pip: pip install '.[all]'
7074
### Run the tests
7175

7276
```bash
73-
pytest tests/ -v # weight contract, transaction costs, look-ahead, risk overlay, order state machine
77+
python -m pytest tests/ -q --cov=quantcortex --cov-fail-under=60
78+
ruff check .
7479
```
7580

7681
### Run the research notebooks
@@ -157,7 +162,11 @@ PYTHONPATH=. python scripts/generate_report.py \
157162
The report records the file path, SHA-256 digest, observed date window, cost
158163
assumptions, signal warm-up, DSR trial count/variance assumption, and whether
159164
liquidity constraints are active.
160-
Generated charts remain under ignored `reports/`. See
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
161170
[PERFORMANCE.md](PERFORMANCE.md) for interpretation requirements and known
162171
limitations.
163172

@@ -169,6 +178,19 @@ The platform is organized as eight layers joined by explicit data and weight
169178
contracts. Components are replaceable when they preserve those contracts and
170179
the surrounding data assumptions.
171180

181+
```mermaid
182+
flowchart LR
183+
D[Data and PIT controls] --> F[Features and alpha]
184+
F --> S[Selection]
185+
S --> A[Allocation]
186+
A --> T[Timing overlays]
187+
T --> R[Risk overlays]
188+
R --> W[Target weights]
189+
W --> B[Backtest and validation]
190+
W --> P[Pre-trade risk]
191+
P --> E[Broker execution]
192+
```
193+
172194
| Layer | Role | Key modules |
173195
|-------|------|-------------|
174196
| **Data** | Market, fundamental, and alternative-data adapters with PIT validation utilities | `providers/`, `pit_enforcer.py`, `lookahead_detector.py` |
@@ -303,17 +325,20 @@ quantcortex/ # repo root
303325
│ └── verify_brokers.py # broker adapters vs faithful SDK mocks
304326
305327
├── tests/
306-
│ ├── conftest.py # shared synthetic-data fixtures
307-
│ ├── test_lookahead_detector.py
308-
│ ├── test_transaction_costs.py
309-
│ ├── test_weight_interface.py
310-
│ ├── test_risk_overlay.py
311-
│ ├── test_order_manager.py
312-
│ └── test_regression_guards.py # core-dep regression guards (audit fixes)
328+
│ ├── build_notebook_fixtures.py # deterministic test-only notebook inputs
329+
│ ├── test_data_integrity.py
330+
│ ├── test_factor_integrity.py
331+
│ ├── test_execution_safety.py
332+
│ ├── test_fail_closed_invariants.py
333+
│ ├── test_research_validation.py
334+
│ ├── test_repository_data_policy.py
335+
│ └── test_regression_guards.py # focused guards for audited defects
313336
314337
├── local_data/README.md # ignored local-data schemas and provenance rules
315338
├── reports/ # ignored generated charts and report output
316-
├── docs/history-rewrite-plan.md # optional purge procedure; not executed
339+
├── docs/
340+
│ ├── production-readiness.md # blockers before production capital
341+
│ └── history-rewrite-plan.md # optional purge procedure; not executed
317342
├── docker-compose.yml
318343
├── Dockerfile
319344
├── pyproject.toml
@@ -408,6 +433,10 @@ volume_cap = 0.10 # max 10% of ADV when an ADV series is supplied
408433

409434
## Development Roadmap
410435

436+
Implemented research components are not equivalent to production readiness.
437+
See [docs/production-readiness.md](docs/production-readiness.md) for the
438+
remaining broker, state, data, deployment, and operational controls.
439+
411440
| Phase | Scope | Status |
412441
|-------|-------|--------|
413442
| **Phase 1** | Data layer + PIT enforcement + universe construction | Implemented; licensed data is still required for production research |
@@ -418,14 +447,13 @@ volume_cap = 0.10 # max 10% of ADV when an ADV series is supplied
418447

419448
---
420449

421-
## Framework Rationale
450+
## External References
422451

423-
| Framework | Role in quantcortex | Not used for |
424-
|-----------|---------------------|--------------|
425-
| **vectorbt** | Fast parameter sweeps in research notebooks | Live trading |
426-
| **qlib** | ML alpha factor benchmarks | Broker connectivity |
427-
| **Lean/QuantConnect** | Reference event-driven engine comparison | Primary architecture |
428-
| **FinRL-X** | Weight-contract interface pattern | Direct dependency |
452+
| Project | Relationship to quantcortex | Runtime dependency |
453+
|---------|------------------------------|--------------------|
454+
| [Qlib](https://github.com/microsoft/qlib) | Alpha158 feature names and operator conventions are reimplemented locally with documented deviations | No |
455+
| [FinRL-X](https://github.com/AI4Finance-Foundation/FinRL-Trading) | Inspiration for the deployment-consistent, weight-centric pipeline | No |
456+
| [Lean/QuantConnect](https://github.com/QuantConnect/Lean) | Comparative reference for event-driven architecture and broker-integrated systems | No integration |
429457

430458
---
431459

docs/production-readiness.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Production Readiness
2+
3+
The repository is a research and guarded paper-execution platform. Passing CI
4+
does not certify it for production capital. Complete and independently review
5+
the controls below before any real-money deployment.
6+
7+
## Broker Certification
8+
9+
- Migrate Alpaca from `alpaca-trade-api` to `alpaca-py`.
10+
- Migrate Interactive Brokers from archived `ib_insync` to a maintained client.
11+
- Run authenticated paper tests for permissions, reconnects, rejects, partial
12+
fills, cancellations, duplicate submissions, and venue-side idempotency.
13+
- Reconcile broker positions, cash, orders, and fills before every trading cycle.
14+
15+
## State and Recovery
16+
17+
- Persist positions, orders, submission intents, and reconciliation metadata as
18+
one recoverable transaction or event stream.
19+
- Define restart behavior for crashes between order submission and persistence.
20+
- Add backup restoration, corruption, concurrent-writer, and disaster-recovery
21+
tests for every configured storage backend.
22+
23+
## Research and Data
24+
25+
- Use data with an explicit license or permission basis and retained provenance.
26+
- Obtain exact filing timestamps, point-in-time membership, and delisted-security
27+
prices for production single-name research.
28+
- Validate corporate actions, calendars, stale-price policy, and symbol mapping
29+
against the intended venues.
30+
- Replace flat slippage with calibrated spread, volatility, size, and capacity
31+
models when expected order size makes market impact material.
32+
33+
## Deployment Controls
34+
35+
- Pin and lock all dependencies and container base images.
36+
- Run container, database, Redis, and broker integration tests in a staging
37+
environment matching production.
38+
- Run services as a non-root user with secret management, least privilege,
39+
structured logs, metrics, alerting, and immutable audit records.
40+
- Define kill switches, exposure limits, incident ownership, rollback steps,
41+
and independent release approval.
42+
43+
## Release Evidence
44+
45+
Archive the exact code revision, environment, data digest, configuration,
46+
research trial count, validation report, paper-certification evidence, and
47+
sign-off for each release. Treat unresolved checklist items as release blockers,
48+
not documentation caveats.

0 commit comments

Comments
 (0)