Skip to main content
Version: latest

Config

Backtest

parse_filters_expr(s: str | None)

Parse a pyarrow.dataset filter expression from a string.

>>> parse_filters_expr('field("Currency") == "CHF"')
<pyarrow.dataset.Expression (Currency == "CHF")>
>>> parse_filters_expr("print('hello')")
>>> parse_filters_expr("None")

class BacktestVenueConfig

Bases: NautilusConfig

Represents a venue configuration for one specific backtest engine.

  • Parameters:
    • name (str) – The name of the venue.
    • oms_type (str) – The order management system type for the exchange. If HEDGING will generate new position IDs.
    • account_type (str) – The account type for the exchange.
    • starting_balances (list *[*str ]) – The starting account balances (specify one for a single asset account).
    • base_currency (Currency , optional) – The account base currency for the exchange. Use None for multi-currency accounts.
    • default_leverage (float , optional) – The account default leverage (for margin accounts).
    • leverages (dict *[*str , float ] , optional) – The instrument specific leverage configuration (for margin accounts).
    • book_type (str) – The default order book type.
    • routing (bool , default False) – If multi-venue routing should be enabled for the execution client.
    • frozen_account (bool , default False) – If the account for this exchange is frozen (balances will not change).
    • bar_execution (bool , default True) – If bars should be processed by the matching engine(s) (and move the market).
    • reject_stop_orders (bool , default True) – If stop orders are rejected on submission if trigger price is in the market.
    • support_gtd_orders (bool , default True) – If orders with GTD time in force will be supported by the venue.
    • support_contingent_orders (bool , default True) – If contingent orders will be supported/respected by the venue. If False, then it’s expected the strategy will be managing any contingent orders.
    • use_position_ids (bool , default True) – If venue position IDs will be generated on order fills.
    • use_random_ids (bool , default False) – If all venue generated identifiers will be random UUID4’s.
    • use_reduce_only (bool , default True) – If the reduce_only execution instruction on orders will be honored.

name : str

oms_type : str

account_type : str

starting_balances : list[str]

base_currency : str | None

default_leverage : float

leverages : dict[str, float] | None

book_type : str

routing : bool

frozen_account : bool

bar_execution : bool

reject_stop_orders : bool

support_gtd_orders : bool

support_contingent_orders : bool

use_position_ids : bool

use_random_ids : bool

use_reduce_only : bool

modules : list[ImportableActorConfig] | None

dict() → dict[str, Any]

Return a dictionary representation of the configuration.

  • Return type: dict[str, Any]

classmethod fully_qualified_name() → str

Return the fully qualified name for the NautilusConfig class.

  • Return type: str

property id : str

Return the hashed identifier for the configuration.

  • Return type: str

json() → bytes

Return serialized JSON encoded bytes.

  • Return type: bytes

json_primitives() → dict[str, Any]

Return a dictionary representation of the configuration with JSON primitive types as values.

  • Return type: dict[str, Any]

classmethod parse(raw: bytes | str) → Any

Return a decoded object of the given cls.

  • Parameters:
    • cls (type) – The type to decode to.
    • raw (bytes or str) – The raw bytes or JSON string to decode.
  • Return type: Any

validate() → bool

Return whether the configuration can be represented as valid JSON.

  • Return type: bool

class BacktestDataConfig

Bases: NautilusConfig

Represents the data configuration for one specific backtest run.

  • Parameters:
    • catalog_path (str) – The path to the data catalog.
    • data_cls (str) – The data type for the configuration.
    • catalog_fs_protocol (str , optional) – The fsspec filesystem protocol for the catalog.
    • catalog_fs_storage_options (dict , optional) – The fsspec storage options.
    • instrument_id (InstrumentId , optional) – The instrument ID for the data configuration.
    • start_time (str or int , optional) – The start time for the data configuration. Can be an ISO 8601 format datetime string, or UNIX nanoseconds integer.
    • end_time (str or int , optional) – The end time for the data configuration. Can be an ISO 8601 format datetime string, or UNIX nanoseconds integer.
    • filter_expr (str , optional) – The additional filter expressions for the data catalog query.
    • client_id (str , optional) – The client ID for the data configuration.
    • metadata (dict , optional) – The metadata for the data catalog query.
    • bar_spec (str , optional) – The bar specification for the data catalog query.

catalog_path : str

data_cls : str

catalog_fs_protocol : str | None

catalog_fs_storage_options : dict | None

instrument_id : InstrumentId | None

start_time : str | int | None

end_time : str | int | None

filter_expr : str | None

client_id : str | None

metadata : dict | None

bar_spec : str | None

property data_type : type

Return a type for the specified data_cls for the configuration.

  • Return type: type

property query : dict[str, Any]

Return a catalog query object for the configuration.

  • Return type: dict[str, Any]

property start_time_nanos : int

Return the data configuration start time in UNIX nanoseconds.

Will be zero if no start_time was specified.

  • Return type: int

property end_time_nanos : int

Return the data configuration end time in UNIX nanoseconds.

Will be sys.maxsize if no end_time was specified.

  • Return type: int

dict() → dict[str, Any]

Return a dictionary representation of the configuration.

  • Return type: dict[str, Any]

classmethod fully_qualified_name() → str

Return the fully qualified name for the NautilusConfig class.

  • Return type: str

property id : str

Return the hashed identifier for the configuration.

  • Return type: str

json() → bytes

Return serialized JSON encoded bytes.

  • Return type: bytes

json_primitives() → dict[str, Any]

Return a dictionary representation of the configuration with JSON primitive types as values.

  • Return type: dict[str, Any]

classmethod parse(raw: bytes | str) → Any

Return a decoded object of the given cls.

  • Parameters:
    • cls (type) – The type to decode to.
    • raw (bytes or str) – The raw bytes or JSON string to decode.
  • Return type: Any

validate() → bool

Return whether the configuration can be represented as valid JSON.

  • Return type: bool

class BacktestEngineConfig

Bases: NautilusKernelConfig

Configuration for BacktestEngine instances.

  • Parameters:
    • trader_id (TraderId) – The trader ID for the node (must be a name and ID tag separated by a hyphen).
    • log_level (str , default "INFO") – The stdout log level for the node.
    • loop_debug (bool , default False) – If the asyncio event loop should be in debug mode.
    • cache (CacheConfig , optional) – The cache configuration.
    • data_engine (DataEngineConfig , optional) – The live data engine configuration.
    • risk_engine (RiskEngineConfig , optional) – The live risk engine configuration.
    • exec_engine (ExecEngineConfig , optional) – The live execution engine configuration.
    • streaming (StreamingConfig , optional) – The configuration for streaming to feather files.
    • strategies (list [ImportableStrategyConfig ]) – The strategy configurations for the kernel.
    • actors (list [ImportableActorConfig ]) – The actor configurations for the kernel.
    • exec_algorithms (list [ImportableExecAlgorithmConfig ]) – The execution algorithm configurations for the kernel.
    • controller (ImportableControllerConfig , optional) – The trader controller for the kernel.
    • load_state (bool , default True) – If trading strategy state should be loaded from the database on start.
    • save_state (bool , default True) – If trading strategy state should be saved to the database on stop.
    • bypass_logging (bool , default False) – If logging should be bypassed.
    • run_analysis (bool , default True) – If post backtest performance analysis should be run.

environment : Environment

trader_id : TraderId

data_engine : DataEngineConfig

risk_engine : RiskEngineConfig

exec_engine : ExecEngineConfig

run_analysis : bool

actors : list[ImportableActorConfig]

cache : CacheConfig | None

catalogs : list[DataCatalogConfig]

controller : ImportableControllerConfig | None

dict() → dict[str, Any]

Return a dictionary representation of the configuration.

  • Return type: dict[str, Any]

emulator : OrderEmulatorConfig | None

exec_algorithms : list[ImportableExecAlgorithmConfig]

classmethod fully_qualified_name() → str

Return the fully qualified name for the NautilusConfig class.

  • Return type: str

property id : str

Return the hashed identifier for the configuration.

  • Return type: str

instance_id : UUID4 | None

json() → bytes

Return serialized JSON encoded bytes.

  • Return type: bytes

json_primitives() → dict[str, Any]

Return a dictionary representation of the configuration with JSON primitive types as values.

  • Return type: dict[str, Any]

load_state : bool

logging : LoggingConfig | None

loop_debug : bool

message_bus : MessageBusConfig | None

classmethod parse(raw: bytes | str) → Any

Return a decoded object of the given cls.

  • Parameters:
    • cls (type) – The type to decode to.
    • raw (bytes or str) – The raw bytes or JSON string to decode.
  • Return type: Any

save_state : bool

strategies : list[ImportableStrategyConfig]

streaming : StreamingConfig | None

timeout_connection : PositiveFloat

timeout_disconnection : PositiveFloat

timeout_portfolio : PositiveFloat

timeout_post_stop : PositiveFloat

timeout_reconciliation : PositiveFloat

validate() → bool

Return whether the configuration can be represented as valid JSON.

  • Return type: bool

class BacktestRunConfig

Bases: NautilusConfig

Represents the configuration for one specific backtest run.

This includes a backtest engine with its actors and strategies, with the external inputs of venues and data.

  • Parameters:
    • venues (list [BacktestVenueConfig ]) – The venue configurations for the backtest run.
    • data (list [BacktestDataConfig ]) – The data configurations for the backtest run.
    • engine (BacktestEngineConfig) – The backtest engine configuration (the core system kernel).
    • chunk_size (int , optional) – The number of data points to process in each chunk during streaming mode. If None, the backtest will run without streaming, loading all data at once.
    • dispose_on_completion (bool , default True) – If the backtest engine should be disposed on completion of the run. If True, then will drop data and all state. If False, then will only drop data.
    • start (datetime or str or int , optional) – The start datetime (UTC) for the backtest run. If None engine runs from the start of the data.
    • end (datetime or str or int , optional) – The end datetime (UTC) for the backtest run. If None engine runs to the end of the data.

venues : list[BacktestVenueConfig]

data : list[BacktestDataConfig]

engine : BacktestEngineConfig | None

chunk_size : int | None

dispose_on_completion : bool

start : str | int | None

end : str | int | None

dict() → dict[str, Any]

Return a dictionary representation of the configuration.

  • Return type: dict[str, Any]

classmethod fully_qualified_name() → str

Return the fully qualified name for the NautilusConfig class.

  • Return type: str

property id : str

Return the hashed identifier for the configuration.

  • Return type: str

json() → bytes

Return serialized JSON encoded bytes.

  • Return type: bytes

json_primitives() → dict[str, Any]

Return a dictionary representation of the configuration with JSON primitive types as values.

  • Return type: dict[str, Any]

classmethod parse(raw: bytes | str) → Any

Return a decoded object of the given cls.

  • Parameters:
    • cls (type) – The type to decode to.
    • raw (bytes or str) – The raw bytes or JSON string to decode.
  • Return type: Any

validate() → bool

Return whether the configuration can be represented as valid JSON.

  • Return type: bool

class SimulationModuleConfig

Bases: ActorConfig

Configuration for SimulationModule instances.

component_id : ComponentId | None

dict() → dict[str, Any]

Return a dictionary representation of the configuration.

  • Return type: dict[str, Any]

classmethod fully_qualified_name() → str

Return the fully qualified name for the NautilusConfig class.

  • Return type: str

property id : str

Return the hashed identifier for the configuration.

  • Return type: str

json() → bytes

Return serialized JSON encoded bytes.

  • Return type: bytes

json_primitives() → dict[str, Any]

Return a dictionary representation of the configuration with JSON primitive types as values.

  • Return type: dict[str, Any]

classmethod parse(raw: bytes | str) → Any

Return a decoded object of the given cls.

  • Parameters:
    • cls (type) – The type to decode to.
    • raw (bytes or str) – The raw bytes or JSON string to decode.
  • Return type: Any

validate() → bool

Return whether the configuration can be represented as valid JSON.

  • Return type: bool

class FXRolloverInterestConfig

Bases: SimulationModuleConfig

Provides an FX rollover interest simulation module.

  • Parameters: rate_data (pd.DataFrame) – The interest rate data for the internal rollover interest calculator.

rate_data : pd.DataFrame

component_id : ComponentId | None

dict() → dict[str, Any]

Return a dictionary representation of the configuration.

  • Return type: dict[str, Any]

classmethod fully_qualified_name() → str

Return the fully qualified name for the NautilusConfig class.

  • Return type: str

property id : str

Return the hashed identifier for the configuration.

  • Return type: str

json() → bytes

Return serialized JSON encoded bytes.

  • Return type: bytes

json_primitives() → dict[str, Any]

Return a dictionary representation of the configuration with JSON primitive types as values.

  • Return type: dict[str, Any]

classmethod parse(raw: bytes | str) → Any

Return a decoded object of the given cls.

  • Parameters:
    • cls (type) – The type to decode to.
    • raw (bytes or str) – The raw bytes or JSON string to decode.
  • Return type: Any

validate() → bool

Return whether the configuration can be represented as valid JSON.

  • Return type: bool

Cache

class CacheConfig

Bases: NautilusConfig

Configuration for Cache instances.

  • Parameters:
    • database (DatabaseConfig , optional) – The configuration for the cache backing database.
    • encoding (str , {'msgpack' , 'json'} , default 'msgpack') – The encoding for database operations, controls the type of serializer used.
    • timestamps_as_iso8601 – If timestamps should be persisted as ISO 8601 strings. If False then will persit as UNIX nanoseconds.
    • False (default) – If timestamps should be persisted as ISO 8601 strings. If False then will persit as UNIX nanoseconds.
    • buffer_interval_ms (PositiveInt , optional) – The buffer interval (milliseconds) between pipelined/batched transactions. The recommended range if using buffered pipeling is [10, 1000] milliseconds, with a good compromise being 100 milliseconds.
    • use_trader_prefix (bool , default True) – If a ‘trader-’ prefix is used for keys.
    • use_instance_id (bool , default False) – If the traders instance ID is used for keys.
    • flush_on_start (bool , default False) – If database should be flushed on start.
    • drop_instruments_on_reset (bool , default True) – If instruments data should be dropped from the caches memory on reset.
    • tick_capacity (PositiveInt , default 10_000) – The maximum length for internal tick dequeues.
    • bar_capacity (PositiveInt , default 10_000) – The maximum length for internal bar dequeues.

database : DatabaseConfig | None

encoding : str

timestamps_as_iso8601 : bool

buffer_interval_ms : Annotated[int, msgspec.Meta(gt=0)] | None

use_trader_prefix : bool

use_instance_id : bool

flush_on_start : bool

drop_instruments_on_reset : bool

tick_capacity : Annotated[int, msgspec.Meta(gt=0)]

bar_capacity : Annotated[int, msgspec.Meta(gt=0)]

dict() → dict[str, Any]

Return a dictionary representation of the configuration.

  • Return type: dict[str, Any]

classmethod fully_qualified_name() → str

Return the fully qualified name for the NautilusConfig class.

  • Return type: str

property id : str

Return the hashed identifier for the configuration.

  • Return type: str

json() → bytes

Return serialized JSON encoded bytes.

  • Return type: bytes

json_primitives() → dict[str, Any]

Return a dictionary representation of the configuration with JSON primitive types as values.

  • Return type: dict[str, Any]

classmethod parse(raw: bytes | str) → Any

Return a decoded object of the given cls.

  • Parameters:
    • cls (type) – The type to decode to.
    • raw (bytes or str) – The raw bytes or JSON string to decode.
  • Return type: Any

validate() → bool

Return whether the configuration can be represented as valid JSON.

  • Return type: bool

Common

exception InvalidConfiguration

Bases: RuntimeError

Raised when there is a violation of a configuration condition, making it invalid.

add_note()

Exception.add_note(note) – add a note to the exception

args

with_traceback()

Exception.with_traceback(tb) – set self._traceback_ to tb and return self.

resolve_path(path: str) → type

resolve_config_path(path: str) → type[NautilusConfig]

msgspec_encoding_hook(obj: Any) → Any

msgspec_decoding_hook(obj_type: type, obj: Any) → Any

register_config_encoding(type_: type, encoder: Callable) → None

register_config_decoding(type_: type, decoder: Callable) → None

tokenize_config(obj: NautilusConfig) → str

class NautilusConfig

Bases: Struct

The base class for all Nautilus configuration objects.

property id : str

Return the hashed identifier for the configuration.

  • Return type: str

classmethod fully_qualified_name() → str

Return the fully qualified name for the NautilusConfig class.

  • Return type: str

classmethod parse(raw: bytes | str) → Any

Return a decoded object of the given cls.

  • Parameters:
    • cls (type) – The type to decode to.
    • raw (bytes or str) – The raw bytes or JSON string to decode.
  • Return type: Any

dict() → dict[str, Any]

Return a dictionary representation of the configuration.

  • Return type: dict[str, Any]

json() → bytes

Return serialized JSON encoded bytes.

  • Return type: bytes

json_primitives() → dict[str, Any]

Return a dictionary representation of the configuration with JSON primitive types as values.

  • Return type: dict[str, Any]

validate() → bool

Return whether the configuration can be represented as valid JSON.

  • Return type: bool

class DatabaseConfig

Bases: NautilusConfig

Configuration for database connections.

  • Parameters:
    • type (str , {'redis'} , default 'redis') – The database type.
    • host (str , optional) – The database host address. If None then should use the typical default.
    • port (int , optional) – The database port. If None then should use the typical default.
    • username (str , optional) – The account username for the database connection.
    • password (str , optional) – The account password for the database connection. If a value is provided then it will be redacted in the string repr for this object.
    • ssl (bool , default False) – If database should use an SSL enabled connection.
    • timeout (int , default 20) – The timeout (seconds) to wait for a new connection.

type : str

host : str | None

port : int | None

username : str | None

password : str | None

ssl : bool

timeout : int | None

dict() → dict[str, Any]

Return a dictionary representation of the configuration.

  • Return type: dict[str, Any]

classmethod fully_qualified_name() → str

Return the fully qualified name for the NautilusConfig class.

  • Return type: str

property id : str

Return the hashed identifier for the configuration.

  • Return type: str

json() → bytes

Return serialized JSON encoded bytes.

  • Return type: bytes

json_primitives() → dict[str, Any]

Return a dictionary representation of the configuration with JSON primitive types as values.

  • Return type: dict[str, Any]

classmethod parse(raw: bytes | str) → Any

Return a decoded object of the given cls.

  • Parameters:
    • cls (type) – The type to decode to.
    • raw (bytes or str) – The raw bytes or JSON string to decode.
  • Return type: Any

validate() → bool

Return whether the configuration can be represented as valid JSON.

  • Return type: bool

class MessageBusConfig

Bases: NautilusConfig

Configuration for MessageBus instances.

  • Parameters:
    • database (DatabaseConfig , optional) – The configuration for the message bus backing database.
    • encoding (str , {'msgpack' , 'json'} , default 'msgpack') – The encoding for database operations, controls the type of serializer used.
    • timestamps_as_iso8601 – If timestamps should be persisted as ISO 8601 strings. If False then will persit as UNIX nanoseconds.
    • False (default) – If timestamps should be persisted as ISO 8601 strings. If False then will persit as UNIX nanoseconds.
    • buffer_interval_ms (PositiveInt , optional) – The buffer interval (milliseconds) between pipelined/batched transactions. The recommended range if using buffered pipeling is [10, 1000] milliseconds, with a good compromise being 100 milliseconds.
    • autotrim_mins (int , optional) – The lookback window in minutes for automatic stream trimming. The actual window may extend up to one minute beyond the specified value since streams are trimmed at most once every minute. Note that this feature requires Redis version 6.2 or higher; otherwise it will result in a command syntax error.
    • use_trader_prefix (bool , default True) – If a ‘trader-’ prefix is used for stream names.
    • use_trader_id (bool , default True) – If the traders ID is used for stream names.
    • use_instance_id (bool , default False) – If the traders instance ID is used for stream names.
    • streams_prefix (str , default 'stream') – The prefix for externally published stream names (must have a database config). If use_trader_id and use_instance_id are both false, then it becomes possible for many traders to be configured to write to the same streams.
    • stream_per_topic (bool , default True) – If True, messages will be written to separate streams per topic. If False, all messages will be written to the same stream.
    • external_streams (list *[*str ] , optional) – The external stream keys the node will listen to for publishing deserialized message payloads on the internal message bus.
    • types_filter (list *[*type ] , optional) – A list of serializable types not to publish externally.
    • heartbeat_interval_secs (PositiveInt , optional) – The heartbeat interval (seconds) to use for trading node health.

database : DatabaseConfig | None

encoding : str

timestamps_as_iso8601 : bool

buffer_interval_ms : Annotated[int, msgspec.Meta(gt=0)] | None

autotrim_mins : int | None

use_trader_prefix : bool

use_trader_id : bool

use_instance_id : bool

streams_prefix : str

stream_per_topic : bool

external_streams : list[str] | None

types_filter : list[type] | None

heartbeat_interval_secs : Annotated[int, msgspec.Meta(gt=0)] | None

dict() → dict[str, Any]

Return a dictionary representation of the configuration.

  • Return type: dict[str, Any]

classmethod fully_qualified_name() → str

Return the fully qualified name for the NautilusConfig class.

  • Return type: str

property id : str

Return the hashed identifier for the configuration.

  • Return type: str

json() → bytes

Return serialized JSON encoded bytes.

  • Return type: bytes

json_primitives() → dict[str, Any]

Return a dictionary representation of the configuration with JSON primitive types as values.

  • Return type: dict[str, Any]

classmethod parse(raw: bytes | str) → Any

Return a decoded object of the given cls.

  • Parameters:
    • cls (type) – The type to decode to.
    • raw (bytes or str) – The raw bytes or JSON string to decode.
  • Return type: Any

validate() → bool

Return whether the configuration can be represented as valid JSON.

  • Return type: bool

class InstrumentProviderConfig

Bases: NautilusConfig

Configuration for InstrumentProvider instances.

  • Parameters:
    • load_all (bool , default False) – If all venue instruments should be loaded on start.
    • load_ids (frozenset [InstrumentId ] , optional) – The list of instrument IDs to be loaded on start (if load_all_instruments is False).
    • filters (frozendict or dict *[*str , Any ] , optional) – The venue specific instrument loading filters to apply.
    • filter_callable (str , optional) – A fully qualified path to a callable that takes a single argument, instrument and returns a bool, indicating whether the instrument should be loaded
    • log_warnings (bool , default True) – If parser warnings should be logged.

load_all : bool

load_ids : frozenset[InstrumentId] | None

filters : dict[str, Any] | None

filter_callable : str | None

log_warnings : bool

dict() → dict[str, Any]

Return a dictionary representation of the configuration.

  • Return type: dict[str, Any]

classmethod fully_qualified_name() → str

Return the fully qualified name for the NautilusConfig class.

  • Return type: str

property id : str

Return the hashed identifier for the configuration.

  • Return type: str

json() → bytes

Return serialized JSON encoded bytes.

  • Return type: bytes

json_primitives() → dict[str, Any]

Return a dictionary representation of the configuration with JSON primitive types as values.

  • Return type: dict[str, Any]

classmethod parse(raw: bytes | str) → Any

Return a decoded object of the given cls.

  • Parameters:
    • cls (type) – The type to decode to.
    • raw (bytes or str) – The raw bytes or JSON string to decode.
  • Return type: Any

validate() → bool

Return whether the configuration can be represented as valid JSON.

  • Return type: bool

class OrderEmulatorConfig

Bases: NautilusConfig

Configuration for OrderEmulator instances.

  • Parameters: debug (bool , default False) – If debug mode is active (will provide extra debug logging).

debug : bool

dict() → dict[str, Any]

Return a dictionary representation of the configuration.

  • Return type: dict[str, Any]

classmethod fully_qualified_name() → str

Return the fully qualified name for the NautilusConfig class.

  • Return type: str

property id : str

Return the hashed identifier for the configuration.

  • Return type: str

json() → bytes

Return serialized JSON encoded bytes.

  • Return type: bytes

json_primitives() → dict[str, Any]

Return a dictionary representation of the configuration with JSON primitive types as values.

  • Return type: dict[str, Any]

classmethod parse(raw: bytes | str) → Any

Return a decoded object of the given cls.

  • Parameters:
    • cls (type) – The type to decode to.
    • raw (bytes or str) – The raw bytes or JSON string to decode.
  • Return type: Any

validate() → bool

Return whether the configuration can be represented as valid JSON.

  • Return type: bool

class ActorConfig

Bases: NautilusConfig

The base model for all actor configurations.

  • Parameters: component_id (ComponentId , optional) – The component ID. If None then the identifier will be taken from type(self)._name_.

component_id : ComponentId | None

dict() → dict[str, Any]

Return a dictionary representation of the configuration.

  • Return type: dict[str, Any]

classmethod fully_qualified_name() → str

Return the fully qualified name for the NautilusConfig class.

  • Return type: str

property id : str

Return the hashed identifier for the configuration.

  • Return type: str

json() → bytes

Return serialized JSON encoded bytes.

  • Return type: bytes

json_primitives() → dict[str, Any]

Return a dictionary representation of the configuration with JSON primitive types as values.

  • Return type: dict[str, Any]

classmethod parse(raw: bytes | str) → Any

Return a decoded object of the given cls.

  • Parameters:
    • cls (type) – The type to decode to.
    • raw (bytes or str) – The raw bytes or JSON string to decode.
  • Return type: Any

validate() → bool

Return whether the configuration can be represented as valid JSON.

  • Return type: bool

class ImportableActorConfig

Bases: NautilusConfig

Configuration for an actor instance.

  • Parameters:
    • actor_path (str) – The fully qualified name of the Actor class.
    • config_path (str) – The fully qualified name of the Actor Config class.
    • config (dict) – The actor configuration.

actor_path : str

config_path : str

config : dict

dict() → dict[str, Any]

Return a dictionary representation of the configuration.

  • Return type: dict[str, Any]

classmethod fully_qualified_name() → str

Return the fully qualified name for the NautilusConfig class.

  • Return type: str

property id : str

Return the hashed identifier for the configuration.

  • Return type: str

json() → bytes

Return serialized JSON encoded bytes.

  • Return type: bytes

json_primitives() → dict[str, Any]

Return a dictionary representation of the configuration with JSON primitive types as values.

  • Return type: dict[str, Any]

classmethod parse(raw: bytes | str) → Any

Return a decoded object of the given cls.

  • Parameters:
    • cls (type) – The type to decode to.
    • raw (bytes or str) – The raw bytes or JSON string to decode.
  • Return type: Any

validate() → bool

Return whether the configuration can be represented as valid JSON.

  • Return type: bool

class ActorFactory

Bases: object

Provides actor creation from importable configurations.

static create(config: ImportableActorConfig)

Create an actor from the given configuration.

  • Parameters: config (ImportableActorConfig) – The configuration for the building step.
  • Return type: Actor
  • Raises: TypeError – If config is not of type ImportableActorConfig.

class LoggingConfig

Bases: NautilusConfig

Configuration for standard output and file logging for a NautilusKernel instance.

  • Parameters:
    • log_level (str , default "INFO") – The minimum log level to write to stdout. Will always write ERROR level logs to stderr (unless bypass_logging is True).
    • log_level_file (str , optional) – The minimum log level to write to a log file. If None then no file logging will occur.
    • log_directory (str , optional) – The path to the log file directory. If None then will write to the current working directory.
    • log_file_name (str , optional) – The custom log file name (will use a ‘.log’ suffix for plain text or ‘.json’ for JSON). This will override automatic naming, and no daily file rotation will occur.
    • log_file_format (str { 'JSON' } , optional) – The log file format. If None (default) then will log in plain text.
    • log_colors (bool , default True) – If ANSI codes should be used to produce colored log lines.
    • log_component_levels (dict *[*str , LogLevel ]) – The additional per component log level filters, where keys are component IDs (e.g. actor/strategy IDs) and values are log levels.
    • bypass_logging (bool , default False) – If all logging should be bypassed.
    • print_config (bool , default False) – If the core logging configuration should be printed to stdout at initialization.
    • use_pyo3 (bool , default False) – If the logging system should be initialized via pyo3, this isn’t recommended for backtesting as the performance is much lower but can be useful for seeing logs originating from Rust.
    • clear_log_file (bool , default False) – If the log file name should be cleared before being used (e.g. for testing). Only applies if log_file_name is not None.

log_level : str

log_level_file : str | None

log_directory : str | None

log_file_name : str | None

log_file_format : str | None

log_colors : bool

log_component_levels : dict[str, str] | None

bypass_logging : bool

use_pyo3 : bool

clear_log_file : bool

dict() → dict[str, Any]

Return a dictionary representation of the configuration.

  • Return type: dict[str, Any]

classmethod fully_qualified_name() → str

Return the fully qualified name for the NautilusConfig class.

  • Return type: str

property id : str

Return the hashed identifier for the configuration.

  • Return type: str

json() → bytes

Return serialized JSON encoded bytes.

  • Return type: bytes

json_primitives() → dict[str, Any]

Return a dictionary representation of the configuration with JSON primitive types as values.

  • Return type: dict[str, Any]

classmethod parse(raw: bytes | str) → Any

Return a decoded object of the given cls.

  • Parameters:
    • cls (type) – The type to decode to.
    • raw (bytes or str) – The raw bytes or JSON string to decode.
  • Return type: Any

validate() → bool

Return whether the configuration can be represented as valid JSON.

  • Return type: bool

class ImportableFactoryConfig

Bases: NautilusConfig

Represents an importable (JSON) factory config.

path : str

create()

dict() → dict[str, Any]

Return a dictionary representation of the configuration.

  • Return type: dict[str, Any]

classmethod fully_qualified_name() → str

Return the fully qualified name for the NautilusConfig class.

  • Return type: str

property id : str

Return the hashed identifier for the configuration.

  • Return type: str

json() → bytes

Return serialized JSON encoded bytes.

  • Return type: bytes

json_primitives() → dict[str, Any]

Return a dictionary representation of the configuration with JSON primitive types as values.

  • Return type: dict[str, Any]

classmethod parse(raw: bytes | str) → Any

Return a decoded object of the given cls.

  • Parameters:
    • cls (type) – The type to decode to.
    • raw (bytes or str) – The raw bytes or JSON string to decode.
  • Return type: Any

validate() → bool

Return whether the configuration can be represented as valid JSON.

  • Return type: bool

class ImportableConfig

Bases: NautilusConfig

Represents an importable configuration (typically live data client or live execution client).

path : str

config : dict

factory : ImportableFactoryConfig | None

static is_importable(data: dict) → bool

create()

dict() → dict[str, Any]

Return a dictionary representation of the configuration.

  • Return type: dict[str, Any]

classmethod fully_qualified_name() → str

Return the fully qualified name for the NautilusConfig class.

  • Return type: str

property id : str

Return the hashed identifier for the configuration.

  • Return type: str

json() → bytes

Return serialized JSON encoded bytes.

  • Return type: bytes

json_primitives() → dict[str, Any]

Return a dictionary representation of the configuration with JSON primitive types as values.

  • Return type: dict[str, Any]

classmethod parse(raw: bytes | str) → Any

Return a decoded object of the given cls.

  • Parameters:
    • cls (type) – The type to decode to.
    • raw (bytes or str) – The raw bytes or JSON string to decode.
  • Return type: Any

validate() → bool

Return whether the configuration can be represented as valid JSON.

  • Return type: bool

Data

class DataEngineConfig

Bases: NautilusConfig

Configuration for DataEngine instances.

  • Parameters:
    • time_bars_build_with_no_updates (bool , default True) – If time bar aggregators will build and emit bars with no new market updates.
    • time_bars_timestamp_on_close (bool , default True) – If time bar aggregators will timestamp ts_event on bar close. If False, then will timestamp on bar open.
    • time_bars_interval_type (str , default 'left-open') – Determines the type of interval used for time aggregation.
      • ‘left-open’: start time is excluded and end time is included (default).
      • ‘right-open’: start time is included and end time is excluded.
    • time_bars_origins (dict [BarAggregation , pd.Timedelta | pd.DateOffset ] , optional) – A dictionary mapping time bar aggregations to their origin time offsets.
    • validate_data_sequence (bool , default False) – If data objects timestamp sequencing will be validated and handled.
    • buffer_deltas (bool , default False) – If order book deltas should be buffered until the F_LAST flag is set for a delta.
    • external_clients (list [ClientId ] , optional) – The client IDs declared for external stream processing. The data engine will not attempt to send data commands to these client IDs.
    • debug (bool , default False) – If debug mode is active (will provide extra debug logging).

time_bars_build_with_no_updates : bool

time_bars_timestamp_on_close : bool

time_bars_interval_type : str

time_bars_origins : dict | None

validate_data_sequence : bool

buffer_deltas : bool

external_clients : list[ClientId] | None

debug : bool

dict() → dict[str, Any]

Return a dictionary representation of the configuration.

  • Return type: dict[str, Any]

classmethod fully_qualified_name() → str

Return the fully qualified name for the NautilusConfig class.

  • Return type: str

property id : str

Return the hashed identifier for the configuration.

  • Return type: str

json() → bytes

Return serialized JSON encoded bytes.

  • Return type: bytes

json_primitives() → dict[str, Any]

Return a dictionary representation of the configuration with JSON primitive types as values.

  • Return type: dict[str, Any]

classmethod parse(raw: bytes | str) → Any

Return a decoded object of the given cls.

  • Parameters:
    • cls (type) – The type to decode to.
    • raw (bytes or str) – The raw bytes or JSON string to decode.
  • Return type: Any

validate() → bool

Return whether the configuration can be represented as valid JSON.

  • Return type: bool

Execution

class ExecEngineConfig

Bases: NautilusConfig

Configuration for ExecutionEngine instances.

  • Parameters:
    • load_cache (bool , default True) – If the cache should be loaded on initialization.
    • snapshot_orders (bool , default False) – If order state snapshot lists are persisted to a backing database. Snapshots will be taken at every order state update (when events are applied).
    • snapshot_positions (bool , default False) – If position state snapshot lists are persisted to a backing database. Snapshots will be taken at position opened, changed and closed (when events are applied). To include the unrealized PnL in the snapshot then quotes for the positions instrument must be available in the cache.
    • snapshot_positions_interval_secs (PositiveFloat , optional) – The interval (seconds) at which additional position state snapshots are persisted to a backing database. If None then no additional snapshots will be taken. To include unrealized PnL in these snapshots, quotes for the position’s instrument must be available in the cache.
    • debug (bool , default False) – If debug mode is active (will provide extra debug logging).

load_cache : bool

snapshot_orders : bool

snapshot_positions : bool

snapshot_positions_interval_secs : Annotated[float, msgspec.Meta(gt=0.0)] | None

debug : bool

dict() → dict[str, Any]

Return a dictionary representation of the configuration.

  • Return type: dict[str, Any]

classmethod fully_qualified_name() → str

Return the fully qualified name for the NautilusConfig class.

  • Return type: str

property id : str

Return the hashed identifier for the configuration.

  • Return type: str

json() → bytes

Return serialized JSON encoded bytes.

  • Return type: bytes

json_primitives() → dict[str, Any]

Return a dictionary representation of the configuration with JSON primitive types as values.

  • Return type: dict[str, Any]

classmethod parse(raw: bytes | str) → Any

Return a decoded object of the given cls.

  • Parameters:
    • cls (type) – The type to decode to.
    • raw (bytes or str) – The raw bytes or JSON string to decode.
  • Return type: Any

validate() → bool

Return whether the configuration can be represented as valid JSON.

  • Return type: bool

class ExecAlgorithmConfig

Bases: NautilusConfig

The base model for all execution algorithm configurations.

  • Parameters: exec_algorithm_id (ExecAlgorithmId , optional) – The unique ID for the execution algorithm. If not None then will become the execution algorithm ID.

exec_algorithm_id : ExecAlgorithmId | None

dict() → dict[str, Any]

Return a dictionary representation of the configuration.

  • Return type: dict[str, Any]

classmethod fully_qualified_name() → str

Return the fully qualified name for the NautilusConfig class.

  • Return type: str

property id : str

Return the hashed identifier for the configuration.

  • Return type: str

json() → bytes

Return serialized JSON encoded bytes.

  • Return type: bytes

json_primitives() → dict[str, Any]

Return a dictionary representation of the configuration with JSON primitive types as values.

  • Return type: dict[str, Any]

classmethod parse(raw: bytes | str) → Any

Return a decoded object of the given cls.

  • Parameters:
    • cls (type) – The type to decode to.
    • raw (bytes or str) – The raw bytes or JSON string to decode.
  • Return type: Any

validate() → bool

Return whether the configuration can be represented as valid JSON.

  • Return type: bool

class ImportableExecAlgorithmConfig

Bases: NautilusConfig

Configuration for an execution algorithm instance.

  • Parameters:
    • exec_algorithm_path (str) – The fully qualified name of the execution algorithm class.
    • config_path (str) – The fully qualified name of the config class.
    • config (dict *[*str , Any ]) – The execution algorithm configuration.

exec_algorithm_path : str

config_path : str

config : dict[str, Any]

dict() → dict[str, Any]

Return a dictionary representation of the configuration.

  • Return type: dict[str, Any]

classmethod fully_qualified_name() → str

Return the fully qualified name for the NautilusConfig class.

  • Return type: str

property id : str

Return the hashed identifier for the configuration.

  • Return type: str

json() → bytes

Return serialized JSON encoded bytes.

  • Return type: bytes

json_primitives() → dict[str, Any]

Return a dictionary representation of the configuration with JSON primitive types as values.

  • Return type: dict[str, Any]

classmethod parse(raw: bytes | str) → Any

Return a decoded object of the given cls.

  • Parameters:
    • cls (type) – The type to decode to.
    • raw (bytes or str) – The raw bytes or JSON string to decode.
  • Return type: Any

validate() → bool

Return whether the configuration can be represented as valid JSON.

  • Return type: bool

class ExecAlgorithmFactory

Bases: object

Provides execution algorithm creation from importable configurations.

static create(config: ImportableExecAlgorithmConfig)

Create an execution algorithm from the given configuration.

Live

class LiveDataEngineConfig

Bases: DataEngineConfig

Configuration for LiveDataEngine instances.

  • Parameters: qsize (PositiveInt , default 100_000) – The queue size for the engines internal queue buffers.

qsize : PositiveInt

buffer_deltas : bool

debug : bool

dict() → dict[str, Any]

Return a dictionary representation of the configuration.

  • Return type: dict[str, Any]

external_clients : list[ClientId] | None

classmethod fully_qualified_name() → str

Return the fully qualified name for the NautilusConfig class.

  • Return type: str

property id : str

Return the hashed identifier for the configuration.

  • Return type: str

json() → bytes

Return serialized JSON encoded bytes.

  • Return type: bytes

json_primitives() → dict[str, Any]

Return a dictionary representation of the configuration with JSON primitive types as values.

  • Return type: dict[str, Any]

classmethod parse(raw: bytes | str) → Any

Return a decoded object of the given cls.

  • Parameters:
    • cls (type) – The type to decode to.
    • raw (bytes or str) – The raw bytes or JSON string to decode.
  • Return type: Any

time_bars_build_with_no_updates : bool

time_bars_interval_type : str

time_bars_origins : dict | None

time_bars_timestamp_on_close : bool

validate() → bool

Return whether the configuration can be represented as valid JSON.

  • Return type: bool

validate_data_sequence : bool

class LiveRiskEngineConfig

Bases: RiskEngineConfig

Configuration for LiveRiskEngine instances.

  • Parameters: qsize (PositiveInt , default 100_000) – The queue size for the engines internal queue buffers.

qsize : Annotated[int, msgspec.Meta(gt=0)]

bypass : bool

debug : bool

dict() → dict[str, Any]

Return a dictionary representation of the configuration.

  • Return type: dict[str, Any]

classmethod fully_qualified_name() → str

Return the fully qualified name for the NautilusConfig class.

  • Return type: str

property id : str

Return the hashed identifier for the configuration.

  • Return type: str

json() → bytes

Return serialized JSON encoded bytes.

  • Return type: bytes

json_primitives() → dict[str, Any]

Return a dictionary representation of the configuration with JSON primitive types as values.

  • Return type: dict[str, Any]

max_notional_per_order : dict[str, int]

max_order_modify_rate : str

max_order_submit_rate : str

classmethod parse(raw: bytes | str) → Any

Return a decoded object of the given cls.

  • Parameters:
    • cls (type) – The type to decode to.
    • raw (bytes or str) – The raw bytes or JSON string to decode.
  • Return type: Any

validate() → bool

Return whether the configuration can be represented as valid JSON.

  • Return type: bool

class LiveExecEngineConfig

Bases: ExecEngineConfig

Configuration for LiveExecEngine instances.

The purpose of the in-flight order check is for live reconciliation, events emitted from the venue may have been lost at some point - leaving an order in an intermediate state, the check can recover these events via status reports.

  • Parameters:
    • reconciliation (bool , default True) – If reconciliation is active at start-up.
    • reconciliation_lookback_mins (NonNegativeInt , optional) – The maximum lookback minutes to reconcile state for. If None or 0 then will use the maximum lookback available from the venues.
    • filter_unclaimed_external_orders (bool , default False) – If unclaimed order events with an EXTERNAL strategy ID should be filtered/dropped.
    • filter_position_reports (bool , default False) – If position status reports are filtered from reconciliation. This may be applicable when other nodes are trading the same instrument(s), on the same account - which could cause conflicts in position status.
    • generate_missing_orders (bool , default True) – If MARKET order events will be generated during reconciliation to align discrepancies between internal and external positions.
    • inflight_check_interval_ms (NonNegativeInt , default 2_000) – The interval (milliseconds) between checking whether in-flight orders have exceeded their time-in-flight threshold. This should not be set less than the inflight_check_interval_ms.
    • inflight_check_threshold_ms (NonNegativeInt , default 5_000) – The threshold (milliseconds) beyond which an in-flight orders status is checked with the venue. As a rule of thumb, you shouldn’t consider reducing this setting unless you are colocated with the venue (to avoid the potential for race conditions).
    • inflight_check_retries (NonNegativeInt , default 5) – The number of retry attempts the engine will make to verify the status of an in-flight order with the venue, should the initial attempt fail.
    • open_check_interval_secs (PositiveFloat , optional) – The interval (seconds) between checks to confirm if Nautilus open orders remain open on the venue. A recommended setting is between 5-10 seconds, consider API rate limits and the additional request weights imposed by the necessary order status requests.
    • qsize (PositiveInt , default 100_000) – The queue size for the engines internal queue buffers.

reconciliation : bool

reconciliation_lookback_mins : Annotated[int, msgspec.Meta(ge=0)] | None

filter_unclaimed_external_orders : bool

filter_position_reports : bool

generate_missing_orders : bool

inflight_check_interval_ms : Annotated[int, msgspec.Meta(ge=0)]

inflight_check_threshold_ms : Annotated[int, msgspec.Meta(ge=0)]

inflight_check_retries : Annotated[int, msgspec.Meta(ge=0)]

open_check_interval_secs : Annotated[float, msgspec.Meta(gt=0.0)] | None

qsize : Annotated[int, msgspec.Meta(gt=0)]

debug : bool

dict() → dict[str, Any]

Return a dictionary representation of the configuration.

  • Return type: dict[str, Any]

classmethod fully_qualified_name() → str

Return the fully qualified name for the NautilusConfig class.

  • Return type: str

property id : str

Return the hashed identifier for the configuration.

  • Return type: str

json() → bytes

Return serialized JSON encoded bytes.

  • Return type: bytes

json_primitives() → dict[str, Any]

Return a dictionary representation of the configuration with JSON primitive types as values.

  • Return type: dict[str, Any]

load_cache : bool

classmethod parse(raw: bytes | str) → Any

Return a decoded object of the given cls.

  • Parameters:
    • cls (type) – The type to decode to.
    • raw (bytes or str) – The raw bytes or JSON string to decode.
  • Return type: Any

snapshot_orders : bool

snapshot_positions : bool

snapshot_positions_interval_secs : Annotated[float, msgspec.Meta(gt=0.0)] | None

validate() → bool

Return whether the configuration can be represented as valid JSON.

  • Return type: bool

class RoutingConfig

Bases: NautilusConfig

Configuration for live client message routing.

  • Parameters:
    • default (bool) – If the client should be registered as the default routing client (when a specific venue routing cannot be found).
    • venues (list *[*str ] , optional) – The venues to register for routing.

default : bool

venues : frozenset[str] | None

dict() → dict[str, Any]

Return a dictionary representation of the configuration.

  • Return type: dict[str, Any]

classmethod fully_qualified_name() → str

Return the fully qualified name for the NautilusConfig class.

  • Return type: str

property id : str

Return the hashed identifier for the configuration.

  • Return type: str

json() → bytes

Return serialized JSON encoded bytes.

  • Return type: bytes

json_primitives() → dict[str, Any]

Return a dictionary representation of the configuration with JSON primitive types as values.

  • Return type: dict[str, Any]

classmethod parse(raw: bytes | str) → Any

Return a decoded object of the given cls.

  • Parameters:
    • cls (type) – The type to decode to.
    • raw (bytes or str) – The raw bytes or JSON string to decode.
  • Return type: Any

validate() → bool

Return whether the configuration can be represented as valid JSON.

  • Return type: bool

class LiveDataClientConfig

Bases: NautilusConfig

Configuration for LiveDataClient instances.

  • Parameters:
    • handle_revised_bars (bool) – If DataClient will emit bar updates when a new bar opens.
    • instrument_provider (InstrumentProviderConfig) – The clients instrument provider configuration.
    • routing (RoutingConfig) – The clients message routing config.

handle_revised_bars : bool

instrument_provider : InstrumentProviderConfig

routing : RoutingConfig

dict() → dict[str, Any]

Return a dictionary representation of the configuration.

  • Return type: dict[str, Any]

classmethod fully_qualified_name() → str

Return the fully qualified name for the NautilusConfig class.

  • Return type: str

property id : str

Return the hashed identifier for the configuration.

  • Return type: str

json() → bytes

Return serialized JSON encoded bytes.

  • Return type: bytes

json_primitives() → dict[str, Any]

Return a dictionary representation of the configuration with JSON primitive types as values.

  • Return type: dict[str, Any]

classmethod parse(raw: bytes | str) → Any

Return a decoded object of the given cls.

  • Parameters:
    • cls (type) – The type to decode to.
    • raw (bytes or str) – The raw bytes or JSON string to decode.
  • Return type: Any

validate() → bool

Return whether the configuration can be represented as valid JSON.

  • Return type: bool

class LiveExecClientConfig

Bases: NautilusConfig

Configuration for LiveExecutionClient instances.

instrument_provider : InstrumentProviderConfig

routing : RoutingConfig

dict() → dict[str, Any]

Return a dictionary representation of the configuration.

  • Return type: dict[str, Any]

classmethod fully_qualified_name() → str

Return the fully qualified name for the NautilusConfig class.

  • Return type: str

property id : str

Return the hashed identifier for the configuration.

  • Return type: str

json() → bytes

Return serialized JSON encoded bytes.

  • Return type: bytes

json_primitives() → dict[str, Any]

Return a dictionary representation of the configuration with JSON primitive types as values.

  • Return type: dict[str, Any]

classmethod parse(raw: bytes | str) → Any

Return a decoded object of the given cls.

  • Parameters:
    • cls (type) – The type to decode to.
    • raw (bytes or str) – The raw bytes or JSON string to decode.
  • Return type: Any

validate() → bool

Return whether the configuration can be represented as valid JSON.

  • Return type: bool

class ControllerConfig

Bases: ActorConfig

The base model for all controller configurations.

component_id : ComponentId | None

dict() → dict[str, Any]

Return a dictionary representation of the configuration.

  • Return type: dict[str, Any]

classmethod fully_qualified_name() → str

Return the fully qualified name for the NautilusConfig class.

  • Return type: str

property id : str

Return the hashed identifier for the configuration.

  • Return type: str

json() → bytes

Return serialized JSON encoded bytes.

  • Return type: bytes

json_primitives() → dict[str, Any]

Return a dictionary representation of the configuration with JSON primitive types as values.

  • Return type: dict[str, Any]

classmethod parse(raw: bytes | str) → Any

Return a decoded object of the given cls.

  • Parameters:
    • cls (type) – The type to decode to.
    • raw (bytes or str) – The raw bytes or JSON string to decode.
  • Return type: Any

validate() → bool

Return whether the configuration can be represented as valid JSON.

  • Return type: bool

class ControllerFactory

Bases: object

Provides controller creation from importable configurations.

static create(config: ImportableControllerConfig, trader)

class TradingNodeConfig

Bases: NautilusKernelConfig

Configuration for TradingNode instances.

environment : Environment

trader_id : TraderId

data_engine : LiveDataEngineConfig

risk_engine : LiveRiskEngineConfig

exec_engine : LiveExecEngineConfig

data_clients : dict[str, LiveDataClientConfig]

exec_clients : dict[str, LiveExecClientConfig]

actors : list[ImportableActorConfig]

cache : CacheConfig | None

catalogs : list[DataCatalogConfig]

controller : ImportableControllerConfig | None

dict() → dict[str, Any]

Return a dictionary representation of the configuration.

  • Return type: dict[str, Any]

emulator : OrderEmulatorConfig | None

exec_algorithms : list[ImportableExecAlgorithmConfig]

classmethod fully_qualified_name() → str

Return the fully qualified name for the NautilusConfig class.

  • Return type: str

property id : str

Return the hashed identifier for the configuration.

  • Return type: str

instance_id : UUID4 | None

json() → bytes

Return serialized JSON encoded bytes.

  • Return type: bytes

json_primitives() → dict[str, Any]

Return a dictionary representation of the configuration with JSON primitive types as values.

  • Return type: dict[str, Any]

load_state : bool

logging : LoggingConfig | None

loop_debug : bool

message_bus : MessageBusConfig | None

classmethod parse(raw: bytes | str) → Any

Return a decoded object of the given cls.

  • Parameters:
    • cls (type) – The type to decode to.
    • raw (bytes or str) – The raw bytes or JSON string to decode.
  • Return type: Any

save_state : bool

strategies : list[ImportableStrategyConfig]

streaming : StreamingConfig | None

timeout_connection : PositiveFloat

timeout_disconnection : PositiveFloat

timeout_portfolio : PositiveFloat

timeout_post_stop : PositiveFloat

timeout_reconciliation : PositiveFloat

validate() → bool

Return whether the configuration can be represented as valid JSON.

  • Return type: bool

Persistence

class StreamingConfig

Bases: NautilusConfig

Configuration for streaming live or backtest runs to the catalog in feather format.

  • Parameters:
    • catalog_path (str) – The path to the data catalog.
    • fs_protocol (str , optional) – The fsspec filesystem protocol for the catalog.
    • fs_storage_options (dict , optional) – The fsspec storage options.
    • flush_interval_ms (int , optional) – The flush interval (milliseconds) for writing chunks.
    • replace_existing (bool , default False) – If any existing feather files should be replaced.
    • include_types (list *[*type ] , optional) – A list of Arrow serializable types to write. If this is specified then only the included types will be written.
    • rotation_mode (RotationMode , default RotationMode.NO_ROTATION) – The mode for file rotation.
    • max_file_size (int , default 1GB) – The maximum file size in bytes before rotation (for SIZE mode).
    • rotation_interval (pd.Timedelta , default 1 day) – The time interval for file rotation (for INTERVAL mode and SCHEDULED_DATES mode).
    • rotation_time (time , default 00:00) – The time of day for file rotation (for SCHEDULED_DATES mode).
    • rotation_timezone (str , default 'UTC') – The timezone for rotation calculations (for SCHEDULED_DATES mode).

catalog_path : str

fs_protocol : str | None

fs_storage_options : dict | None

flush_interval_ms : int | None

replace_existing : bool

include_types : list[type] | None

rotation_mode : RotationMode

max_file_size : int

rotation_interval : Timedelta

rotation_time : time

rotation_timezone : str

property fs

as_catalog()

dict() → dict[str, Any]

Return a dictionary representation of the configuration.

  • Return type: dict[str, Any]

classmethod fully_qualified_name() → str

Return the fully qualified name for the NautilusConfig class.

  • Return type: str

property id : str

Return the hashed identifier for the configuration.

  • Return type: str

json() → bytes

Return serialized JSON encoded bytes.

  • Return type: bytes

json_primitives() → dict[str, Any]

Return a dictionary representation of the configuration with JSON primitive types as values.

  • Return type: dict[str, Any]

classmethod parse(raw: bytes | str) → Any

Return a decoded object of the given cls.

  • Parameters:
    • cls (type) – The type to decode to.
    • raw (bytes or str) – The raw bytes or JSON string to decode.
  • Return type: Any

validate() → bool

Return whether the configuration can be represented as valid JSON.

  • Return type: bool

class DataCatalogConfig

Bases: NautilusConfig

Configuration for a data catalog.

  • Parameters:
    • path (str) – The path to the data catalog.
    • fs_protocol (str , optional) – The fsspec file system protocol for the data catalog.
    • fs_storage_options (dict , optional) – The fsspec storage options for the data catalog.

path : str

fs_protocol : str | None

fs_storage_options : dict | None

dict() → dict[str, Any]

Return a dictionary representation of the configuration.

  • Return type: dict[str, Any]

classmethod fully_qualified_name() → str

Return the fully qualified name for the NautilusConfig class.

  • Return type: str

property id : str

Return the hashed identifier for the configuration.

  • Return type: str

json() → bytes

Return serialized JSON encoded bytes.

  • Return type: bytes

json_primitives() → dict[str, Any]

Return a dictionary representation of the configuration with JSON primitive types as values.

  • Return type: dict[str, Any]

classmethod parse(raw: bytes | str) → Any

Return a decoded object of the given cls.

  • Parameters:
    • cls (type) – The type to decode to.
    • raw (bytes or str) – The raw bytes or JSON string to decode.
  • Return type: Any

validate() → bool

Return whether the configuration can be represented as valid JSON.

  • Return type: bool

Risk

class RiskEngineConfig

Bases: NautilusConfig

Configuration for RiskEngine instances.

  • Parameters:
    • bypass (bool , default False) – If True, then will bypass all pre-trade risk checks and rate limits (will still check for duplicate IDs).
    • max_order_submit_rate (str , default 100/00:00:01) – The maximum rate of submit order commands per timedelta.
    • max_order_modify_rate (str , default 100/00:00:01) – The maximum rate of modify order commands per timedelta.
    • max_notional_per_order (dict *[*str , int ] , default empty dict) – The maximum notional value of an order per instrument ID. The value should be a valid decimal format.
    • debug (bool , default False) – If debug mode is active (will provide extra debug logging).

bypass : bool

max_order_submit_rate : str

max_order_modify_rate : str

max_notional_per_order : dict[str, int]

debug : bool

dict() → dict[str, Any]

Return a dictionary representation of the configuration.

  • Return type: dict[str, Any]

classmethod fully_qualified_name() → str

Return the fully qualified name for the NautilusConfig class.

  • Return type: str

property id : str

Return the hashed identifier for the configuration.

  • Return type: str

json() → bytes

Return serialized JSON encoded bytes.

  • Return type: bytes

json_primitives() → dict[str, Any]

Return a dictionary representation of the configuration with JSON primitive types as values.

  • Return type: dict[str, Any]

classmethod parse(raw: bytes | str) → Any

Return a decoded object of the given cls.

  • Parameters:
    • cls (type) – The type to decode to.
    • raw (bytes or str) – The raw bytes or JSON string to decode.
  • Return type: Any

validate() → bool

Return whether the configuration can be represented as valid JSON.

  • Return type: bool

System

class NautilusKernelConfig

Bases: NautilusConfig

Configuration for a NautilusKernel core system instance.

  • Parameters:
    • environment (Environment { BACKTEST, SANDBOX, LIVE }) – The kernel environment context.
    • trader_id (TraderId) – The trader ID for the kernel (must be a name and ID tag separated by a hyphen).
    • cache (CacheConfig , optional) – The cache configuration.
    • message_bus (MessageBusConfig , optional) – The message bus configuration.
    • data_engine (DataEngineConfig , optional) – The live data engine configuration.
    • risk_engine (RiskEngineConfig , optional) – The live risk engine configuration.
    • exec_engine (ExecEngineConfig , optional) – The live execution engine configuration.
    • emulator (OrderEmulatorConfig , optional) – The order emulator configuration.
    • streaming (StreamingConfig , optional) – The configuration for streaming to feather files.
    • catalogs (list [DataCatalogConfig ] , optional) – The list of data catalog configs.
    • actors (list [ImportableActorConfig ]) – The actor configurations for the kernel.
    • strategies (list [ImportableStrategyConfig ]) – The strategy configurations for the kernel.
    • exec_algorithms (list [ImportableExecAlgorithmConfig ]) – The execution algorithm configurations for the kernel.
    • controller (ImportableControllerConfig , optional) – The trader controller for the kernel.
    • load_state (bool , default True) – If trading strategy state should be loaded from the database on start.
    • save_state (bool , default True) – If trading strategy state should be saved to the database on stop.
    • loop_debug (bool , default False) – If the asyncio event loop should be in debug mode.
    • logging (LoggingConfig , optional) – The logging config for the kernel.
    • timeout_connection (PositiveFloat) – The timeout (seconds) for all clients to connect and initialize.
    • timeout_reconciliation (PositiveFloat) – The timeout (seconds) for execution state to reconcile.
    • timeout_portfolio (PositiveFloat) – The timeout (seconds) for portfolio to initialize margins and unrealized PnLs.
    • timeout_disconnection (PositiveFloat) – The timeout (seconds) for all engine clients to disconnect.
    • timeout_post_stop (PositiveFloat) – The timeout (seconds) after stopping the node to await residual events before final shutdown.

environment : Environment

trader_id : TraderId

instance_id : UUID4 | None

cache : CacheConfig | None

message_bus : MessageBusConfig | None

data_engine : DataEngineConfig | None

risk_engine : RiskEngineConfig | None

exec_engine : ExecEngineConfig | None

emulator : OrderEmulatorConfig | None

streaming : StreamingConfig | None

catalogs : list[DataCatalogConfig]

actors : list[ImportableActorConfig]

strategies : list[ImportableStrategyConfig]

exec_algorithms : list[ImportableExecAlgorithmConfig]

controller : ImportableControllerConfig | None

load_state : bool

save_state : bool

loop_debug : bool

logging : LoggingConfig | None

timeout_connection : Annotated[float, msgspec.Meta(gt=0.0)]

timeout_reconciliation : Annotated[float, msgspec.Meta(gt=0.0)]

timeout_portfolio : Annotated[float, msgspec.Meta(gt=0.0)]

timeout_disconnection : Annotated[float, msgspec.Meta(gt=0.0)]

timeout_post_stop : Annotated[float, msgspec.Meta(gt=0.0)]

dict() → dict[str, Any]

Return a dictionary representation of the configuration.

  • Return type: dict[str, Any]

classmethod fully_qualified_name() → str

Return the fully qualified name for the NautilusConfig class.

  • Return type: str

property id : str

Return the hashed identifier for the configuration.

  • Return type: str

json() → bytes

Return serialized JSON encoded bytes.

  • Return type: bytes

json_primitives() → dict[str, Any]

Return a dictionary representation of the configuration with JSON primitive types as values.

  • Return type: dict[str, Any]

classmethod parse(raw: bytes | str) → Any

Return a decoded object of the given cls.

  • Parameters:
    • cls (type) – The type to decode to.
    • raw (bytes or str) – The raw bytes or JSON string to decode.
  • Return type: Any

validate() → bool

Return whether the configuration can be represented as valid JSON.

  • Return type: bool

Trading

class StrategyConfig

Bases: NautilusConfig

The base model for all trading strategy configurations.

  • Parameters:
    • strategy_id (StrategyId , optional) – The unique ID for the strategy. Will become the strategy ID if not None.
    • order_id_tag (str , optional) – The unique order ID tag for the strategy. Must be unique amongst all running strategies for a particular trader ID.
    • oms_type (OmsType , optional) – The order management system type for the strategy. This will determine how the ExecutionEngine handles position IDs.
    • external_order_claims (list [InstrumentId ] , optional) – The external order claim instrument IDs. External orders for matching instrument IDs will be associated with (claimed by) the strategy.
    • manage_contingent_orders (bool , default False) – If OUO and OCO open contingent orders should be managed automatically by the strategy. Any emulated orders which are active local will be managed by the OrderEmulator instead.
    • manage_gtd_expiry (bool , default False) – If all order GTD time in force expirations should be managed by the strategy. If True, then will ensure open orders have their GTD timers re-activated on start.

strategy_id : StrategyId | None

order_id_tag : str | None

oms_type : str | None

external_order_claims : list[InstrumentId] | None

manage_contingent_orders : bool

manage_gtd_expiry : bool

dict() → dict[str, Any]

Return a dictionary representation of the configuration.

  • Return type: dict[str, Any]

classmethod fully_qualified_name() → str

Return the fully qualified name for the NautilusConfig class.

  • Return type: str

property id : str

Return the hashed identifier for the configuration.

  • Return type: str

json() → bytes

Return serialized JSON encoded bytes.

  • Return type: bytes

json_primitives() → dict[str, Any]

Return a dictionary representation of the configuration with JSON primitive types as values.

  • Return type: dict[str, Any]

classmethod parse(raw: bytes | str) → Any

Return a decoded object of the given cls.

  • Parameters:
    • cls (type) – The type to decode to.
    • raw (bytes or str) – The raw bytes or JSON string to decode.
  • Return type: Any

validate() → bool

Return whether the configuration can be represented as valid JSON.

  • Return type: bool

class ImportableStrategyConfig

Bases: NautilusConfig

Configuration for a trading strategy instance.

  • Parameters:
    • strategy_path (str) – The fully qualified name of the strategy class.
    • config_path (str) – The fully qualified name of the config class.
    • config (dict *[*str , Any ]) – The strategy configuration.

strategy_path : str

config_path : str

config : dict[str, Any]

dict() → dict[str, Any]

Return a dictionary representation of the configuration.

  • Return type: dict[str, Any]

classmethod fully_qualified_name() → str

Return the fully qualified name for the NautilusConfig class.

  • Return type: str

property id : str

Return the hashed identifier for the configuration.

  • Return type: str

json() → bytes

Return serialized JSON encoded bytes.

  • Return type: bytes

json_primitives() → dict[str, Any]

Return a dictionary representation of the configuration with JSON primitive types as values.

  • Return type: dict[str, Any]

classmethod parse(raw: bytes | str) → Any

Return a decoded object of the given cls.

  • Parameters:
    • cls (type) – The type to decode to.
    • raw (bytes or str) – The raw bytes or JSON string to decode.
  • Return type: Any

validate() → bool

Return whether the configuration can be represented as valid JSON.

  • Return type: bool

class StrategyFactory

Bases: object

Provides strategy creation from importable configurations.

static create(config: ImportableStrategyConfig)

Create a trading strategy from the given configuration.

  • Parameters: config (ImportableStrategyConfig) – The configuration for the building step.
  • Return type: Strategy
  • Raises: TypeError – If config is not of type ImportableStrategyConfig.

class ImportableControllerConfig

Bases: NautilusConfig

Configuration for a controller instance.

  • Parameters:
    • controller_path (str) – The fully qualified name of the controller class.
    • config_path (str) – The fully qualified name of the config class.
    • config (dict *[*str , Any ]) – The controller configuration.

controller_path : str

config_path : str

config : dict

dict() → dict[str, Any]

Return a dictionary representation of the configuration.

  • Return type: dict[str, Any]

classmethod fully_qualified_name() → str

Return the fully qualified name for the NautilusConfig class.

  • Return type: str

property id : str

Return the hashed identifier for the configuration.

  • Return type: str

json() → bytes

Return serialized JSON encoded bytes.

  • Return type: bytes

json_primitives() → dict[str, Any]

Return a dictionary representation of the configuration with JSON primitive types as values.

  • Return type: dict[str, Any]

classmethod parse(raw: bytes | str) → Any

Return a decoded object of the given cls.

  • Parameters:
    • cls (type) – The type to decode to.
    • raw (bytes or str) – The raw bytes or JSON string to decode.
  • Return type: Any

validate() → bool

Return whether the configuration can be represented as valid JSON.

  • Return type: bool