NautilusTrader
ConceptsInstruments

Binary Option

BinaryOption represents a binary outcome instrument that settles to a fixed payoff based on whether a condition is true. It can model prediction markets, binary options, or venue-specific yes/no contracts.

Examples include prediction market outcomes and binary event contracts.

Fields

FieldRust typePython typeRequired/defaultNotes
instrument_idInstrumentIdInstrumentIdRequiredStored as id in Rust.
raw_symbolSymbolSymbolRequiredNative venue symbol.
asset_classAssetClassAssetClassRequiredAsset class of the outcome market.
currencyCurrencyCurrencyRequiredQuote and settlement currency.
activation_nsUnixNanosintRequiredContract activation timestamp.
expiration_nsUnixNanosintRequiredContract expiration timestamp.
price_precisionu8intRequiredDecimal places allowed for prices.
size_precisionu8intRequiredDecimal places allowed for order sizes.
price_incrementPricePriceRequiredSmallest valid price step.
size_incrementQuantityQuantityRequiredSmallest valid size step.
outcomeOption<Ustr>str | NoneNoneOutcome label when the venue provides it.
descriptionOption<Ustr>str | NoneNoneHuman‑readable market description.
max_quantityOption<Quantity>Quantity | NoneNoneMaximum order quantity.
min_quantityOption<Quantity>Quantity | NoneNoneMinimum order quantity.
max_notionalOption<Money>N/ARust onlyMaximum order notional value.
min_notionalOption<Money>N/ARust onlyMinimum order notional value.
max_priceOption<Price>N/ARust onlyMaximum valid quote or order price.
min_priceOption<Price>N/ARust onlyMinimum valid quote or order price.
margin_initOption<Decimal>N/ARust onlyInitial margin rate.
margin_maintOption<Decimal>N/ARust onlyMaintenance 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

  • BinaryOption has instrument class BinaryOption.
  • It is never inverse and uses a multiplier and lot size of one.
  • Many venues quote binary outcomes between zero and one, but the venue defines the allowed price range and tick size.
  • outcome and description provide human-readable context for the contract.

Example

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

let raw_symbol = Symbol::from(
    "0x12a0cb60174abc437bf1178367c72d11f069e1a3add20b148fb0ab4279b772b2-92544998123698303655208967887569360731013655782348975589292031774495159624905",
);
let expiration = Utc.with_ymd_and_hms(2024, 1, 1, 0, 0, 0).unwrap();

let yes_outcome = BinaryOption::new(
    InstrumentId::new(raw_symbol, Venue::from("POLYMARKET")),
    raw_symbol,
    AssetClass::Alternative,
    Currency::from("USDC"),
    UnixNanos::default(),
    UnixNanos::from(expiration.timestamp_nanos_opt().unwrap() as u64),
    3,
    2,
    Price::from("0.001"),
    Quantity::from("0.01"),
    Some(Ustr::from("Yes")),
    Some(Ustr::from("Will the outcome of this market be 'Yes'?")),
    None,
    Some(Quantity::from("5")),
    None,
    None,
    None,
    None,
    None,
    None,
    Some(dec!(0)),
    Some(dec!(0)),
    None,
    UnixNanos::default(),
    UnixNanos::default(),
);

Adapters

Representative adapters that create or consume BinaryOption instruments include:

  • Hyperliquid for binary and prediction-style markets.
  • OKX for venue-defined binary outcome products.
  • Polymarket for prediction market outcomes.
  • Order Book covers binary market order book behavior.
  • Data explains market data that references instruments.

On this page