Skip to main content
Equities, futures, options and bonds share one cash balance, one ledger and one bundle. A cross-asset strategy is an ordinary algorithm file. Worked examples live in examples/futures, examples/options, examples/bonds and examples/cross_asset.

Futures

Listings vs contracts

A listing is what you order and price. A contract (FuturesContract) carries the specification — multiplier, expiration — and is reached through listing.asset.

Rolling

front_contract is the pick and the roll at once: once the contract you hold fails the roll_before_days test, it returns the next delivery, and you roll by ordering what it now returns.
A continuous future is for reading data. Ordering one raises — order await data.current_contract(cf) instead.

Sizing

Futures sizing is a notional calculation: price × multiplier × quantity.
Opening a futures position moves no cash; variation margin settles daily in both directions. Commission is PerContract plus exchange fees by root.
Yahoo reports no volume on many futures sessions, and the simulation won’t fill on a bar where nothing traded — an order can take several sessions to fill. Expired contracts are also removed from Yahoo, so a chain runs forward from today. Read examples/futures/README.md before drawing conclusions from Yahoo futures data.

Options

Requires ziplime[options] for pricing and Greeks. Selecting from a chain:
nearest_delta takes the delta as a magnitude (0.20 for the 20-delta put) and computes a Black-Scholes delta at the volatility you pass. Near a 0DTE close almost every contract has a delta of 0 or 1, so select by strike_offset there instead. OptionChain also has calls, puts, strikes, at_strike, nearest_strike and strike_offset.
  • A 0DTE strategy calls option_chain every session: contracts are listed fresh each day.
  • option_greeks reads the contract’s implied_volatility field when the data has one and raises when it doesn’t, rather than inventing a volatility. Pass volatility= explicitly otherwise.
  • Options settle at intrinsic value. Commission is PerOptionContract by default.

Bonds

Coupons are paid into cash, amortisation reduces principal, and bonds are redeemed at par. Commission is PerBondTurnover by default.