70 lines
2.7 KiB
Markdown
70 lines
2.7 KiB
Markdown
# 2026-08-23 — event-study engine and backtest readiness gate
|
|
|
|
## Plan status
|
|
|
|
- Deterministic event-study engine: complete.
|
|
- Verified code commit: `0b47a06` — `[verified] add event-study readiness gate`.
|
|
- Cost-aware window calculations: complete.
|
|
- Point-in-time vintage sufficiency gate: complete.
|
|
- Market-price provider and real backtest: blocked by design until independent releases and a point-in-time daily price series exist.
|
|
|
|
## Changed files
|
|
|
|
- `backend/app/event_study.py` — readiness gate, event-window returns, weighted portfolio returns, benchmark comparison, turnover cost and hit-rate calculations.
|
|
- `backend/app/__init__.py` — `/api/v1/backtest/tourism` readiness endpoint and API version `0.4.0`.
|
|
- `backend/tests/test_event_study.py` — sufficiency, window/cost and missing-price tests.
|
|
- `backend/tests/test_api.py` — blocked and invalid-query endpoint tests.
|
|
- `frontend/src/App.vue` — Backtest gate KPI that accepts HTTP 409 as a truthful blocked state instead of treating it as a dashboard failure.
|
|
- `README.md` — engine contract and readiness behavior.
|
|
|
|
## Contract
|
|
|
|
The engine accepts point-in-time events, daily symbol prices, an optional benchmark, event windows, and cost assumptions. It does not fetch prices, infer missing closes, or convert current revised historical data into past knowledge.
|
|
|
|
When fewer than the configured minimum events exist, the API returns:
|
|
|
|
```json
|
|
{
|
|
"status": "blocked",
|
|
"reason": "insufficient_vintages",
|
|
"available_events": 1,
|
|
"required_events": 12,
|
|
"price_series_required": true
|
|
}
|
|
```
|
|
|
|
## Live evidence
|
|
|
|
```text
|
|
GET /api/v1/backtest/tourism?min_events=12
|
|
HTTP 409
|
|
status: blocked
|
|
available_events: 1
|
|
required_events: 12
|
|
next_action: collect independent published vintages before running event study
|
|
```
|
|
|
|
The dashboard served source includes `fetchBacktestReadiness`, `Backtest gate`, and the blocked-vintage count. HTTP 409 is handled as an expected research state, not a page error.
|
|
|
|
## Verification
|
|
|
|
- `PYTHONPATH=backend .venv/bin/python -W error -m unittest discover -s backend/tests -v` — **30 tests passed**.
|
|
- `npm run build` — passed.
|
|
- Live API readiness gate — passed with truthful 409 blocked result.
|
|
- Invalid `min_events` — HTTP 400.
|
|
- Pure event-study fixture — window return, benchmark and cost calculation passed.
|
|
|
|
## Independent review
|
|
|
|
```text
|
|
passed: true
|
|
security_concerns: []
|
|
logic_errors: []
|
|
```
|
|
|
|
Non-blocking backlog: add API boundary cases for zero/negative `min_events` and multi-vintage benchmark/window gaps.
|
|
|
|
## Risks and exact next action
|
|
|
|
There is only one independent BOT release. No investment backtest result exists. Continue collecting releases and add a point-in-time daily price adapter before raising the readiness threshold or interpreting event-study output.
|