A real-money Binance perpetual-futures trading bot with a real scored strategy (no placeholder points) and a full set of safety rails. It is a separate val from the Jupiter paper bot — it never touches that code or its account.
⚠️ This trades real money. It places live market orders, sets 5x leverage, and parks reduce-only stop-loss / take-profit brackets on Binance USDT-M futures. Start with a tiny funded account and watch it in paper/forward-test mode first.
| File | Role |
|---|---|
main.ts | Cron entrypoint — scans, scores, and trades |
strategy.ts | Order-flow scalping signal from HVN/LVN + footprint imbalance |
flow.ts | Builds the volume profile (POC, HVN, LVN, Core Zone) + footprint from trades |
safety.ts | Kill switch, daily loss/trade caps, drawdown guard, dedup, cooldown, reconcile |
config.ts | All tunable settings in one place |
telegram.ts | Telegram alerts |
control.ts | HTTP webhook — status + remote kill switch |
README.md | This file |
Every 2 hours the bot re-scans the whole Binance USDT-M market and rebuilds its watchlist. A symbol is included only if it meets all of:
- 24h quote volume ≥
MIN_VOLUME_USD($20M) - It is a USDT perpetual (
/USDT:USDT) - Base is not BTC or ETH (
EXCLUDED_BASES) - Price ≤
MAX_BASE_PRICE_USD($1,000)
The strategy is built on order flow, not lagging indicators. For each symbol it pulls up to the last 2h of trades and:
- Volume profile — buckets trade volume into 40 price bins → finds:
- POC (Point of Control): the price level with the most traded volume
- HVN (High Volume Nodes): bins ≥ 1.5× average volume — strong support/resistance that price gravitates to
- LVN (Low Volume Nodes): bins ≤ 0.3× average volume — weak zones price slices through quickly
- Core Zone (value area): the range containing 70% of traded volume
- Footprint — for the latest 15m candle, sums buy-volume vs sell-volume at
the aggressor level:
- Delta = buy − sell volume
- Imbalance = (buy − sell) / (buy + sell), in −1..1
Signal logic:
- Long when price is trading off an HVN support and the footprint shows a taker-buy imbalance (delta > 0, imbalance > 0.25).
- Short when price is rejecting off an HVN resistance with taker-sell imbalance.
- LVN proximity adds "fuel" points (room to run through the weak zone).
Gates: the setup must be off an HVN and backed by a strong footprint
imbalance — never a blind one-sided entry. Trades only at score ≥ 70.
Stop = 25% of the observed trading range; target = 2× stop distance (R:R 1:2).
- Kill switch — halts all new entries. Flip it via the control webhook
(
CONTROL_TOKEN) or by settingKILL_SWITCH-style DB state. - Daily loss cap — stops opening new trades once realized loss hits
MAX_DAILY_LOSS_USD(default $50). - Daily trade cap —
MAX_DAILY_TRADES(default 10) per UTC day. - Drawdown guard — stops new entries once unrealized loss on open positions
hits
MAX_DRAWDOWN_USD(default $100). - Max open trades —
MAX_OPEN_TRADES(default 2), counted correctly for shorts (|contracts| > 0). - Position dedup — never opens a second position on a symbol already held.
- Cooldown — no re-entry on a symbol for
SYMBOL_COOLDOWN_MSafter a trade. - Reconciliation — each run syncs the DB ledger with Binance's live positions, booking closed positions' PnL and updating marks.
- Set env vars on this val:
BINANCE_API_KEY,BINANCE_SECRET_KEY— futures-enabled API keysTELEGRAM_BOT_TOKEN,TELEGRAM_CHAT_ID— alerts (optional)CONTROL_TOKEN— secret to authorize kill-switch toggles (optional)
- Confirm the interval schedule on
main.ts(default: every 15 min). - Test with a tiny balance first. Watch Telegram + the control webhook before trusting it with real size.
GET→ JSON status (kill switch, today's PnL/trades, open positions)POST{"action":"kill","state":true}with headerX-Control-Token: <token>→ flips the kill switch. Refused unlessCONTROL_TOKENis set.