feat: add alphaview tool to show alpha weights alongside bar data
Joins the bar dataset with one or more alpha parquet files on (symbol, date) for a given symbol and date range. Standalone tools/alphaview.py wired as `cli.py alphaview`, plus README docs. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -179,6 +179,31 @@ ln -sf "$(pwd)/tools/pqcat.py" ~/.local/bin/pqcat # ~/.local/bin must be on PA
|
||||
pqcat alphas/reversal_5d.pq --info
|
||||
```
|
||||
|
||||
### `alphaview` — alpha weight(s) alongside bar data for one symbol
|
||||
|
||||
Join the bar dataset and one or more alpha parquet files on `(symbol, date)` and
|
||||
print them side by side, so you can eyeball how a weight moves against price /
|
||||
volume over a time range.
|
||||
|
||||
| Option | Default | Description |
|
||||
| --- | --- | --- |
|
||||
| `--data-path` | (required) | Bar dataset dir or parquet file |
|
||||
| `--alpha-path` | (required) | Comma-separated alpha parquet path(s) — each `alpha_name` becomes a column |
|
||||
| `--symbol` | (required) | Symbol id, e.g. `sh600000` |
|
||||
| `--start-date` | — | `YYYY-MM-DD` (inclusive) |
|
||||
| `--end-date` | — | `YYYY-MM-DD` (inclusive) |
|
||||
| `-c, --columns` | `close,volume` | Comma-separated bar columns to show |
|
||||
|
||||
```bash
|
||||
python3 cli.py alphaview \
|
||||
--data-path data/daily_bars/csi500 \
|
||||
--alpha-path alphas/reversal_5d.pq,alphas/momentum_5d.pq \
|
||||
--symbol sh600000 --start-date 2024-01-01 --end-date 2024-03-31 \
|
||||
-c close,volume,vwap
|
||||
```
|
||||
|
||||
Also standalone like `pqcat` — `ln -sf "$(pwd)/tools/alphaview.py" ~/.local/bin/alphaview`.
|
||||
|
||||
## Alphas: the factory / plugin interface
|
||||
|
||||
An **alpha** is a class that maps a wide close matrix (date index × `symbol_id`
|
||||
@@ -272,6 +297,7 @@ directory yields an extra `month` (`YYYY-MM`) partition column on top of
|
||||
- `pipeline/common/schema.py` — parquet column contracts
|
||||
- `data/downloader.py`, `data/universe.py` — baostock/akshare download + constituents
|
||||
- `tools/pqcat.py` — standalone parquet inspector (`pqcat`), also wired as `cli.py pqcat`
|
||||
- `tools/alphaview.py` — standalone alpha-vs-bar viewer (`alphaview`), also wired as `cli.py alphaview`
|
||||
- `examples/alphas/` — example external alpha(s)
|
||||
|
||||
## Roadmap (not yet implemented)
|
||||
|
||||
Reference in New Issue
Block a user