NautilusTrader
ConceptsInstruments
These docs track the unreleased nightly build and may change without notice. Switch to the latest stable docs.

Perpetual Contract

PerpetualContract represents a generic perpetual futures contract across asset classes. Use it when a venue exposes a perpetual swap that is not specifically modeled as CryptoPerpetual.

Examples include non-crypto perpetual contracts and venue-specific synthetic swaps.

Fields

FieldRust typePython typeRequired/defaultNotes
instrument_idInstrumentIdInstrumentIdRequiredStored as id in Rust.
raw_symbolSymbolSymbolRequiredNative venue symbol.
underlyingUstrstrRequiredUnderlying asset or reference market.
asset_classAssetClassAssetClassRequiredAsset class of the underlying.
base_currencyOption<Currency>Currency | NoneNoneBase currency, required for inverse.
quote_currencyCurrencyCurrencyRequiredCurrency used to quote the price.
settlement_currencyCurrencyCurrencyRequiredCurrency used to settle PnL and fees.
is_inverseboolboolRequiredTrue when sizing/costing is inverse.
price_precisionu8intRequiredDecimal places allowed for prices.
size_precisionu8intRequiredDecimal places allowed for order sizes.
price_incrementPricePriceRequiredSmallest valid price step.
size_incrementQuantityQuantityRequiredSmallest valid size step.
multiplierQuantityQuantity1Contract multiplier.
lot_sizeQuantityQuantity1Rounded lot or board size.
max_quantityOption<Quantity>Quantity | NoneNoneMaximum order quantity.
min_quantityOption<Quantity>Quantity | NoneNoneMinimum order quantity.
max_notionalOption<Money>Money | NoneNoneMaximum order notional value.
min_notionalOption<Money>Money | NoneNoneMinimum order notional value.
max_priceOption<Price>Price | NoneNoneMaximum valid quote or order price.
min_priceOption<Price>Price | NoneNoneMinimum valid quote or order price.
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.
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

  • PerpetualContract has instrument class Swap.
  • It has no activation timestamp or expiration timestamp.
  • Inverse contracts require a base currency.
  • Linear contracts typically settle in the quote currency.
  • Use CryptoPerpetual for crypto perpetuals where the base asset is a currency.

Example

use nautilus_core::UnixNanos;
use nautilus_model::{
    enums::AssetClass,
    identifiers::{InstrumentId, Symbol},
    instruments::PerpetualContract,
    types::{Currency, Price, Quantity},
};
use rust_decimal_macros::dec;
use ustr::Ustr;

let eurusd_perp = PerpetualContract::builder()
    .instrument_id(InstrumentId::from("EURUSD-PERP.AX"))
    .raw_symbol(Symbol::from("EURUSD-PERP"))
    .underlying(Ustr::from("EURUSD"))
    .asset_class(AssetClass::FX)
    .base_currency(Currency::from("EUR"))
    .quote_currency(Currency::from("USD"))
    .settlement_currency(Currency::from("USD"))
    .is_inverse(false)
    .price_precision(5)
    .size_precision(0)
    .price_increment(Price::from("0.00001"))
    .size_increment(Quantity::from("1"))
    .margin_init(dec!(0.03))
    .margin_maint(dec!(0.03))
    .maker_fee(dec!(0.00002))
    .taker_fee(dec!(0.00002))
    .ts_event(UnixNanos::default())
    .ts_init(UnixNanos::default())
    .build()
    .unwrap();

Adapters

Representative adapters that create or consume PerpetualContract instruments include:

  • Crypto Perpetual covers crypto perpetual futures.
  • Data covers mark prices, index prices, and funding rate updates.

On this page