|
| 1 | +# AGENTS.md |
| 2 | + |
| 3 | +## Cursor Cloud specific instructions |
| 4 | + |
| 5 | +### Product |
| 6 | + |
| 7 | +**fibengine** is a Python research engine for human-like Fibonacci swing selection (Layer A). There is no web server or database—workflows are CLI modules (`experiment`, `backtest`, `labeling`) plus an optional Matplotlib labeling GUI. |
| 8 | + |
| 9 | +### Dependencies (automatic on VM startup) |
| 10 | + |
| 11 | +The update script runs `uv sync --extra dev`, which creates/updates `.venv` from `pyproject.toml` / `uv.lock`. Python **3.11+** is required (CI and local use 3.12). |
| 12 | + |
| 13 | +### Lint / test / build (match CI) |
| 14 | + |
| 15 | +From repo root: |
| 16 | + |
| 17 | +```bash |
| 18 | +uv run ruff check src tests |
| 19 | +uv run ruff format --check src tests |
| 20 | +uv run pytest -q |
| 21 | +uv build |
| 22 | +``` |
| 23 | + |
| 24 | +Optional local gate (same hooks as documented in README): `uv run pre-commit run --all-files`. |
| 25 | + |
| 26 | +### Running the main pipeline (hello-world) |
| 27 | + |
| 28 | +1. **Candles** — `uv run python -m fibengine.data.fetch` caches OHLCV under `data/raw/` (gitignored). This needs outbound HTTPS to Binance via CCXT. If the API is blocked in the VM, either request egress for `api.binance.com` or populate `data/raw/` manually before running pipelines that call `load_candles()`. |
| 29 | +2. **Experiment** — `uv run python -m fibengine.experiment` runs swing selection for all human labels in `data/labels/`, writes plots and `metrics.json` under `experiments/runs/experiment/<date>/<run_id>/`, and appends to `experiments/results/leaderboard.jsonl`. |
| 30 | +3. **Labeling worklist** — `uv run python -m fibengine.labeling.worklist` (no network). |
| 31 | +4. **Interactive labeler** — `uv run python -m fibengine.labeling.tool` needs a display/GUI backend (not typical in headless cloud VMs). |
| 32 | + |
| 33 | +### Services |
| 34 | + |
| 35 | +| Component | Required for | Notes | |
| 36 | +|-----------|----------------|-------| |
| 37 | +| `.venv` via `uv sync` | Everything | No Docker Compose in repo | |
| 38 | +| `pytest` | CI / dev | Uses synthetic fixtures; no network | |
| 39 | +| Binance (CCXT) | Live fetch / fresh caches | Optional if `data/raw/` already populated | |
| 40 | +| Matplotlib GUI | `labeling.tool` | Optional | |
| 41 | + |
| 42 | +### Gotchas |
| 43 | + |
| 44 | +- `load_candles(..., fetch_if_missing=True)` will call the exchange when cache is missing—failures look like CCXT `NetworkError` / SSL errors if egress is blocked. |
| 45 | +- Long timeframes use higher `timeframe_limits` in `config/settings.yaml`; labels can be `out_of_window` if history is too short (see experiment logs). |
| 46 | +- Coverage gate is **60%** via pytest `addopts` in `pyproject.toml`; `labeling/tool.py` is omitted from coverage. |
0 commit comments