Skip to main content
Version: nightly

Identifiers

class AccountId

Bases: Identifier

AccountId(str value) -> None Represents a valid account ID.

Must be correctly formatted with two valid strings either side of a hyphen. It is expected an account ID is the name of the issuer with an account number separated by a hyphen.

Example: “IB-D02851908”.

  • Parameters: value (str) – The account ID value.
  • Raises: ValueError – If value is not a valid string containing a hyphen.

WARNING

The issuer and number ID combination must be unique at the firm level.

get_id(self) → str

Return the account ID without issuer name.

  • Return type: str

get_issuer(self) → str

Return the account issuer for this ID.

  • Return type: str

value

str Return the identifier (ID) value.

  • Return type: str
  • Type: Identifier.value

class ClientId

Bases: Identifier

ClientId(str value) -> None Represents a system client ID.

  • Parameters: value (str) – The client ID value.
  • Raises: ValueError – If value is not a valid string.

WARNING

The ID value must be unique at the trader level.

value

str Return the identifier (ID) value.

  • Return type: str
  • Type: Identifier.value

class ClientOrderId

Bases: Identifier

ClientOrderId(str value) -> None Represents a valid client order ID (assigned by the Nautilus system).

  • Parameters: value (str) – The client order ID value.
  • Raises: ValueError – If value is not a valid string.

WARNING

The ID value must be unique at the firm level.

value

str Return the identifier (ID) value.

  • Return type: str
  • Type: Identifier.value

class ComponentId

Bases: Identifier

ComponentId(str value) -> None Represents a valid component ID.

  • Parameters: value (str) – The component ID value.
  • Raises: ValueError – If value is not a valid string.

WARNING

The ID value must be unique at the trader level.

value

str Return the identifier (ID) value.

  • Return type: str
  • Type: Identifier.value

class ExecAlgorithmId

Bases: Identifier

ExecAlgorithmId(str value) -> None Represents a valid execution algorithm ID.

  • Parameters: value (str) – The execution algorithm ID value.
  • Raises: ValueError – If value is not a valid string.

value

str Return the identifier (ID) value.

  • Return type: str
  • Type: Identifier.value

class Identifier

Bases: object

The abstract base class for all identifiers.

value

str Return the identifier (ID) value.

  • Return type: str
  • Type: Identifier.value

class InstrumentId

Bases: Identifier

InstrumentId(Symbol symbol, Venue venue) -> None Represents a valid instrument ID.

The symbol and venue combination should uniquely identify the instrument.

  • Parameters:
    • symbol (Symbol) – The instruments ticker symbol.
    • venue (Venue) – The instruments trading venue.

static from_str(str value: str) → InstrumentId

Return an instrument ID parsed from the given string value. Must be correctly formatted including symbol and venue components either side of a single period.

Examples: ‘AUD/USD.IDEALPRO’, ‘BTCUSDT.BINANCE’

  • Parameters: value (str) – The instrument ID string value to parse.
  • Return type: InstrumentId
  • Raises: ValueError – If value is not a valid instrument ID string.

is_synthetic(self) → bool

Return whether the instrument ID is a synthetic instrument (with venue of ‘SYNTH’).

  • Return type: bool

symbol

Symbol Returns the instrument ticker symbol.

  • Return type: Symbol
  • Type: InstrumentId.symbol

value

str Return the identifier (ID) value.

  • Return type: str
  • Type: Identifier.value

venue

Venue Returns the instrument trading venue.

  • Return type: Venue
  • Type: InstrumentId.venue

class OrderListId

Bases: Identifier

OrderListId(str value) -> None Represents a valid order list ID (assigned by the Nautilus system).

  • Parameters: value (str) – The order list ID value.
  • Raises: ValueError – If value is not a valid string.

value

str Return the identifier (ID) value.

  • Return type: str
  • Type: Identifier.value

class PositionId

Bases: Identifier

PositionId(str value) -> None Represents a valid position ID.

  • Parameters: value (str) – The position ID value.
  • Raises: ValueError – If value is not a valid string containing a hyphen.

value

str Return the identifier (ID) value.

  • Return type: str
  • Type: Identifier.value

class StrategyId

Bases: Identifier

StrategyId(str value) -> None Represents a valid strategy ID.

Must be correctly formatted with two valid strings either side of a hyphen. It is expected a strategy ID is the class name of the strategy, with an order ID tag number separated by a hyphen.

Example: “EMACross-001”.

The reason for the numerical component of the ID is so that order and position IDs do not collide with those from another strategy within the node instance.

  • Parameters: value (str) – The strategy ID value.
  • Raises: ValueError – If value is not a valid string containing a hyphen.

WARNING

The name and tag combination must be unique at the trader level.

get_tag(self) → str

Return the order ID tag value for this ID.

  • Return type: str

is_external(self) → bool

If the strategy ID is the global ‘external’ strategy. This represents the strategy for all orders interacting with this instance of the system which did not originate from any strategy being managed by the system.

  • Return type: bool

value

str Return the identifier (ID) value.

  • Return type: str
  • Type: Identifier.value

class Symbol

Bases: Identifier

Symbol(str value) -> None Represents a valid ticker symbol ID for a tradable instrument.

  • Parameters: value (str) – The ticker symbol ID value.
  • Raises: ValueError – If value is not a valid string.

WARNING

The ID value must be unique for a trading venue.

is_composite(self) → bool

Returns true if the symbol string contains a period (‘.’).

  • Return type: str

root(self) → str

Return the symbol root.

The symbol root is the substring that appears before the first period (‘.’) in the full symbol string. It typically represents the underlying asset for futures and options contracts. If no period is found, the entire symbol string is considered the root.

  • Return type: str

topic(self) → str

Return the symbol topic.

The symbol topic is the root symbol with a wildcard ‘*’ appended if the symbol has a root, otherwise returns the full symbol string.

  • Return type: str

value

str Return the identifier (ID) value.

  • Return type: str
  • Type: Identifier.value

class TradeId

Bases: Identifier

TradeId(str value) -> None Represents a valid trade match ID (assigned by a trading venue).

Maximum length is 36 characters. Can correspond to the TradeID <1003> field of the FIX protocol.

The unique ID assigned to the trade entity once it is received or matched by the exchange or central counterparty.

  • Parameters: value (str) – The trade match ID value.
  • Raises:
    • ValueError – If value is not a valid string.
    • ValueError – If value length exceeds maximum 36 characters.

value

str Return the identifier (ID) value.

  • Return type: str
  • Type: Identifier.value

class TraderId

Bases: Identifier

TraderId(str value) -> None Represents a valid trader ID.

Must be correctly formatted with two valid strings either side of a hyphen. It is expected a trader ID is the abbreviated name of the trader with an order ID tag number separated by a hyphen.

Example: “TESTER-001”.

The reason for the numerical component of the ID is so that order and position IDs do not collide with those from another node instance.

  • Parameters: value (str) – The trader ID value.
  • Raises: ValueError – If value is not a valid string containing a hyphen.

WARNING

The name and tag combination ID value must be unique at the firm level.

get_tag(self) → str

Return the order ID tag value for this ID.

  • Return type: str

value

str Return the identifier (ID) value.

  • Return type: str
  • Type: Identifier.value

class Venue

Bases: Identifier

Venue(str name) -> None Represents a valid trading venue ID.

  • Parameters: name (str) – The venue ID value.
  • Raises: ValueError – If name is not a valid string.

static from_code(str code)

Return the venue with the given code from the built-in internal map (if found).

Currency only supports CME Globex exchange ISO 10383 MIC codes.

  • Parameters: code (str) – The code of the venue.
  • Return type: Venue or None

is_synthetic(self) → bool

Return whether the venue is synthetic (‘SYNTH’).

  • Return type: bool

value

str Return the identifier (ID) value.

  • Return type: str
  • Type: Identifier.value

class VenueOrderId

Bases: Identifier

VenueOrderId(str value) -> None Represents a valid venue order ID (assigned by a trading venue).

  • Parameters: value (str) – The venue assigned order ID value.
  • Raises: ValueError – If value is not a valid string.

value

str Return the identifier (ID) value.

  • Return type: str
  • Type: Identifier.value