NautilusTrader
ConceptsInstruments

Currency Pair

CurrencyPair represents a spot or cash market quoted as BASE/QUOTE. The base currency is the asset being bought or sold, and the quote currency prices one unit of the base. Nautilus uses this type for fiat FX pairs and crypto spot pairs.

Examples include EUR/USD.SIM, BTCUSDT.BINANCE, and ETH/USD.KRAKEN.

Fields

FieldRust typePython typeRequired/defaultNotes
instrument_idInstrumentIdInstrumentIdRequiredStored as id in Rust.
raw_symbolSymbolSymbolRequiredNative venue symbol.
base_currencyCurrencyCurrencyRequiredAsset bought or sold.
quote_currencyCurrencyCurrencyRequiredCurrency used to price the base asset.
price_precisionu8intRequiredDecimal places allowed for prices.
size_precisionu8intRequiredDecimal places allowed for order sizes.
price_incrementPricePriceRequiredSmallest valid price step.
size_incrementQuantityQuantityRequiredSmallest valid size step.
ts_eventUnixNanosintRequiredEvent timestamp in nanoseconds.
ts_initUnixNanosintRequiredInitialization timestamp in nanoseconds.
multiplierQuantityQuantity1Contract multiplier.
lot_sizeOption<Quantity>Quantity | NoneNoneRounded 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.

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

Behavior

  • CurrencyPair has instrument class Spot.
  • It has no expiration, strike price, option kind, or derivative underlying field.
  • It is never inverse. The settlement currency and cost currency are the quote currency.
  • Use this type for both fiat FX pairs and crypto spot pairs.

Do not model dated futures, swaps, or options as CurrencyPair only because their symbols look like pairs. Use the specific derivative type so cost currency, settlement currency, expiration, and notional calculations match the venue.

Example

use nautilus_core::UnixNanos;
use nautilus_model::{
    identifiers::{InstrumentId, Symbol},
    instruments::{CurrencyPair, InstrumentAny},
    types::{Currency, Money, Price, Quantity},
};
use rust_decimal_macros::dec;

let btcusdt = CurrencyPair::new(
    InstrumentId::from("BTCUSDT.BINANCE"),
    Symbol::from("BTCUSDT"),
    Currency::from("BTC"),
    Currency::from("USDT"),
    2,
    6,
    Price::from("0.01"),
    Quantity::from("0.000001"),
    None,
    None,
    None,
    Some(Quantity::from("0.000001")),
    None,
    Some(Money::from("10.00 USDT")),
    Some(Price::from("1000000.00")),
    Some(Price::from("0.01")),
    Some(dec!(0.001)),
    Some(dec!(0.001)),
    Some(dec!(0.001)),
    Some(dec!(0.001)),
    None,
    UnixNanos::default(),
    UnixNanos::default(),
);

let instrument = InstrumentAny::CurrencyPair(btcusdt);

Adapters

Representative adapters that create or consume CurrencyPair instruments include:

  • Data explains market data that references instruments.
  • Execution explains order checks that use instrument precision.
  • Value types explains Price, Quantity, and Money.

On this page