[verified] add SET price snapshot adapter

This commit is contained in:
Kunthawat Greethong
2026-08-23 12:38:17 +07:00
parent 9301c02306
commit 7f7a6145cd
12 changed files with 705 additions and 9 deletions

View File

@@ -62,6 +62,7 @@ GET /api/v1/data-health
GET /api/v1/vintages?as_of=<ISO-8601 timestamp>
GET /api/v1/replay/tourism?vintage_id=<vintage_id>
GET /api/v1/backtest/tourism?min_events=12
GET /api/v1/prices/health
```
Source: `https://app.bot.or.th/BTWS_STAT/statistics/ReportPage.aspx?reportID=875&language=eng`
@@ -92,6 +93,7 @@ cd frontend && npm run build
- Raw response hash and normalized snapshot persistence
- Immutable vintage manifest with first-seen/revision metadata
- Read-only data-health, vintage timeline and vintage replay endpoints
- Yahoo-backed daily price snapshot contract with SET symbol mapping
- Deterministic event-study engine with benchmark and cost inputs
- Backtest readiness gate that blocks without independent vintages and prices
- Deterministic surprise × exposure × confidence score
@@ -100,6 +102,23 @@ cd frontend && npm run build
- No webhook receiver yet
- No MT5 bridge yet
The next implementation step is the event-study/backtest layer using only vintages whose `published_at` is known at each test date.
The next implementation step is replacing or supplementing revised vendor history with a point-in-time daily price source, while continuing to collect independent BOT releases.
The event-study gate is now exposed through `/api/v1/backtest/tourism`. It returns HTTP `409` with `status=blocked` when the independent-vintage minimum is not met, and it explicitly reports that a point-in-time daily price series is still required. The pure engine accepts events, daily prices, benchmark prices, event windows, and cost assumptions; it does not fetch or invent market prices.
## Collect daily price snapshots
The initial research price provider uses Yahoo Finance Chart API with SET ticker mappings. It stores OHLCV plus adjusted close for the eight exposure names and `^SET.BK` as `SET50`. This is **revised vendor history**, not point-in-time market data, so the snapshot is visible for data plumbing but cannot unlock the backtest gate:
```bash
PYTHONPATH=backend .venv/bin/python backend/scripts/collect_prices.py \
--root backend/data/prices \
--start 2024-01-01 \
--end 2026-08-24
```
Inspect the latest price snapshot:
```text
GET /api/v1/prices/health
```