| name | futures |
| description | Use whenever a strategy trades futures — position sizing (notional/contracts), continuous-contract history and its `MultiIndex DataFrame`, and warm-up. Load it for any futures sizing, history, or warm-up step. |
Futures: sizing, history, warm-up
Position sizing (notional, not set_holdings)
To take a target notional (portfolio-fraction) exposure in a future, do NOT use set_holdings: for a future it sizes off (already-leveraged) buying power, so a target near 1.0 takes on many times 1x notional — margin calls and blow-ups — and |target| > 1 is rejected outright. Also, the continuous/canonical future symbol (e.g. /ES) is a DATA symbol and is NOT tradable — market_order or portfolio reads on it silently do nothing, so symbol below must be a real contract (the front month via future.mapped, or the specific contract the strategy selects). Size by notional with explicit contract math:
price = self.securities[symbol].price
multiplier = self.securities[symbol].symbol_properties.contract_multiplier
target_contracts = round(self.portfolio.total_portfolio_value * target_weight / (price * multiplier))
delta = target_contracts - self.portfolio[symbol].quantity; self.market_order(symbol, delta)
History — use self.history(); do NOT rebuild a DataFrame from TradeBars
Seeding a raw look-back buffer (e.g. an expanding regression window) is a HISTORY REQUEST, not a warm-up (warm-up pumps data through on_data and updates indicators; a history request hands you a DataFrame to process yourself).