Identifiers

class AccountId ( unicode value )

Bases: Identifier

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 ) unicode

Return the account ID without issuer name.

Returns :

str

get_issuer ( self ) unicode

Return the account issuer for this ID.

Returns :

str

value

str

Return the identifier (ID) value.

Returns :

str

Type :

Identifier.value

class ClientId ( unicode value )

Bases: Identifier

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.

Returns :

str

Type :

Identifier.value

class ClientOrderId ( unicode value )

Bases: Identifier

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.

is_this_trader ( self , TraderId trader_id ) bool

Return whether this client order ID is for the given trader ID instance.

Will compare the given trader_id.get_tag() with this identifier.

Parameters :

trader_id ( TraderId ) – The trader ID to compare with.

Returns :

bool – True if for this instance, else false.

value

str

Return the identifier (ID) value.

Returns :

str

Type :

Identifier.value

class ComponentId ( unicode value )

Bases: Identifier

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.

Returns :

str

Type :

Identifier.value

class ExecAlgorithmId ( unicode value )

Bases: Identifier

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.

Returns :

str

Type :

Identifier.value

class Identifier

Bases: object

The abstract base class for all identifiers.

value

str

Return the identifier (ID) value.

Returns :

str

Type :

Identifier.value

class InstrumentId ( Symbol symbol , Venue venue )

Bases: Identifier

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 ( unicode 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.

Returns :

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’).

Returns :

bool

symbol

Symbol

Returns the instrument ticker symbol.

Returns :

Symbol

Type :

InstrumentId.symbol

value

str

Return the identifier (ID) value.

Returns :

str

Type :

Identifier.value

venue

Venue

Returns the instrument trading venue.

Returns :

Venue

Type :

InstrumentId.venue

class OrderListId ( unicode value )

Bases: Identifier

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.

Returns :

str

Type :

Identifier.value

class PositionId ( unicode value )

Bases: Identifier

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.

Returns :

str

Type :

Identifier.value

class StrategyId ( unicode value )

Bases: Identifier

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 ) unicode

Return the order ID tag value for this ID.

Returns :

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.

Returns :

bool

value

str

Return the identifier (ID) value.

Returns :

str

Type :

Identifier.value

class Symbol ( unicode value )

Bases: Identifier

Represents a valid ticker symbol ID for a tradable financial market 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.

References

https://en.wikipedia.org/wiki/Ticker_symbol

value

str

Return the identifier (ID) value.

Returns :

str

Type :

Identifier.value

class TradeId ( unicode value )

Bases: Identifier

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.

References

https://www.onixs.biz/fix-dictionary/5.0/tagnum_1003.html

value

str

Return the identifier (ID) value.

Returns :

str

Type :

Identifier.value

class TraderId ( unicode value )

Bases: Identifier

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 ) unicode

Return the order ID tag value for this ID.

Returns :

str

value

str

Return the identifier (ID) value.

Returns :

str

Type :

Identifier.value

class Venue ( unicode name )

Bases: Identifier

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 ( unicode 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.

Returns :

Venue or None

is_synthetic ( self ) bool

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

Returns :

bool

value

str

Return the identifier (ID) value.

Returns :

str

Type :

Identifier.value

class VenueOrderId ( unicode value )

Bases: Identifier

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.

Returns :

str

Type :

Identifier.value