Download HF_SETUP.md from abyXsmart/Confluence_Reversal_Engine: direct link, hf CLI and curl.
- Browser
- Download file 5.09 kB
-
https://huggingface.co/spaces/abyXsmart/Confluence_Reversal_Engine/resolve/main/HF_SETUP.md
- Command line
-
hf download hf://spaces/abyXsmart/Confluence_Reversal_Engine/HF_SETUP.md
-
curl -L -o HF_SETUP.md https://huggingface.co/spaces/abyXsmart/Confluence_Reversal_Engine/resolve/main/HF_SETUP.md
A newer version of the Gradio SDK is available: 6.32.0
Hugging Face Spaces β Initial Setup Guide (CRE v1.0)
Step-by-step to deploy and operate CRE on Hugging Face. Do these in order.
1. Create the Space
- Go to huggingface.co β your profile β New β Space.
- Owner: your account (or an org).
- Space name: e.g.
confluence-reversal-engine(this becomes the URL slug:huggingface.co/spaces/<you>/confluence-reversal-engine). - License: MIT (matches the README front-matter).
- SDK: select Gradio.
- Hardware:
CPU basicis enough (CRE is I/O-bound, not compute-bound). - Visibility: Public or Private β your call. Private still runs the workers.
- Click Create Space.
2. Upload the project files
Either drag-drop in the Space's Files tab, or push via git:
git clone https://huggingface.co/spaces/<you>/confluence-reversal-engine
# copy all files from this build into the clone, then:
git add . && git commit -m "CRE v1.0" && git push
Required files (all in this build): README.md, requirements.txt, app.py,
config.py, workers.py, engine/, exchange/, store/, alerts/, ui/.
The YAML block at the top of
README.mdconfigures the Space β do not edit it (there's a tamper-protection note right below it).
3. Persistence β HF Storage Bucket (recommended)
CRE keeps its database on a Storage Bucket so state survives restart/sleep: on boot it restores the DB from the bucket; it then syncs back periodically and on shutdown. After a reboot the dashboard reloads the last state and continues β open trades and full history are recalled.
Why not mount the bucket and put SQLite on it directly? Object storage doesn't safely support SQLite's file locking under constant writes (corruption risk). CRE instead runs SQLite on the Space's fast local disk and snapshots it to the bucket (restore-on-boot + periodic + on-shutdown sync) β robust and the same pattern HF's own tools use. The DB is only megabytes, so bucket cost is minimal.
Setup:
- Create a bucket at huggingface.co/new-bucket (set it private). Note its id
as
owner/bucket-name. - Create a write token: Settings β Access Tokens β New token (role: Write).
- In the Space, add:
- Secret
HF_TOKEN= the write token. - Variable
CRE_BUCKET=owner/bucket-name.
- Secret
- That's it β CRE auto-restores on boot and syncs thereafter.
No bucket? CRE still runs fully with ephemeral DB_PATH=./cre.db; history just
resets on restart. Fine for evaluation, not for a long-running track record.
4. Secrets & Variables
Space β Settings β Variables and secrets.
Secrets (encrypted β use for tokens):
| Name | Value |
|---|---|
TELEGRAM_BOT_TOKEN |
from @BotFather (see step 5) |
TELEGRAM_CHAT_ID |
your chat/channel id (see step 5) |
COINGLASS_API_KEY |
(optional) Coinglass key for cross-exchange enrichment |
Variables (plain β non-secret config):
| Name | Suggested value | Purpose |
|---|---|---|
DB_PATH |
/data/cre.db (or leave unset) |
persist DB (requires step 3) |
TV_EXCHANGE |
BYBIT |
where the per-signal TV link points (BYBIT/BINANCE/MEXC/OKX) |
WATCHLIST |
(leave unset for the dynamic whole-market scan) | pin a fixed comma-separated list |
UNIVERSE_MAX |
80 |
max coins kept after the liquidity funnel |
UNIVERSE_MIN_TURNOVER_USD |
20000000 |
min 24h USD turnover to qualify |
POLL_INTERVAL_SEC |
60 |
market poll cadence |
Data source: OKX (public, no key) is built in β no
EXCHANGEvariable needed. Binance/Bybit are geo-blocked on free hosts and were removed;TV_EXCHANGEabove only controls where the chart link sends you, not where data comes from.
5. Telegram bot (for alerts)
- In Telegram, message @BotFather β
/newbot, follow prompts β copy the bot token β put it inTELEGRAM_BOT_TOKEN. - Create a channel/group, add your bot as an admin (or just DM the bot once).
- Get the chat id: message the bot, then open
https://api.telegram.org/bot<TOKEN>/getUpdatesand readchat.idβ put it inTELEGRAM_CHAT_ID. - Alerts are optional β without these two, CRE still runs and logs; it just won't push (dashboard still shows everything).
6. First boot & verification
- After upload + secrets, the Space builds automatically (watch the Logs tab).
- On success you'll see the Gradio dashboard. Check Tab 4 β Settings & Health:
- websocket: connected
- per-symbol last poll times advancing
- liquidation baseline coverage starting to climb (0 β 7 days over the first week)
- Cold start is normal: for the first ~7 days the engine is WATCH-only until each symbol has enough self-collected liquidation history (spec Β§15.3).
7. Keeping it awake (free tier)
Free Spaces sleep after ~48h of no UI traffic; a sleeping Space can't poll or alert. Options: upgrade to persistent hardware, or accept monitoring gaps (CRE catches up on wake and marks gap buckets incomplete so baselines stay clean).