GitHub Actions
Clean project deployment
c6262df
|
Raw History Blame Contribute Delete
6.06 kB

A newer version of the Gradio SDK is available: 6.32.0

Upgrade
metadata
license: mit
title: Confluence Reversal Crypto Engine v1.0
sdk: gradio
sdk_version: 5.49.1
app_file: app.py
emoji: πŸš€
colorFrom: green
colorTo: indigo
pinned: true
short_description: CRE Signals Bot

πŸš€ Confluence Reversal Crypto Engine (CRE) v1.0

A crypto-futures reversal signal engine. CRE scans the whole USDT-perp market (filtered down to the liquid, tradeable names), and scores high-probability mean-reversion setups by combining four independent, confluent data layers into a single score. Strong setups are pushed to Telegram and shown on a live dashboard.

This is a measurement instrument first, a signal bot second. Its honest purpose for the first 1–2 months is to log and prove whether the edge exists β€” not to promise profit. Signals are not financial advice.


What It Does

Layer Source (OKX) Detects
L1 β€” Liquidation Flush liquidation-orders WebSocket Exhausted momentum via liquidation clusters
L2 β€” Funding / OI Divergence Funding rate + open interest Smart money exiting (extreme funding + OI drop)
L3 β€” Order-Flow Imbalance Taker buy/sell volume Aggressive buy/sell exhaustion
L4 β€” Structural Context 15m / 1h klines Fair Value Gaps, swing levels, breaker / BoS

Weighted score β†’ tier WATCH / SETUP / SNIPER. SETUP and SNIPER fire alerts; WATCH is logged silently. Full strategy logic, formulas, and risk rules live in SKILL.md.

Data source: OKX public API (no key) β€” the one free, geo-reachable exchange that exposes all four layers (Binance/Bybit are geo-blocked on most free hosts). Each signal is about the coin, not the venue β€” so you can act on it on Bybit, Binance, or anywhere.

Universe: dynamic. CRE rebuilds its watchlist hourly from all OKX USDT perps, keeping the liquid ones (24h turnover filter) and dropping stablecoins/junk. One liquidation stream watches the entire market; only coins that actually flush get the heavy per-coin scoring β€” so a wide universe stays cheap. Set WATCHLIST to pin a fixed list instead.

Each signal carries a TV link (TradingView, on your chosen exchange) and a Chart (an annotated screenshot marking FVG, swings, BoS, and the entry/stop/target levels).


Configuration (Space Secrets & Variables)

Name Type Required Purpose
TELEGRAM_BOT_TOKEN secret for alerts Telegram bot token from @BotFather
TELEGRAM_CHAT_ID secret for alerts Destination chat/channel id
COINGLASS_API_KEY secret no Optional cross-exchange enrichment
TV_EXCHANGE variable no (default BYBIT) Where TV links point: BYBIT / BINANCE / MEXC / OKX
DB_PATH variable no SQLite path. Default ./cre.db. Set /data/cre.db with persistent storage
UNIVERSE_MAX variable no (default 80) Max coins kept after the liquidity funnel
UNIVERSE_MIN_TURNOVER_USD variable no (default 20000000) Min 24h USD turnover to qualify
WATCHLIST variable no Comma-separated symbols to pin a fixed universe (disables the scan)
POLL_INTERVAL_SEC variable no (default 60) Market poll cadence

Telegram token + chat id are SECRETS (encrypted, not publicly visible). The Variables tab is the one visible to anyone who can see the Space β€” never put the token there.

Persistence β€” HF Storage Bucket (recommended)

CRE persists its database to an HF Storage Bucket so state survives restarts and sleep: on boot it restores the DB from the bucket, then syncs it back periodically and on shutdown. After a reboot the dashboard reloads the last state and continues β€” open trades and full signal history are recalled.

  • How: SQLite runs on the Space's fast local disk (reliable file locking); a background sync worker mirrors it to the bucket. We deliberately do not run SQLite directly on a mounted bucket β€” object storage doesn't support SQLite's locking safely. Snapshot/restore is the robust pattern (the same approach HF's own tools use).
  • Setup: create a bucket, add secret HF_TOKEN (write scope) + variable CRE_BUCKET (owner/bucket-name). See HF_SETUP.md. The DB is only megabytes, so storage cost is minimal.
  • Without a bucket: CRE still runs fully (ephemeral DB_PATH=./cre.db), but history resets on restart β€” fine for evaluation, not for a long-running track record.
  • Sleep behavior: free Spaces sleep after ~48h with no UI traffic; a sleeping Space cannot poll or alert. CRE handles sleep/wake gracefully β€” gap-marked liquidation buckets are excluded from baselines.

Disclaimer

CRE is an experimental research tool. Mean-reversion strategies lose in strong trends; expect losing streaks. Judge the system on 100+ logged signals, not on 10. The log records alerted levels, not your actual fills. Nothing here is financial advice. Trade at your own risk.


Built from the Confluence Reversal Engine v1.0 specification, optimized against live data. Strategy thresholds are version-controlled config β€” change them deliberately, never silently.