NautilusTrader
ConceptsInstruments

Futures Spread

FuturesSpread represents an exchange-defined futures strategy with more than one leg, such as a calendar spread or inter-commodity spread. The venue defines the strategy, symbol, tick size, and expiry.

Examples include listed futures calendar spreads and exchange-supported spread markets.

Fields

FieldRust typePython typeRequired/defaultNotes
instrument_idInstrumentIdInstrumentIdRequiredStored as id in Rust.
raw_symbolSymbolSymbolRequiredNative venue symbol.
asset_classAssetClassAssetClassRequiredAsset class of the underlying strategy.
exchangeOption<Ustr>str | NoneNoneExchange MIC or venue code when known.
underlyingUstrstrRequiredUnderlying product or product family.
strategy_typeUstrstrRequiredVenue strategy type, such as calendar.
activation_nsUnixNanosintRequiredStrategy activation timestamp.
expiration_nsUnixNanosintRequiredStrategy expiration timestamp.
currencyCurrencyCurrencyRequiredQuote and settlement currency.
price_precisionu8intRequiredDecimal places allowed for prices.
price_incrementPricePriceRequiredSmallest valid price step.
size_precisionu8int0Futures spreads trade in whole contracts.
size_incrementQuantityQuantity1Minimum contract size step.
multiplierQuantityQuantityRequiredStrategy multiplier.
lot_sizeQuantityQuantityRequiredRounded lot or contract lot size.
margin_initOption<Decimal>Decimal | None0Initial margin rate.
margin_maintOption<Decimal>Decimal | None0Maintenance margin rate.
maker_feeOption<Decimal>Decimal | None0Maker fee rate. Negative values rebate.
taker_feeOption<Decimal>Decimal | None0Taker fee rate. Negative values rebate.
max_quantityOption<Quantity>Quantity | NoneNoneMaximum order quantity.
min_quantityOption<Quantity>Quantity | None1Minimum order quantity.
max_priceOption<Price>Price | NoneNoneMaximum valid quote or order price.
min_priceOption<Price>Price | NoneNoneMinimum valid quote or order price.
tick_scheme_nameN/Astr | NoneNoneRegistered variable tick scheme name.
infoOption<Params>dict | NoneNoneAdapter metadata.
ts_eventUnixNanosintRequiredEvent timestamp in nanoseconds.
ts_initUnixNanosintRequiredInitialization timestamp in nanoseconds.

Note: Python constructors use instrument_id; Rust stores the same value as id.

Behavior

  • FuturesSpread has instrument class FuturesSpread.
  • The venue publishes the spread as a single tradable instrument.
  • It trades in whole contracts with size precision 0 and size increment 1.
  • Use leg data from the adapter metadata when a strategy needs venue-specific leg details.

Example

use chrono::{TimeZone, Utc};
use nautilus_core::UnixNanos;
use nautilus_model::{
    enums::AssetClass,
    identifiers::{InstrumentId, Symbol},
    instruments::FuturesSpread,
    types::{Currency, Price, Quantity},
};
use ustr::Ustr;

let activation = Utc.with_ymd_and_hms(2022, 6, 21, 13, 30, 0).unwrap();
let expiration = Utc.with_ymd_and_hms(2024, 6, 21, 13, 30, 0).unwrap();

let es_spread = FuturesSpread::new(
    InstrumentId::from("ESM4-ESU4.GLBX"),
    Symbol::from("ESM4-ESU4"),
    AssetClass::Index,
    Some(Ustr::from("XCME")),
    Ustr::from("ES"),
    Ustr::from("EQ"),
    UnixNanos::from(activation.timestamp_nanos_opt().unwrap() as u64),
    UnixNanos::from(expiration.timestamp_nanos_opt().unwrap() as u64),
    Currency::from("USD"),
    2,
    Price::from("0.01"),
    Quantity::from("1"),
    Quantity::from("1"),
    None,
    None,
    None,
    None,
    None,
    None,
    None,
    None,
    None,
    UnixNanos::default(),
    UnixNanos::default(),
);

Adapters

Representative adapters that create or consume FuturesSpread instruments include:

On this page