NautilusTrader
ConceptsInstruments

Futures Contract

FuturesContract represents a dated, exchange-traded futures contract with a defined underlying, activation time, expiration time, currency, multiplier, and lot size.

Examples include equity index futures, commodity futures, interest-rate futures, and currency futures.

Fields

FieldRust typePython typeRequired/defaultNotes
instrument_idInstrumentIdInstrumentIdRequiredStored as id in Rust.
raw_symbolSymbolSymbolRequiredNative venue symbol.
asset_classAssetClassAssetClassRequiredAsset class of the underlying.
exchangeOption<Ustr>str | NoneNoneExchange MIC or venue code when known.
underlyingUstrstrRequiredUnderlying asset, index, or product.
activation_nsUnixNanosintRequiredContract activation timestamp.
expiration_nsUnixNanosintRequiredContract expiration timestamp.
currencyCurrencyCurrencyRequiredQuote and settlement currency.
price_precisionu8intRequiredDecimal places allowed for prices.
price_incrementPricePriceRequiredSmallest valid price step.
size_precisionu8int0Futures trade in whole contracts.
size_incrementQuantityQuantity1Minimum contract size step.
multiplierQuantityQuantityRequiredContract 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

  • FuturesContract has instrument class Future.
  • It is never inverse. Cost, settlement, and quote currency use currency.
  • It trades in whole contracts with size precision 0 and size increment 1.
  • Use CryptoFuture for dated crypto futures where the underlying and settlement currencies can differ.

Example

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

let activation = Utc.with_ymd_and_hms(2021, 9, 10, 0, 0, 0).unwrap();
let expiration = Utc.with_ymd_and_hms(2021, 12, 17, 0, 0, 0).unwrap();

let esz21 = FuturesContract::new(
    InstrumentId::from("ESZ21.GLBX"),
    Symbol::from("ESZ21"),
    AssetClass::Index,
    Some(Ustr::from("XCME")),
    Ustr::from("ES"),
    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.25"),
    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 FuturesContract instruments include:

On this page