GitHub Actions
Clean project deployment
c6262df
|
Raw History Blame Contribute Delete
5.4 kB
# CRE v1.0 β€” Build Handoff (for the continuing agent)
**Status:** Steps 0–3 complete & verified. Step 4 (dashboard UI) is a skeleton only.
**Read first:** `CRE Agent Build Log.md` (full decision history, Entries 001–011) and
`confluence-reversal-engine-spec.md` is the original blueprint (in the parent `web/` dir;
copy is the source of truth for strategy logic).
---
## What works today (verified)
| Area | File(s) | State |
|------|---------|-------|
| Config + version-controlled thresholds | `config.py` (CONFIG_VERSION=3) | βœ… |
| OKX data client (funding/OI/klines/taker/liq WS) | `exchange/okx.py`, `exchange/base.py` | βœ… live-probed |
| Dynamic universe funnel | `universe.py` | βœ… |
| SQLite store + schema (spec Β§9) + self-baselines | `store/db.py` | βœ… |
| Data workers (universe/liq/poller) | `workers.py` | βœ… |
| Engine: 4 layers, confluence, conviction, levels | `engine/layers.py`, `engine/scoring.py` | βœ… 42 tests pass |
| Lifecycle state machine | `engine/lifecycle.py` | βœ… |
| Risk (cooldown gate, no caps β€” conviction ranks) | `engine/risk.py` | βœ… |
| Signal engine + active monitor | `signals_worker.py` | βœ… synthetic e2e |
| Telegram alerts | `alerts/telegram.py` | βœ… format verified |
| HF bucket persistence (restore/sync) | `sync.py` | βœ… structure (live on HF) |
| App entrypoint + boot wiring | `app.py` | βœ… boots, placeholder UI |
| Per-pair links (TV + symbol helpers) | `links.py` | βœ… |
| Tests | `tests/test_engine.py` | βœ… 42/42 |
Run tests: `cd <dir> && python tests/test_engine.py`
Boot locally: `pip install -r requirements.txt && python app.py` (OKX needs non-US IP).
---
## What REMAINS (priority order)
### 1. Step 4 β€” Dashboard UI ← main remaining work
`ui/dashboard.py` currently is a **skeleton stub** (see file header). Build the real one
to the design brief (Build Log Entry 003 + D10):
- Dark theme, **Nunito** font, SVG logo + uniform SVG animations, `Ver. 1.0` tag, live
status badges, Title Case labels, fully responsive.
- **4 tabs:** Signals (ranked by conviction, colored tags 🟣🟒🟑βšͺ, Chart + TV links),
Market (funding/OI/liq per universe coin), Performance (win rate / avg R / equity curve
in R, from `signals` table β€” spec Β§7), Health (ws uptime, last poll, baseline coverage
days/7, DB size, config version).
- **Live updates via `gr.Timer`** (no page refresh β€” D10). Read latest state from `store/db.py`
query helpers; `app.py` already lazy-imports `ui.dashboard.build(get_state)` and falls back
to the placeholder if absent β€” so just implement `build(get_state)` returning a `gr.Blocks`.
- Data already available: `db.recent_signals()`, `db.active_signals()`, `db.latest_snapshots()`,
`db.liq_baseline_days()`, plus `signals` rows carry conviction fields needed for tags.
### 2. Step 4b β€” Annotated "Chart" screenshots (D7)
`matplotlib`+`mplfinance` already in requirements. Build `chart.py`: render a candlestick PNG
for a signal marking FVG boxes, swing H/L, BoS line, entry/stop/T1/T2. Surface as the "Chart"
link/button per signal in the Signals tab. (TV link already done in `links.py`.)
### 3. Conviction persistence gap (small, do early)
`signals` table stores `score_*` + levels but NOT `conviction`/`conviction_tag` as columns
(they're computed in `engine/scoring.py`). For the dashboard tags to survive restart, either
(a) add `conviction REAL, conviction_tag TEXT` columns to the schema in `store/db.py` +
`insert_signal`, OR (b) recompute on read. Recommend (a) β€” one ALTER + 2 dict keys.
### 4. Step 5 β€” SKILL.md (installable blueprint)
Use the skill-export procedure to produce an installable `SKILL.md` capturing the whole
strategy + build. Not yet started.
### 5. Step 6 β€” Final packaging
Re-zip as `Confluence Revesal Crypto Engine v1.0.zip` (user's exact filename, note the
original spelling) after testing + final go.
### 6. Live validation on HF (only possible there)
- OKX REST from a non-US node (this build box + HF default are geo-blocked from Binance/Bybit;
OKX worked from here, but confirm on the actual Space).
- Bucket restore/sync round-trip with real `HF_TOKEN` + `CRE_BUCKET`.
- 7-day liquidation baseline accumulation (cold start β†’ WATCH-only until mature).
---
## Key decisions already locked (don't re-litigate β€” see Build Log)
- **D1** Gradio SDK (not Docker) Β· **D4** OKX sole data source (Binance/Bybit removed, geo-blocked)
- **D5** dynamic whole-market universe via liquidity funnel, event-driven on flushes
- **D6** CoinGecko = enrichment/price-redundancy only (cannot power signals)
- **D7** per-signal TV link (`TV_EXCHANGE` var, default BYBIT) + annotated Chart screenshot
- **D8** Telegram token+chat id = HF **Secrets** (encrypted)
- **D9** persistence = HF Storage Bucket snapshot/restore (NOT direct mount β€” SQLite locking)
- **D10** UI live updates via `gr.Timer`, no page refresh
- **Engine:** removed spec's hard active-signal caps β†’ **Conviction Score (0..100)** ranks ALL
setups + colored tag (Eliteβ‰₯85/Strongβ‰₯70/Moderateβ‰₯55/Watch). Cooldown is the only hard gate.
## Env vars (HF Space)
Secrets: `TELEGRAM_BOT_TOKEN`, `TELEGRAM_CHAT_ID`, `HF_TOKEN`, (opt) `COINGLASS_API_KEY`.
Variables: `CRE_BUCKET`, `TV_EXCHANGE`, `DB_PATH=/data/cre.db` optional, `UNIVERSE_MAX`,
`UNIVERSE_MIN_TURNOVER_USD`, `WATCHLIST` (pins fixed mode), `POLL_INTERVAL_SEC`.
Full setup runbook: `HF_SETUP.md`.