Config

The config subpackage groups all configuration classes and factories.

All configurations inherit from msgspec.Struct .

Common

class NautilusConfig

Bases: Struct

The base class for all Nautilus configuration objects.

classmethod fully_qualified_name ( ) str

Return the fully qualified name for the NautilusConfig class.

Returns :

str

References

https://www.python.org/dev/peps/pep-3155/

dict ( ) dict [ str , Any ]

Return a dictionary representation of the configuration.

Returns :

dict[str, Any]

json ( ) bytes

Return serialized JSON encoded bytes.

Returns :

bytes

classmethod parse ( raw : bytes ) Any

Return a decoded object of the given cls .

Parameters :
  • cls ( type ) – The type to decode to.

  • raw ( bytes ) – The raw bytes to decode.

Returns :

Any

validate ( ) bool

Return whether the configuration can be represented as valid JSON.

Returns :

bool

class CacheConfig ( tick_capacity : int = 1000 , bar_capacity : int = 1000 )

Bases: NautilusConfig

Configuration for Cache instances.

Parameters :
  • tick_capacity ( PositiveInt ) – The maximum length for internal tick dequeues.

  • bar_capacity ( PositiveInt ) – The maximum length for internal bar dequeues.

dict ( ) dict [ str , Any ]

Return a dictionary representation of the configuration.

Returns :

dict[str, Any]

classmethod fully_qualified_name ( ) str

Return the fully qualified name for the NautilusConfig class.

Returns :

str

References

https://www.python.org/dev/peps/pep-3155/

json ( ) bytes

Return serialized JSON encoded bytes.

Returns :

bytes

classmethod parse ( raw : bytes ) Any

Return a decoded object of the given cls .

Parameters :
  • cls ( type ) – The type to decode to.

  • raw ( bytes ) – The raw bytes to decode.

Returns :

Any

validate ( ) bool

Return whether the configuration can be represented as valid JSON.

Returns :

bool

class CacheDatabaseConfig ( type : str = 'in-memory' , host : str = 'localhost' , port : int = 6379 , flush : bool = False )

Bases: NautilusConfig

Configuration for CacheDatabase instances.

Parameters :
  • type ( str , {'in-memory' , 'redis'} , default 'in-memory' ) – The database type.

  • host ( str , default 'localhost' ) – The database host address (default for Redis).

  • port ( int , default 6379 ) – The database port (default for Redis).

  • flush ( bool , default False ) – If database should be flushed before start.

dict ( ) dict [ str , Any ]

Return a dictionary representation of the configuration.

Returns :

dict[str, Any]

classmethod fully_qualified_name ( ) str

Return the fully qualified name for the NautilusConfig class.

Returns :

str

References

https://www.python.org/dev/peps/pep-3155/

json ( ) bytes

Return serialized JSON encoded bytes.

Returns :

bytes

classmethod parse ( raw : bytes ) Any

Return a decoded object of the given cls .

Parameters :
  • cls ( type ) – The type to decode to.

  • raw ( bytes ) – The raw bytes to decode.

Returns :

Any

validate ( ) bool

Return whether the configuration can be represented as valid JSON.

Returns :

bool

class InstrumentProviderConfig ( load_all : bool = False , load_ids : Optional [ frozenset [ str ] ] = None , filters : Optional [ dict [ str , Any ] ] = None , filter_callable : Optional [ str ] = None , log_warnings : bool = True )

Bases: NautilusConfig

Configuration for InstrumentProvider instances.

Parameters :
  • load_all ( bool , default False ) – If all venue instruments should be loaded on start.

  • load_ids ( FrozenSet [ str ] , optional ) – The list of instrument IDs to be loaded on start (if load_all_instruments is False).

  • filters ( frozendict , 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.

dict ( ) dict [ str , Any ]

Return a dictionary representation of the configuration.

Returns :

dict[str, Any]

classmethod fully_qualified_name ( ) str

Return the fully qualified name for the NautilusConfig class.

Returns :

str

References

https://www.python.org/dev/peps/pep-3155/

json ( ) bytes

Return serialized JSON encoded bytes.

Returns :

bytes

classmethod parse ( raw : bytes ) Any

Return a decoded object of the given cls .

Parameters :
  • cls ( type ) – The type to decode to.

  • raw ( bytes ) – The raw bytes to decode.

Returns :

Any

validate ( ) bool

Return whether the configuration can be represented as valid JSON.

Returns :

bool

class DataEngineConfig ( debug : bool = False )

Bases: NautilusConfig

Configuration for DataEngine instances.

Parameters :

debug ( bool ) – If debug mode is active (will provide extra debug logging).

dict ( ) dict [ str , Any ]

Return a dictionary representation of the configuration.

Returns :

dict[str, Any]

classmethod fully_qualified_name ( ) str

Return the fully qualified name for the NautilusConfig class.

Returns :

str

References

https://www.python.org/dev/peps/pep-3155/

json ( ) bytes

Return serialized JSON encoded bytes.

Returns :

bytes

classmethod parse ( raw : bytes ) Any

Return a decoded object of the given cls .

Parameters :
  • cls ( type ) – The type to decode to.

  • raw ( bytes ) – The raw bytes to decode.

Returns :

Any

validate ( ) bool

Return whether the configuration can be represented as valid JSON.

Returns :

bool

class RiskEngineConfig ( bypass : bool = False , deny_modify_pending_update : bool = True , max_order_submit_rate : str = '100/00:00:01' , max_order_modify_rate : str = '100/00:00:01' , max_notional_per_order : dict [ str , int ] = {} , debug : bool = False )

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

  • deny_modify_pending_update ( bool , default True ) – If deny ModifyOrder commands when an order is in a PENDING_UPDATE state.

  • 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 ] ) – The maximum notional value of an order per instrument ID. The value should be a valid decimal format.

  • debug ( bool ) – If debug mode is active (will provide extra debug logging).

dict ( ) dict [ str , Any ]

Return a dictionary representation of the configuration.

Returns :

dict[str, Any]

classmethod fully_qualified_name ( ) str

Return the fully qualified name for the NautilusConfig class.

Returns :

str

References

https://www.python.org/dev/peps/pep-3155/

json ( ) bytes

Return serialized JSON encoded bytes.

Returns :

bytes

classmethod parse ( raw : bytes ) Any

Return a decoded object of the given cls .

Parameters :
  • cls ( type ) – The type to decode to.

  • raw ( bytes ) – The raw bytes to decode.

Returns :

Any

validate ( ) bool

Return whether the configuration can be represented as valid JSON.

Returns :

bool

class ExecEngineConfig ( load_cache : bool = True , allow_cash_positions : bool = True , debug : bool = False )

Bases: NautilusConfig

Configuration for ExecutionEngine instances.

Parameters :
  • load_cache ( bool , default True ) – If the cache should be loaded on initialization.

  • allow_cash_positions ( bool , default True ) – If unleveraged spot/cash assets should generate positions.

  • debug ( bool ) – If debug mode is active (will provide extra debug logging).

dict ( ) dict [ str , Any ]

Return a dictionary representation of the configuration.

Returns :

dict[str, Any]

classmethod fully_qualified_name ( ) str

Return the fully qualified name for the NautilusConfig class.

Returns :

str

References

https://www.python.org/dev/peps/pep-3155/

json ( ) bytes

Return serialized JSON encoded bytes.

Returns :

bytes

classmethod parse ( raw : bytes ) Any

Return a decoded object of the given cls .

Parameters :
  • cls ( type ) – The type to decode to.

  • raw ( bytes ) – The raw bytes to decode.

Returns :

Any

validate ( ) bool

Return whether the configuration can be represented as valid JSON.

Returns :

bool

class OrderEmulatorConfig

Bases: NautilusConfig

Configuration for OrderEmulator instances.

dict ( ) dict [ str , Any ]

Return a dictionary representation of the configuration.

Returns :

dict[str, Any]

classmethod fully_qualified_name ( ) str

Return the fully qualified name for the NautilusConfig class.

Returns :

str

References

https://www.python.org/dev/peps/pep-3155/

json ( ) bytes

Return serialized JSON encoded bytes.

Returns :

bytes

classmethod parse ( raw : bytes ) Any

Return a decoded object of the given cls .

Parameters :
  • cls ( type ) – The type to decode to.

  • raw ( bytes ) – The raw bytes to decode.

Returns :

Any

validate ( ) bool

Return whether the configuration can be represented as valid JSON.

Returns :

bool

class StreamingConfig ( catalog_path : str , fs_protocol : Optional [ str ] = None , fs_storage_options : Optional [ dict ] = None , flush_interval_ms : Optional [ int ] = None , replace_existing : bool = False , include_types : Optional [ list [ str ] ] = None )

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.

dict ( ) dict [ str , Any ]

Return a dictionary representation of the configuration.

Returns :

dict[str, Any]

classmethod fully_qualified_name ( ) str

Return the fully qualified name for the NautilusConfig class.

Returns :

str

References

https://www.python.org/dev/peps/pep-3155/

json ( ) bytes

Return serialized JSON encoded bytes.

Returns :

bytes

classmethod parse ( raw : bytes ) Any

Return a decoded object of the given cls .

Parameters :
  • cls ( type ) – The type to decode to.

  • raw ( bytes ) – The raw bytes to decode.

Returns :

Any

validate ( ) bool

Return whether the configuration can be represented as valid JSON.

Returns :

bool

class ActorConfig ( component_id : Optional [ str ] = None )

Bases: NautilusConfig

The base model for all actor configurations.

Parameters :

component_id ( str , optional ) – The component ID. If None then the identifier will be taken from type(self).__name__ .

dict ( ) dict [ str , Any ]

Return a dictionary representation of the configuration.

Returns :

dict[str, Any]

classmethod fully_qualified_name ( ) str

Return the fully qualified name for the NautilusConfig class.

Returns :

str

References

https://www.python.org/dev/peps/pep-3155/

json ( ) bytes

Return serialized JSON encoded bytes.

Returns :

bytes

classmethod parse ( raw : bytes ) Any

Return a decoded object of the given cls .

Parameters :
  • cls ( type ) – The type to decode to.

  • raw ( bytes ) – The raw bytes to decode.

Returns :

Any

validate ( ) bool

Return whether the configuration can be represented as valid JSON.

Returns :

bool

class ImportableActorConfig ( actor_path : str , config_path : str , config : dict )

Bases: NautilusConfig

Represents an actor configuration for one specific backtest run.

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

dict ( ) dict [ str , Any ]

Return a dictionary representation of the configuration.

Returns :

dict[str, Any]

classmethod fully_qualified_name ( ) str

Return the fully qualified name for the NautilusConfig class.

Returns :

str

References

https://www.python.org/dev/peps/pep-3155/

json ( ) bytes

Return serialized JSON encoded bytes.

Returns :

bytes

classmethod parse ( raw : bytes ) Any

Return a decoded object of the given cls .

Parameters :
  • cls ( type ) – The type to decode to.

  • raw ( bytes ) – The raw bytes to decode.

Returns :

Any

validate ( ) bool

Return whether the configuration can be represented as valid JSON.

Returns :

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.

Returns :

Actor

Raises :

TypeError – If config is not of type ImportableActorConfig .

class StrategyConfig ( strategy_id : Optional [ str ] = None , order_id_tag : Optional [ str ] = None , oms_type : Optional [ str ] = None )

Bases: NautilusConfig

The base model for all trading strategy configurations.

Parameters :
  • strategy_id ( str , 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 (see docs).

dict ( ) dict [ str , Any ]

Return a dictionary representation of the configuration.

Returns :

dict[str, Any]

classmethod fully_qualified_name ( ) str

Return the fully qualified name for the NautilusConfig class.

Returns :

str

References

https://www.python.org/dev/peps/pep-3155/

json ( ) bytes

Return serialized JSON encoded bytes.

Returns :

bytes

classmethod parse ( raw : bytes ) Any

Return a decoded object of the given cls .

Parameters :
  • cls ( type ) – The type to decode to.

  • raw ( bytes ) – The raw bytes to decode.

Returns :

Any

validate ( ) bool

Return whether the configuration can be represented as valid JSON.

Returns :

bool

class ImportableStrategyConfig ( strategy_path : str , config_path : str , config : dict [ str , Any ] )

Bases: NautilusConfig

Represents a trading strategy configuration for one specific backtest run.

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

dict ( ) dict [ str , Any ]

Return a dictionary representation of the configuration.

Returns :

dict[str, Any]

classmethod fully_qualified_name ( ) str

Return the fully qualified name for the NautilusConfig class.

Returns :

str

References

https://www.python.org/dev/peps/pep-3155/

json ( ) bytes

Return serialized JSON encoded bytes.

Returns :

bytes

classmethod parse ( raw : bytes ) Any

Return a decoded object of the given cls .

Parameters :
  • cls ( type ) – The type to decode to.

  • raw ( bytes ) – The raw bytes to decode.

Returns :

Any

validate ( ) bool

Return whether the configuration can be represented as valid JSON.

Returns :

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.

Returns :

Strategy

Raises :

TypeError – If config is not of type ImportableStrategyConfig .

class NautilusKernelConfig ( environment : Environment , trader_id : str , instance_id : Optional [ str ] = None , cache : Optional [ CacheConfig ] = None , cache_database : Optional [ CacheDatabaseConfig ] = None , data_engine : Optional [ DataEngineConfig ] = None , risk_engine : Optional [ RiskEngineConfig ] = None , exec_engine : Optional [ ExecEngineConfig ] = None , streaming : Optional [ StreamingConfig ] = None , actors : list [ nautilus_trader.config.common.ImportableActorConfig ] = [] , strategies : list [ nautilus_trader.config.common.ImportableStrategyConfig ] = [] , load_state : bool = False , save_state : bool = False , loop_debug : bool = False , log_level : str = 'INFO' , bypass_logging : bool = False )

Bases: NautilusConfig

Configuration for core system NautilusKernel instances.

Parameters :
  • environment (Environment { BACKTEST , SANDBOX , LIVE }) – The kernel environment context.

  • trader_id ( str ) – The trader ID for the kernel (must be a name and ID tag separated by a hyphen).

  • cache ( CacheConfig , optional ) – The cache configuration.

  • cache_database ( CacheDatabaseConfig , optional ) – The cache database 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.

  • actors ( list [ ImportableActorConfig ] ) – The actor configurations for the kernel.

  • strategies ( list [ ImportableStrategyConfig ] ) – The strategy configurations 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.

  • log_level ( str , default "INFO" ) – The stdout log level for the node.

  • bypass_logging ( bool , default False ) – If logging to stdout should be bypassed.

dict ( ) dict [ str , Any ]

Return a dictionary representation of the configuration.

Returns :

dict[str, Any]

classmethod fully_qualified_name ( ) str

Return the fully qualified name for the NautilusConfig class.

Returns :

str

References

https://www.python.org/dev/peps/pep-3155/

json ( ) bytes

Return serialized JSON encoded bytes.

Returns :

bytes

classmethod parse ( raw : bytes ) Any

Return a decoded object of the given cls .

Parameters :
  • cls ( type ) – The type to decode to.

  • raw ( bytes ) – The raw bytes to decode.

Returns :

Any

validate ( ) bool

Return whether the configuration can be represented as valid JSON.

Returns :

bool

class ImportableFactoryConfig ( path : str )

Bases: NautilusConfig

Represents an importable (json) Factory config.

dict ( ) dict [ str , Any ]

Return a dictionary representation of the configuration.

Returns :

dict[str, Any]

classmethod fully_qualified_name ( ) str

Return the fully qualified name for the NautilusConfig class.

Returns :

str

References

https://www.python.org/dev/peps/pep-3155/

json ( ) bytes

Return serialized JSON encoded bytes.

Returns :

bytes

classmethod parse ( raw : bytes ) Any

Return a decoded object of the given cls .

Parameters :
  • cls ( type ) – The type to decode to.

  • raw ( bytes ) – The raw bytes to decode.

Returns :

Any

validate ( ) bool

Return whether the configuration can be represented as valid JSON.

Returns :

bool

class ImportableConfig ( path : str , config : dict = {} , factory : Optional [ ImportableFactoryConfig ] = None )

Bases: NautilusConfig

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

dict ( ) dict [ str , Any ]

Return a dictionary representation of the configuration.

Returns :

dict[str, Any]

classmethod fully_qualified_name ( ) str

Return the fully qualified name for the NautilusConfig class.

Returns :

str

References

https://www.python.org/dev/peps/pep-3155/

json ( ) bytes

Return serialized JSON encoded bytes.

Returns :

bytes

classmethod parse ( raw : bytes ) Any

Return a decoded object of the given cls .

Parameters :
  • cls ( type ) – The type to decode to.

  • raw ( bytes ) – The raw bytes to decode.

Returns :

Any

validate ( ) bool

Return whether the configuration can be represented as valid JSON.

Returns :

bool

Backtest

class BacktestVenueConfig ( name : str , oms_type : str , account_type : str , starting_balances : list [ str ] , base_currency : Optional [ str ] = None , default_leverage : float = 1.0 , leverages : Optional [ dict [ str , float ] ] = None , book_type : str = 'L1_TBBO' , routing : bool = False , frozen_account : bool = False , reject_stop_orders : bool = True )

Bases: NautilusConfig

Represents a venue configuration for one specific backtest engine.

dict ( ) dict [ str , Any ]

Return a dictionary representation of the configuration.

Returns :

dict[str, Any]

classmethod fully_qualified_name ( ) str

Return the fully qualified name for the NautilusConfig class.

Returns :

str

References

https://www.python.org/dev/peps/pep-3155/

json ( ) bytes

Return serialized JSON encoded bytes.

Returns :

bytes

classmethod parse ( raw : bytes ) Any

Return a decoded object of the given cls .

Parameters :
  • cls ( type ) – The type to decode to.

  • raw ( bytes ) – The raw bytes to decode.

Returns :

Any

validate ( ) bool

Return whether the configuration can be represented as valid JSON.

Returns :

bool

class BacktestDataConfig ( catalog_path : str , data_cls : str , catalog_fs_protocol : Optional [ str ] = None , catalog_fs_storage_options : Optional [ dict ] = None , instrument_id : Optional [ str ] = None , start_time : Optional [ Union [ str , int ] ] = None , end_time : Optional [ Union [ str , int ] ] = None , filter_expr : Optional [ str ] = None , client_id : Optional [ str ] = None , metadata : Optional [ dict ] = None )

Bases: NautilusConfig

Represents the data configuration for one specific backtest run.

dict ( ) dict [ str , Any ]

Return a dictionary representation of the configuration.

Returns :

dict[str, Any]

classmethod fully_qualified_name ( ) str

Return the fully qualified name for the NautilusConfig class.

Returns :

str

References

https://www.python.org/dev/peps/pep-3155/

json ( ) bytes

Return serialized JSON encoded bytes.

Returns :

bytes

classmethod parse ( raw : bytes ) Any

Return a decoded object of the given cls .

Parameters :
  • cls ( type ) – The type to decode to.

  • raw ( bytes ) – The raw bytes to decode.

Returns :

Any

validate ( ) bool

Return whether the configuration can be represented as valid JSON.

Returns :

bool

class BacktestEngineConfig ( instance_id : Optional [ str ] = None , cache : Optional [ CacheConfig ] = None , cache_database : Optional [ CacheDatabaseConfig ] = None , data_engine : DataEngineConfig = DataEngineConfig(debug=False) , risk_engine : RiskEngineConfig = RiskEngineConfig(bypass=False, deny_modify_pending_update=True, max_order_submit_rate='100/00:00:01', max_order_modify_rate='100/00:00:01', max_notional_per_order={}, debug=False) , exec_engine : ExecEngineConfig = ExecEngineConfig(load_cache=True, allow_cash_positions=True, debug=False) , streaming : Optional [ StreamingConfig ] = None , actors : list [ nautilus_trader.config.common.ImportableActorConfig ] = [] , strategies : list [ nautilus_trader.config.common.ImportableStrategyConfig ] = [] , load_state : bool = False , save_state : bool = False , loop_debug : bool = False , log_level : str = 'INFO' , bypass_logging : bool = False , environment : Environment = Environment.BACKTEST , trader_id : str = 'BACKTESTER-001' , run_analysis : bool = True )

Bases: NautilusKernelConfig

Configuration for BacktestEngine instances.

Parameters :
  • trader_id ( str ) – 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.

  • cache_database ( CacheDatabaseConfig , optional ) – The cache database 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 node.

  • actors ( list [ ImportableActorConfig ] ) – The actor configurations for the node.

  • 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.

dict ( ) dict [ str , Any ]

Return a dictionary representation of the configuration.

Returns :

dict[str, Any]

classmethod fully_qualified_name ( ) str

Return the fully qualified name for the NautilusConfig class.

Returns :

str

References

https://www.python.org/dev/peps/pep-3155/

json ( ) bytes

Return serialized JSON encoded bytes.

Returns :

bytes

classmethod parse ( raw : bytes ) Any

Return a decoded object of the given cls .

Parameters :
  • cls ( type ) – The type to decode to.

  • raw ( bytes ) – The raw bytes to decode.

Returns :

Any

validate ( ) bool

Return whether the configuration can be represented as valid JSON.

Returns :

bool

class BacktestRunConfig ( engine : Optional [ BacktestEngineConfig ] = None , venues : Optional [ list [ nautilus_trader.config.backtest.BacktestVenueConfig ] ] = None , data : Optional [ list [ nautilus_trader.config.backtest.BacktestDataConfig ] ] = None , batch_size_bytes : Optional [ int ] = None )

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 :
  • engine ( BacktestEngineConfig , optional ) – The backtest engine configuration (represents the core system kernel).

  • venues ( list [ BacktestVenueConfig ] ) – The venue configurations for the backtest run.

  • data ( list [ BacktestDataConfig ] ) – The data configurations for the backtest run.

  • batch_size_bytes ( optional ) – The batch block size in bytes (will then run in streaming mode).

dict ( ) dict [ str , Any ]

Return a dictionary representation of the configuration.

Returns :

dict[str, Any]

classmethod fully_qualified_name ( ) str

Return the fully qualified name for the NautilusConfig class.

Returns :

str

References

https://www.python.org/dev/peps/pep-3155/

json ( ) bytes

Return serialized JSON encoded bytes.

Returns :

bytes

classmethod parse ( raw : bytes ) Any

Return a decoded object of the given cls .

Parameters :
  • cls ( type ) – The type to decode to.

  • raw ( bytes ) – The raw bytes to decode.

Returns :

Any

validate ( ) bool

Return whether the configuration can be represented as valid JSON.

Returns :

bool

parse_filters_expr ( s : str )

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

Live

class LiveDataEngineConfig ( debug : bool = False , qsize : int = 10000 )

Bases: DataEngineConfig

Configuration for LiveDataEngine instances.

Parameters :

qsize ( PositiveInt , default 10000 ) – The queue size for the engines internal queue buffers.

dict ( ) dict [ str , Any ]

Return a dictionary representation of the configuration.

Returns :

dict[str, Any]

classmethod fully_qualified_name ( ) str

Return the fully qualified name for the NautilusConfig class.

Returns :

str

References

https://www.python.org/dev/peps/pep-3155/

json ( ) bytes

Return serialized JSON encoded bytes.

Returns :

bytes

classmethod parse ( raw : bytes ) Any

Return a decoded object of the given cls .

Parameters :
  • cls ( type ) – The type to decode to.

  • raw ( bytes ) – The raw bytes to decode.

Returns :

Any

validate ( ) bool

Return whether the configuration can be represented as valid JSON.

Returns :

bool

class LiveRiskEngineConfig ( bypass : bool = False , deny_modify_pending_update : bool = True , max_order_submit_rate : str = '100/00:00:01' , max_order_modify_rate : str = '100/00:00:01' , max_notional_per_order : dict [ str , int ] = {} , debug : bool = False , qsize : int = 10000 )

Bases: RiskEngineConfig

Configuration for LiveRiskEngine instances.

Parameters :

qsize ( PositiveInt , default 10000 ) – The queue size for the engines internal queue buffers.

dict ( ) dict [ str , Any ]

Return a dictionary representation of the configuration.

Returns :

dict[str, Any]

classmethod fully_qualified_name ( ) str

Return the fully qualified name for the NautilusConfig class.

Returns :

str

References

https://www.python.org/dev/peps/pep-3155/

json ( ) bytes

Return serialized JSON encoded bytes.

Returns :

bytes

classmethod parse ( raw : bytes ) Any

Return a decoded object of the given cls .

Parameters :
  • cls ( type ) – The type to decode to.

  • raw ( bytes ) – The raw bytes to decode.

Returns :

Any

validate ( ) bool

Return whether the configuration can be represented as valid JSON.

Returns :

bool

class LiveExecEngineConfig ( load_cache : bool = True , allow_cash_positions : bool = True , debug : bool = False , reconciliation : bool = True , reconciliation_lookback_mins : Optional [ int ] = None , inflight_check_interval_ms : int = 5000 , inflight_check_threshold_ms : int = 1000 , qsize : int = 10000 )

Bases: ExecEngineConfig

Configuration for LiveExecEngine instances.

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.

  • inflight_check_interval_ms ( NonNegativeInt , default 5000 ) – The interval (milliseconds) between checking whether in-flight orders have exceeded their time-in-flight threshold.

  • inflight_check_threshold_ms ( NonNegativeInt , default 1000 ) – The threshold (milliseconds) beyond which an in-flight orders status is checked with the venue.

  • qsize ( PositiveInt , default 10000 ) – The queue size for the engines internal queue buffers.

dict ( ) dict [ str , Any ]

Return a dictionary representation of the configuration.

Returns :

dict[str, Any]

classmethod fully_qualified_name ( ) str

Return the fully qualified name for the NautilusConfig class.

Returns :

str

References

https://www.python.org/dev/peps/pep-3155/

json ( ) bytes

Return serialized JSON encoded bytes.

Returns :

bytes

classmethod parse ( raw : bytes ) Any

Return a decoded object of the given cls .

Parameters :
  • cls ( type ) – The type to decode to.

  • raw ( bytes ) – The raw bytes to decode.

Returns :

Any

validate ( ) bool

Return whether the configuration can be represented as valid JSON.

Returns :

bool

class RoutingConfig ( default : bool = False , venues : Optional [ frozenset [ str ] ] = None )

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.

dict ( ) dict [ str , Any ]

Return a dictionary representation of the configuration.

Returns :

dict[str, Any]

classmethod fully_qualified_name ( ) str

Return the fully qualified name for the NautilusConfig class.

Returns :

str

References

https://www.python.org/dev/peps/pep-3155/

json ( ) bytes

Return serialized JSON encoded bytes.

Returns :

bytes

classmethod parse ( raw : bytes ) Any

Return a decoded object of the given cls .

Parameters :
  • cls ( type ) – The type to decode to.

  • raw ( bytes ) – The raw bytes to decode.

Returns :

Any

validate ( ) bool

Return whether the configuration can be represented as valid JSON.

Returns :

bool

class LiveDataClientConfig ( instrument_provider : InstrumentProviderConfig = InstrumentProviderConfig(load_all=False, load_ids=None, filters=None, filter_callable=None, log_warnings=True) , routing : RoutingConfig = RoutingConfig(default=False, venues=None) )

Bases: NautilusConfig

Configuration for LiveDataClient instances.

Parameters :
dict ( ) dict [ str , Any ]

Return a dictionary representation of the configuration.

Returns :

dict[str, Any]

classmethod fully_qualified_name ( ) str

Return the fully qualified name for the NautilusConfig class.

Returns :

str

References

https://www.python.org/dev/peps/pep-3155/

json ( ) bytes

Return serialized JSON encoded bytes.

Returns :

bytes

classmethod parse ( raw : bytes ) Any

Return a decoded object of the given cls .

Parameters :
  • cls ( type ) – The type to decode to.

  • raw ( bytes ) – The raw bytes to decode.

Returns :

Any

validate ( ) bool

Return whether the configuration can be represented as valid JSON.

Returns :

bool

class LiveExecClientConfig ( instrument_provider : InstrumentProviderConfig = InstrumentProviderConfig(load_all=False, load_ids=None, filters=None, filter_callable=None, log_warnings=True) , routing : RoutingConfig = RoutingConfig(default=False, venues=None) )

Bases: NautilusConfig

Configuration for LiveExecutionClient instances.

Parameters :
dict ( ) dict [ str , Any ]

Return a dictionary representation of the configuration.

Returns :

dict[str, Any]

classmethod fully_qualified_name ( ) str

Return the fully qualified name for the NautilusConfig class.

Returns :

str

References

https://www.python.org/dev/peps/pep-3155/

json ( ) bytes

Return serialized JSON encoded bytes.

Returns :

bytes

classmethod parse ( raw : bytes ) Any

Return a decoded object of the given cls .

Parameters :
  • cls ( type ) – The type to decode to.

  • raw ( bytes ) – The raw bytes to decode.

Returns :

Any

validate ( ) bool

Return whether the configuration can be represented as valid JSON.

Returns :

bool

class TradingNodeConfig ( instance_id : Optional [ str ] = None , cache : Optional [ CacheConfig ] = None , cache_database : Optional [ CacheDatabaseConfig ] = None , data_engine : LiveDataEngineConfig = LiveDataEngineConfig(debug=False, qsize=10000) , risk_engine : LiveRiskEngineConfig = LiveRiskEngineConfig(bypass=False, deny_modify_pending_update=True, max_order_submit_rate='100/00:00:01', max_order_modify_rate='100/00:00:01', max_notional_per_order={}, debug=False, qsize=10000) , exec_engine : LiveExecEngineConfig = LiveExecEngineConfig(load_cache=True, allow_cash_positions=True, debug=False, reconciliation=True, reconciliation_lookback_mins=None, inflight_check_interval_ms=5000, inflight_check_threshold_ms=1000, qsize=10000) , streaming : Optional [ StreamingConfig ] = None , actors : list [ nautilus_trader.config.common.ImportableActorConfig ] = [] , strategies : list [ nautilus_trader.config.common.ImportableStrategyConfig ] = [] , load_state : bool = False , save_state : bool = False , loop_debug : bool = False , log_level : str = 'INFO' , bypass_logging : bool = False , environment : Environment = Environment.LIVE , trader_id : str = 'TRADER-001' , data_clients : dict [ str , nautilus_trader.config.common.ImportableConfig ] = {} , exec_clients : dict [ str , nautilus_trader.config.common.ImportableConfig ] = {} , timeout_connection : float = 10.0 , timeout_reconciliation : float = 10.0 , timeout_portfolio : float = 10.0 , timeout_disconnection : float = 10.0 , timeout_post_stop : float = 10.0 )

Bases: NautilusKernelConfig

Configuration for TradingNode instances.

Parameters :
  • trader_id ( str , default "TRADER-000" ) – The trader ID for the node (must be a name and ID tag separated by a hyphen).

  • cache ( CacheConfig , optional ) – The cache configuration.

  • cache_database ( CacheDatabaseConfig , optional ) – The cache database configuration.

  • data_engine ( LiveDataEngineConfig , optional ) – The live data engine configuration.

  • risk_engine ( LiveRiskEngineConfig , optional ) – The live risk engine configuration.

  • exec_engine ( LiveExecEngineConfig , optional ) – The live execution engine configuration.

  • streaming ( StreamingConfig , optional ) – The configuration for streaming to feather files.

  • data_clients ( dict [ str , ImportableConfig ] , optional ) – The data client configurations.

  • exec_clients ( dict [ str , ImportableConfig ] , optional ) – The execution client configurations.

  • strategies ( list [ ImportableStrategyConfig ] ) – The strategy configurations for the node.

  • 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.

  • 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.

  • timeout_connection ( PositiveFloat ( seconds ) ) – The timeout for all clients to connect and initialize.

  • timeout_reconciliation ( PositiveFloat ( seconds ) ) – The timeout for execution state to reconcile.

  • timeout_portfolio ( PositiveFloat ( seconds ) ) – The timeout for portfolio to initialize margins and unrealized PnLs.

  • timeout_disconnection ( PositiveFloat ( seconds ) ) – The timeout for all engine clients to disconnect.

  • timeout_post_stop ( PositiveFloat ( seconds ) ) – The timeout after stopping the node to await residual events before final shutdown.

dict ( ) dict [ str , Any ]

Return a dictionary representation of the configuration.

Returns :

dict[str, Any]

classmethod fully_qualified_name ( ) str

Return the fully qualified name for the NautilusConfig class.

Returns :

str

References

https://www.python.org/dev/peps/pep-3155/

json ( ) bytes

Return serialized JSON encoded bytes.

Returns :

bytes

classmethod parse ( raw : bytes ) Any

Return a decoded object of the given cls .

Parameters :
  • cls ( type ) – The type to decode to.

  • raw ( bytes ) – The raw bytes to decode.

Returns :

Any

validate ( ) bool

Return whether the configuration can be represented as valid JSON.

Returns :

bool