Binance Futures Bot Architecture

🌐 한국어

Spot and futures bots are fundamentally different. Futures bring leverage—and leverage determines whether your bot survives or wipes out. Risk management isn't a feature; it's the feature. I'll dissect the structure of a Binance USDT-M futures signal bot, with focus on concept over code.

Notional Value and Leverage — Control Your Scale

In futures, "how much to buy" has two dimensions: notional value and leverage.

  • Notional — position size per entry, measured in USDT
  • Leverage — how many times your collateral you're using

A common beginner mistake: conflating leverage with profit multiplier. Wrong. Leverage is a loss multiplier too. So production bots hardcode entry size as a parameter you can't exceed:

[trading]

notional_per_entry = 125   ; position size per entry (USDT)

leverage           = 5     ; leverage multiplier

max_positions      = 3     ; max simultaneous positions

max_positions is critical. No matter how many signals fire, limit concurrent positions. This is the circuit breaker that stops a single bad day from liquidating your account.

TP/SL — Register Orders on the Exchange Immediately

One non-negotiable rule: don't calculate stop-loss in code; place it as a real order on the exchange as soon as you enter.

Monitoring price inside bot code is dangerous. If the bot dies, the network drops, or the process hangs, your stop-loss dies with it. Instead, the moment you enter a position, register both TP and SL as exchange orders:

  • TP (take-profit): LIMIT reduce-only order—exchange auto-closes at target
  • SL (stop-loss): STOP_MARKET reduce-only order—exchange liquidates at stop price

Your bot can die and hard stop-loss lives. I've seen Python bots calculate stop-loss only in-code, then the process died and stop-loss evaporated—a catastrophic bug. Rewriting in Go, we fixed it: "Place actual STOP orders on exchange." That change alone prevented multiple account wipes.

Multi-Symbol Auto Diversification

Drilling one symbol exposes you to that symbol's whipsaws. So use auto mode: every tick, the bot auto-selects and diversifies across symbols, guarded by liquidity and volatility filters.

# Concept: pick from top N by volume, but exclude risky ones

ALT_TOP_N        = 12      # select from top N by 24h volume

ALT_MIN_QVOL_M   = 80.0    # minimum 24h notional volume ($ millions)—liquidity gate

ALT_MAX_ABS_CHG  = 25.0    # max |24h price change %|—exclude runups

# Exclude stables, leverage tokens (UP/DOWN/BULL/BEAR)

Thin volume = high slippage; 50%+ daily swings = overheated. Filter these first, then hunt signals in what remains.

Signal Combination — All Conditions Must Agree

Single indicators are noisy. Real entry conditions are consensus across multiple indicators:

  • Macro gate — does BTC direction align with this entry? (block anti-correlated trades)
  • Trend confirmation — does the symbol's trend indicator (Supertrend) agree?
  • Momentum/timing — trend reversal signals (PSAR) freshness, overheating check (Bollinger %B)
  • Duplicate lock — prevent the same symbol/direction entering twice in one cycle

All must be true to enter. Tighter criteria = fewer entries but higher quality. Exit is the opposite: loosen the exit criteria—one condition suffices to exit fast.

Enter cautiously, exit aggressively. This is foundational risk discipline.

Summary

  • Notional, leverage, max_positions as parameters—hard ceilings on size
  • TP/SL as real exchange orders placed immediately—survives bot death
  • Auto diversification across symbols, filtered by liquidity and volatility
  • Entry is multi-indicator consensus (conservative); exit is single signal (fast)

In futures, flashy strategies matter less than staying alive. Leverage is a double-edged sword; the framework's job is to keep you holding the hilt, not the blade.

This is educational material, not investment advice. Leveraged futures trading can result in losses exceeding collateral. You alone are responsible for outcomes.

댓글

이 블로그의 인기 게시물

한국투자증권 KIS API로 실시간 시세 받기 (WebSocket 실전)

파이썬으로 업비트 API 연동하기 — 시세 조회부터 주문까지 기초

Go로 자동매매 신호봇 프레임워크 설계하기