← Docs

📊 Futures

A complete reference for how the bot trades futures via IBKR. If you're new to futures, start here — every concept is built up from scratch with concrete numbers, including how leverage actually works and where retail traders most often blow up.

01What a futures contract actually is

A futures contract is a deal you make today to buy or sell something at a specific price on a specific future date. Most traders never take delivery — they close before expiry by selling what they bought (or vice versa).

Three things make futures different from stocks:

  • They're leveraged by design. You put up a small fraction of the contract value (5–10%) as “margin.” A 1% move in the underlying can swing your account 10–20%.
  • They expire. Every contract has a death date. No buy-and-hold-forever like a stock.
  • They're marked to market every day. Losses are pulled out of your account each evening; gains added. If you can't meet a margin call by morning, the broker liquidates you — automatically, no warning beyond what they already gave.

A single E-mini S&P contract has ~$300k of notional exposure on ~$15k of margin. Losses can exceed your initial deposit. Paper-trade first.

02Micro vs. full contracts

Standard E-mini contracts are too big for most retail accounts. CME's Micro series cuts that 10× — the bot trades these by default.

SymbolProductMultiplierNotional @ today
ESE-mini S&P 500$50 × index~$290k
MESMicro E-mini S&P$5 × index~$29k
NQE-mini Nasdaq-100$20 × index~$420k
MNQMicro Nasdaq$2 × index~$42k
GCCOMEX Gold100 troy oz~$240k
MGCMicro Gold10 troy oz~$24k
CLWTI Crude1,000 bbl~$80k
MCLMicro Crude100 bbl~$8k

Rule of thumb: if your account is under $50k, trade micros only. The bot rejects oversize positions and logs a switch to micro hint.

03How leverage actually works

Leverage in futures isn't a setting — it's baked in. You don't pay the contract notional, you post margin and get marked to market.

Concrete example: ES at 5,800.

  • Notional = 5,800 × $50 = $290,000
  • Initial margin posted ≈ $13,500
  • Effective leverage ≈ 21×
  • 1% move in the index = $2,900 P&L per contract
  • On the $13,500 margin, that's a 21% account swing from a 1% index move

That's why micros exist. MES at 5,800 has $29,000 notional and ~$1,400 margin. Same 1% move = $290 P&L — meaningful but not portfolio-ending.

04Initial margin vs. maintenance margin

Two margin numbers matter:

  • Initial margin — what you must post to open the position. ES ≈ $13,500.
  • Maintenance margin — the floor your account equity can't fall below while the position is open. ES ≈ $12,000.

Concrete margin-call example. You start with $20,000. You buy 1 ES contract — $13,500 of margin tied up, $6,500 free. The next day ES drops 30 points:

Loss: 30 × $50 = $1,500
Account equity: $20,000 − $1,500 = $18,500
Free cash: $18,500 − $13,500 = $5,000  ✓ still fine

The day after, ES drops another 130 points:

Loss: 130 × $50 = $6,500
Account equity: $18,500 − $6,500 = $12,000
Maintenance ≤ equity?  $12,000 ≤ $12,000  ⚠️ margin call

Broker demands you wire more money OR liquidates the
position at next market open. No second chances.

05Roll mechanics + auto-roll

Futures expire. Quarterly cycle for index futures (Mar/Jun/Sep/Dec), monthly for energies/metals. The bot has an auto-roll feature in broker/futures_roll.py:

  • Compute days-to-expiry for each open position against the last business day of the expiry month.
  • If DTE ≤ roll_days (default 3), close via client.close_position(symbol).
  • If DTE ≤ warn_days (default 7), log a WARNING with the exact DTE.

The bot does NOT auto-open the next month. That's by design — when your contract expires, the next tick's HMM picks up the new front-month naturally if the regime still favors that direction. Avoids a class of bugs where auto-rolling re-creates positions you were trying to close.

broker:
  futures_roll:
    enabled: true       # default; flip to false to disable
    warn_days: 7
    roll_days: 3

The roll itself doesn't materially affect P&L (prices converge near expiry) but it crystallizes gains/losses for tax reporting.

06Day-trading vs. overnight margin

Brokers offer two margin tiers on futures:

  • Overnight margin — the exchange-set rate (~$13.5k on ES). Required if you hold past the daily settlement.
  • Day-trading margin — heavily reduced (~$500–1,500/contract on ES at most retail brokers). Available only intraday; you must close before settlement or auto-liquidation kicks in.

The pattern-day-trader rule does not apply to futures. You can scalp futures all day without worrying about the 4-day-trades-in-5-business-days rule that applies to equities.

07Section 1256 60/40 tax treatment (US)

US-regulated futures are Section 1256 contracts, which get a special tax break regardless of holding period:

  • 60% of P&L is treated as long-term capital gain.
  • 40% is treated as short-term.

This applies even to a position you held for 30 seconds. Compared to stock day trading (where everything is short-term), this is meaningfully better. Section 1256 also allows mark-to-market accounting at year-end with no wash-sale rule.

Consult a tax professional for your situation; this is not tax advice. The audit DB logs every fill but doesn't produce tax forms.

08Symbol formats

The bot's canonical futures symbol is ROOT@YYYYMM. The @ is intentional — a naked ES is also a real stock ticker (Eversource Energy), so the separator avoids collisions.

  • Specific: ES@202509 — September 2025 ES.
  • Continuous: MES — front-month, auto-rolls.

IBKR returns specific symbols on fills; the bot normalizes to continuous for the audit log.

Calling client.get_bars(['ES@202509']) routes to Future("ES", "202509", "CME", currency="USD") and qualifies via ib_insync.IB.qualifyContracts.

09Supported exchanges

Default exchange map covers ~30 most-traded electronic contracts (broker/ibkr_client.py::_DEFAULT_FUTURES_EXCHANGES):

  • CME — equity index, FX, livestock.
  • NYMEX — energy (CL, NG, HO, RB).
  • COMEX — metals (GC, SI, HG).
  • CBOT — grains (ZC, ZW, ZS), Treasury bonds (ZB, ZN).
  • CFE — VIX futures (VX).
  • ICE — softs (CC, KC, SB), Brent crude — needs config override.
  • Eurex — European indexes (FDAX, FESX) — config override.

Override for an exotic root via:

broker:
  ibkr:
    futures_exchange_map:
      CC: ICE       # Cocoa
      KC: ICE       # Coffee
      SB: ICE       # Sugar

Free IBKR paper accounts get delayed quotes for ES, NQ, CL, GC out of the box. Exotic products may need a paid $5–25/mo data subscription in IB Client Portal.

10Why retail traders blow up in futures

The classic blow-up pattern, with numbers. Trader has $25k, decides to “just trade one ES contract.”

  • Initial margin: $13,500 (54% of account).
  • Day 1: ES drops 1% (58 points × $50). Loss: $2,900. Account: $22,100.
  • Day 2: another 1% drop. Loss: another $2,900. Account: $19,200.
  • Day 3: ES gaps down 2% overnight. Loss: $5,800. Account: $13,400.
  • Margin call. Broker auto-liquidates at the worst possible price.
  • Final account: ~$11k. Down 56% in three days from a 4% index move.

The mistake wasn't direction — it was sizing. One ES on a $25k account is 12× leverage; a 4% adverse move is a 50% account hit.

Practical rule. If you're under $50k, trade only micros. If you're under $25k, paper-trade. Use the bot's built-in caps (risk.max_futures_single_position default 10%, risk.max_futures_exposure default 30%) and don't override them upward without a very good reason.