Instruments
Defines tradable asset/contract instruments with specific properties dependent on the asset class and instrument class.
class BettingInstrument
Bases: Instrument
BettingInstrument(unicode venue_name, int event_type_id, unicode event_type_name, int competition_id, unicode competition_name, int event_id, unicode event_name, unicode event_country_code, datetime event_open_date, unicode betting_type, unicode market_id, unicode market_name, datetime market_start_time, unicode market_type, int selection_id, unicode selection_name, unicode currency, float selection_handicap, int8_t price_precision, int8_t size_precision, uint64_t ts_event, uint64_t ts_init, unicode tick_scheme_name=None, Price min_price=None, Price max_price=None, dict info=None)
Represents an instrument in a betting market.
betting_type
competition_id
competition_name
event_country_code
event_id
event_name
event_open_date
event_type_id
event_type_name
static from_dict(dict values) → BettingInstrument
Return an instrument from the given initialization values.
- Parameters: values (dict *[*str , object ]) – The values to initialize the instrument with.
- Return type: BettingInstrument
market_id
market_name
market_start_time
market_type
notional_value(self, Quantity quantity, Price price, bool use_quote_for_inverse=False) → Money
selection_handicap
selection_id
selection_name
static to_dict(BettingInstrument obj) → dict[str, object]
Return a dictionary representation of this object.
- Return type: dict[str, object]
class BinaryOption
Bases: Instrument
BinaryOption(InstrumentId instrument_id, Symbol raw_symbol, AssetClass asset_class, Currency currency, int price_precision, int size_precision, Price price_increment, Quantity size_increment, uint64_t activation_ns, uint64_t expiration_ns, maker_fee: Decimal, taker_fee: Decimal, uint64_t ts_event, uint64_t ts_init, unicode outcome=None, unicode description=None, Quantity max_quantity: Quantity | None = None, Quantity min_quantity: Quantity | None = None, dict info=None) -> None
Represents a generic binary option instrument.
- Parameters:
- instrument_id (InstrumentId) – The instrument ID.
- raw_symbol (Symbol) – The raw/local/native symbol for the instrument, assigned by the venue.
- asset_class (AssetClass) – The options contract asset class.
- currency (Currency) – The options contract currency.
- price_precision (int) – The price decimal precision.
- size_precision (int) – The trading size decimal precision.
- price_increment (Price) – The minimum price increment (tick size).
- size_increment (Quantity) – The minimum size increment.
- activation_ns (uint64_t) – UNIX timestamp (nanoseconds) for contract activation.
- expiration_ns (uint64_t) – UNIX timestamp (nanoseconds) for contract expiration.
- maker_fee (Decimal) – The fee rate for liquidity makers as a percentage of order value.
- taker_fee (Decimal) – The fee rate for liquidity takers as a percentage of order value.
- ts_event (uint64_t) – UNIX timestamp (nanoseconds) when the data event occurred.
- ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the data object was initialized.
- outcome (str , optional) – The binary outcome of the market.
- description (str , optional) – The market description.
- max_quantity (Quantity , optional) – The maximum allowable order quantity.
- min_quantity (Quantity , optional) – The minimum allowable order quantity.
- info (dict *[*str , object ] , optional) – The additional instrument information.
- Raises:
- ValueError – If price_precision is negative (< 0).
- ValueError – If size_precision is negative (< 0).
- ValueError – If price_increment is not positive (> 0).
- ValueError – If size_increment is not positive (> 0).
activation_ns
UNIX timestamp (nanoseconds) for contract activation.
- Returns: unit64_t
activation_utc
pd.Timestamp
Return the contract activation timestamp (UTC).
- Returns: tz-aware UTC.
- Return type: pd.Timestamp
- Type: BinaryOption.activation_utc
description
The market description.
- Returns:
str or
None
expiration_ns
UNIX timestamp (nanoseconds) for contract expiration.
- Returns: unit64_t
expiration_utc
pd.Timestamp
Return the contract expriation timestamp (UTC).
- Returns: tz-aware UTC.
- Return type: pd.Timestamp
- Type: BinaryOption.expiration_utc
static from_dict(dict values) → BinaryOption
Return an instrument from the given initialization values.
values : The values to initialize the instrument with.
BinaryOption
outcome
The binary outcome of the market.
- Returns:
str or
None
static to_dict(BinaryOption obj) → dict[str, object]
Return a dictionary representation of this object.
- Return type: dict[str, object]
class Cfd
Bases: Instrument
Cfd(InstrumentId instrument_id, Symbol raw_symbol, AssetClass asset_class, Currency quote_currency, int price_precision, int size_precision, Price price_increment, Quantity size_increment, margin_init: Decimal, margin_maint: Decimal, maker_fee: Decimal, taker_fee: Decimal, uint64_t ts_event, uint64_t ts_init, Currency base_currency: Currency | None = None, Quantity lot_size: Quantity | None = None, Quantity max_quantity: Quantity | None = None, Quantity min_quantity: Quantity | None = None, Money max_notional: Money | None = None, Money min_notional: Money | None = None, Price max_price: Price | None = None, Price min_price: Price | None = None, unicode tick_scheme_name=None, dict info=None)
Represents a Contract for Difference (CFD) instrument.
Can represent both Fiat FX and Cryptocurrency pairs.
- Parameters:
- instrument_id (InstrumentId) – The instrument ID for the instrument.
- raw_symbol (Symbol) – The raw/local/native symbol for the instrument, assigned by the venue.
- asset_class (AssetClass) – The CFD contract asset class.
- quote_currency (Currency) – The quote currency.
- price_precision (int) – The price decimal precision.
- size_precision (int) – The trading size decimal precision.
- price_increment (Price) – The minimum price increment (tick size).
- size_increment (Quantity) – The minimum size increment.
- margin_init (Decimal) – The initial (order) margin requirement in percentage of order value.
- margin_maint (Decimal) – The maintenance (position) margin in percentage of position value.
- maker_fee (Decimal) – The fee rate for liquidity makers as a percentage of order value.
- taker_fee (Decimal) – The fee rate for liquidity takers as a percentage of order value.
- ts_event (uint64_t) – UNIX timestamp (nanoseconds) when the data event occurred.
- ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the data object was initialized.
- base_currency (Currency , optional) – The base currency.
- lot_size (Quantity , optional) – The rounded lot unit size.
- max_quantity (Quantity , optional) – The maximum allowable order quantity.
- min_quantity (Quantity , optional) – The minimum allowable order quantity.
- max_notional (Money , optional) – The maximum allowable order notional value.
- min_notional (Money , optional) – The minimum allowable order notional value.
- max_price (Price , optional) – The maximum allowable quoted price.
- min_price (Price , optional) – The minimum allowable quoted price.
- tick_scheme_name (str , optional) – The name of the tick scheme.
- info (dict *[*str , object ] , optional) – The additional instrument information.
- Raises:
- ValueError – If tick_scheme_name is not a valid string.
- ValueError – If price_precision is negative (< 0).
- ValueError – If size_precision is negative (< 0).
- ValueError – If price_increment is not positive (> 0).
- ValueError – If size_increment is not positive (> 0).
- ValueError – If price_precision is not equal to price_increment.precision.
- ValueError – If size_increment is not equal to size_increment.precision.
- ValueError – If lot_size is not positive (> 0).
- ValueError – If max_quantity is not positive (> 0).
- ValueError – If min_quantity is negative (< 0).
- ValueError – If max_notional is not positive (> 0).
- ValueError – If min_notional is negative (< 0).
- ValueError – If max_price is not positive (> 0).
- ValueError – If min_price is negative (< 0).
base_currency
The base currency for the instrument.
- Returns:
Currency or
None
static from_dict(dict values) → Cfd
Return an instrument from the given initialization values.
- Parameters: values (dict *[*str , object ]) – The values to initialize the instrument with.
- Return type: Cfd
static from_pyo3(pyo3_instrument)
isin
The instruments International Securities Identification Number (ISIN).
- Returns:
str or
None
static to_dict(Cfd obj) → dict[str, object]
Return a dictionary representation of this object.
- Return type: dict[str, object]
class Commodity
Bases: Instrument
Commodity(InstrumentId instrument_id, Symbol raw_symbol, AssetClass asset_class, Currency quote_currency, int price_precision, int size_precision, Price price_increment, Quantity size_increment, margin_init: Decimal, margin_maint: Decimal, maker_fee: Decimal, taker_fee: Decimal, uint64_t ts_event, uint64_t ts_init, Currency base_currency: Currency | None = None, Quantity lot_size: Quantity | None = None, Quantity max_quantity: Quantity | None = None, Quantity min_quantity: Quantity | None = None, Money max_notional: Money | None = None, Money min_notional: Money | None = None, Price max_price: Price | None = None, Price min_price: Price | None = None, unicode tick_scheme_name=None, dict info=None)
Represents a commodity instrument in a spot/cash market.
- Parameters:
- instrument_id (InstrumentId) – The instrument ID for the instrument.
- raw_symbol (Symbol) – The raw/local/native symbol for the instrument, assigned by the venue.
- asset_class (AssetClass) – The Commodity contract asset class.
- quote_currency (Currency) – The quote currency.
- price_precision (int) – The price decimal precision.
- size_precision (int) – The trading size decimal precision.
- price_increment (Price) – The minimum price increment (tick size).
- size_increment (Quantity) – The minimum size increment.
- margin_init (Decimal) – The initial (order) margin requirement in percentage of order value.
- margin_maint (Decimal) – The maintenance (position) margin in percentage of position value.
- maker_fee (Decimal) – The fee rate for liquidity makers as a percentage of order value.
- taker_fee (Decimal) – The fee rate for liquidity takers as a percentage of order value.
- ts_event (uint64_t) – UNIX timestamp (nanoseconds) when the data event occurred.
- ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the data object was initialized.
- lot_size (Quantity , optional) – The rounded lot unit size.
- max_quantity (Quantity , optional) – The maximum allowable order quantity.
- min_quantity (Quantity , optional) – The minimum allowable order quantity.
- max_notional (Money , optional) – The maximum allowable order notional value.
- min_notional (Money , optional) – The minimum allowable order notional value.
- max_price (Price , optional) – The maximum allowable quoted price.
- min_price (Price , optional) – The minimum allowable quoted price.
- tick_scheme_name (str , optional) – The name of the tick scheme.
- info (dict *[*str , object ] , optional) – The additional instrument information.
- Raises:
- ValueError – If tick_scheme_name is not a valid string.
- ValueError – If price_precision is negative (< 0).
- ValueError – If size_precision is negative (< 0).
- ValueError – If price_increment is not positive (> 0).
- ValueError – If size_increment is not positive (> 0).
- ValueError – If price_precision is not equal to price_increment.precision.
- ValueError – If size_increment is not equal to size_increment.precision.
- ValueError – If lot_size is not positive (> 0).
- ValueError – If max_quantity is not positive (> 0).
- ValueError – If min_quantity is negative (< 0).
- ValueError – If max_notional is not positive (> 0).
- ValueError – If min_notional is negative (< 0).
- ValueError – If max_price is not positive (> 0).
- ValueError – If min_price is negative (< 0).
static from_dict(dict values) → Commodity
Return an instrument from the given initialization values.
- Parameters: values (dict *[*str , object ]) – The values to initialize the instrument with.
- Return type: Commodity
static from_pyo3(pyo3_instrument)
isin
The instruments International Securities Identification Number (ISIN).
- Returns:
str or
None
static to_dict(Commodity obj) → dict[str, object]
Return a dictionary representation of this object.
- Return type: dict[str, object]
class CryptoFuture
Bases: Instrument
CryptoFuture(InstrumentId instrument_id, Symbol raw_symbol, Currency underlying, Currency quote_currency, Currency settlement_currency, bool is_inverse, uint64_t activation_ns, uint64_t expiration_ns, int price_precision, int size_precision, Price price_increment, Quantity size_increment, margin_init: Decimal, margin_maint: Decimal, maker_fee: Decimal, taker_fee: Decimal, uint64_t ts_event, uint64_t ts_init, multiplier=Quantity.from_int_c(1), lot_size=Quantity.from_int_c(1), Quantity max_quantity: Quantity | None = None, Quantity min_quantity: Quantity | None = None, Money max_notional: Money | None = None, Money min_notional: Money | None = None, Price max_price: Price | None = None, Price min_price: Price | None = None, dict info=None)
Represents a deliverable futures contract instrument, with crypto assets as underlying and for settlement.
- Parameters:
- instrument_id (InstrumentId) – The instrument ID for the instrument.
- raw_symbol (Symbol) – The raw/local/native symbol for the instrument, assigned by the venue.
- underlying (Currency) – The underlying asset.
- quote_currency (Currency) – The contract quote currency.
- settlement_currency (Currency) – The settlement currency.
- is_inverse (bool) – If the instrument costing is inverse (quantity expressed in quote currency units).
- activation_ns (uint64_t) – UNIX timestamp (nanoseconds) for contract activation.
- expiration_ns (uint64_t) – UNIX timestamp (nanoseconds) for contract expiration.
- price_precision (int) – The price decimal precision.
- size_precision (int) – The trading size decimal precision.
- price_increment (Price) – The minimum price increment (tick size).
- size_increment (Quantity) – The minimum size increment.
- margin_init (Decimal) – The initial (order) margin requirement in percentage of order value.
- margin_maint (Decimal) – The maintenance (position) margin in percentage of position value.
- maker_fee (Decimal) – The fee rate for liquidity makers as a percentage of order value.
- taker_fee (Decimal) – The fee rate for liquidity takers as a percentage of order value.
- ts_event (uint64_t) – UNIX timestamp (nanoseconds) when the data event occurred.
- ts_init (uint64_t) – UNIX timestamp (nanoseconds) when the data object was initialized.
- multiplier (Quantity , default 1) – The contract multiplier.
- lot_size (Quantity) – The rounded lot unit size (standard/board).
- max_quantity (Quantity , optional) – The maximum allowable order quantity.
- min_quantity (Quantity , optional) – The minimum allowable order quantity.
- max_notional (Money , optional) – The maximum allowable order notional value.
- min_notional (Money , optional) – The minimum allowable order notional value.
- max_price (Price , optional) – The maximum allowable quoted price.
- min_price (Price , optional) – The minimum allowable quoted price.
- info (dict *[*str , object ] , optional) – The additional instrument information.
- Raises:
- ValueError – If price_precision is negative (< 0).
- ValueError – If size_precision is negative (< 0).
- ValueError – If price_increment is not positive (> 0).
- ValueError – If size_increment is not positive (> 0).
- ValueError – If price_precision is not equal to price_increment.precision.
- ValueError – If size_increment is not equal to size_increment.precision.
- ValueError – If lot size is not positive (> 0).
- ValueError – If max_quantity is not positive (> 0).
- ValueError – If min_quantity is negative (< 0).
- ValueError – If max_notional is not positive (> 0).
- ValueError – If min_notional is negative (< 0).
- ValueError – If max_price is not positive (> 0).
- ValueError – If min_price is negative (< 0).