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
- 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 a
Cache
instance.- 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
- 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 : Optional [ int ] = None , username : Optional [ str ] = None , password : Optional [ str ] = None , ssl : bool = False , flush : bool = False ) ¶
-
Bases:
NautilusConfig
Configuration for a
CacheDatabase
instance.- Parameters :
-
-
type ( str , {'in-memory' , 'redis'} , default 'in-memory' ) – The database type.
-
host ( str , default 'localhost' ) – The database host address.
-
port ( int , optional ) – The database port.
-
username ( str , optional ) – The account username for the database connection.
-
password ( str , optional ) – The account password for the database connection.
-
ssl ( bool , default False ) – If database should use an SSL enabled connection.
-
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
- 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 an
InstrumentProvider
instance.- 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
- 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 ( time_bars_build_with_no_updates : bool = True , time_bars_timestamp_on_close : bool = True , validate_data_sequence : bool = False , debug : bool = False ) ¶
-
Bases:
NautilusConfig
Configuration for a
DataEngine
instance.- 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.
-
validate_data_sequence ( bool , default False ) – If data objects timestamp sequencing will be validated and handled.
-
debug ( bool , default False ) – 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
- 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 , 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] = <factory> , debug: bool = False ) ¶
-
Bases:
NautilusConfig
Configuration for a
RiskEngine
instance.- 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).
-
- 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
- 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 an
ExecutionEngine
instance.- 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 , default False ) – 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
- 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 an
OrderEmulator
instance.- 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
- 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
- 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 DataCatalogConfig ( path : str , fs_protocol : Optional [ str ] = None , fs_storage_options : Optional [ dict ] = None , use_rust : bool = False ) ¶
-
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.
-
use_rust ( bool , default False ) – If queries will be for Rust schema versions (when implemented).
-
- 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
- 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
- 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
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
-
- 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
- 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
- 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
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
-
- 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
- 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: ~nautilus_trader.common.Environment , trader_id: str , instance_id: ~typing.Optional[str] = None , cache: ~typing.Optional[~nautilus_trader.config.common.CacheConfig] = None , cache_database: ~typing.Optional[~nautilus_trader.config.common.CacheDatabaseConfig] = None , data_engine: ~typing.Optional[~nautilus_trader.config.common.DataEngineConfig] = None , risk_engine: ~typing.Optional[~nautilus_trader.config.common.RiskEngineConfig] = None , exec_engine: ~typing.Optional[~nautilus_trader.config.common.ExecEngineConfig] = None , streaming: ~typing.Optional[~nautilus_trader.config.common.StreamingConfig] = None , catalog: ~typing.Optional[~nautilus_trader.config.common.DataCatalogConfig] = None , actors: list[nautilus_trader.config.common.ImportableActorConfig] = <factory> , strategies: list[nautilus_trader.config.common.ImportableStrategyConfig] = <factory> , load_state: bool = False , save_state: bool = False , loop_debug: bool = False , log_level: str = 'INFO' , log_level_file: str = 'DEBUG' , log_file_path: ~typing.Optional[str] = None , log_rate_limit: int = 100000 , bypass_logging: bool = False ) ¶
-
Bases:
NautilusConfig
Configuration for a
NautilusKernel
core system instance.- 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.
-
catalog ( DataCatalogConfig , optional ) – The data catalog config.
-
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 minimum log level to write to stdout.
-
log_level_file ( str , default "DEBUG" ) – The minimum log level to write to a log file.
-
log_file_path ( str , optional ) – The optional log file path. If
None
then will not log to a file. -
log_rate_limit ( int , default 100_000 ) – The maximum messages per second which can be flushed to stdout or stderr.
-
bypass_logging ( bool , default False ) – If all logging 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
- 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
- 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> , factory: ~typing.Optional[~nautilus_trader.config.common.ImportableFactoryConfig] = None ) ¶
-
Bases:
NautilusConfig
Represents an importable (typically live data client or live 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
- 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 , modules : Optional [ list [ nautilus_trader.config.common.ImportableConfig ] ] = None ) ¶
-
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
- 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 , bar_spec : Optional [ str ] = None , use_rust : Optional [ bool ] = False , batch_size : Optional [ int ] = 10000 ) ¶
-
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
- 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 ( environment: ~nautilus_trader.common.Environment = Environment.BACKTEST , trader_id: str = 'BACKTESTER-001' , instance_id: ~typing.Optional[str] = None , cache: ~typing.Optional[~nautilus_trader.config.common.CacheConfig] = None , cache_database: ~typing.Optional[~nautilus_trader.config.common.CacheDatabaseConfig] = None , data_engine: ~nautilus_trader.config.common.DataEngineConfig = DataEngineConfig(time_bars_build_with_no_updates=True , time_bars_timestamp_on_close=True , validate_data_sequence=False , debug=False) , risk_engine: ~nautilus_trader.config.common.RiskEngineConfig = RiskEngineConfig(bypass=False , max_order_submit_rate='100/00:00:01' , max_order_modify_rate='100/00:00:01' , max_notional_per_order={} , debug=False) , exec_engine: ~nautilus_trader.config.common.ExecEngineConfig = ExecEngineConfig(load_cache=True , allow_cash_positions=True , debug=False) , streaming: ~typing.Optional[~nautilus_trader.config.common.StreamingConfig] = None , catalog: ~typing.Optional[~nautilus_trader.config.common.DataCatalogConfig] = None , actors: list[nautilus_trader.config.common.ImportableActorConfig] = <factory> , strategies: list[nautilus_trader.config.common.ImportableStrategyConfig] = <factory> , load_state: bool = False , save_state: bool = False , loop_debug: bool = False , log_level: str = 'INFO' , log_level_file: str = 'DEBUG' , log_file_path: ~typing.Optional[str] = None , log_rate_limit: int = 100000 , bypass_logging: bool = False , 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
- 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
- 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 : Optional [ 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 ( time_bars_build_with_no_updates : bool = True , time_bars_timestamp_on_close : bool = True , validate_data_sequence : bool = False , debug : bool = False , qsize : int = 10000 ) ¶
-
Bases:
DataEngineConfig
Configuration for
LiveDataEngine
instances.- Parameters :
-
qsize ( PositiveInt , default 10_000 ) – 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
- 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 , 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] = <factory> , debug: bool = False , qsize: int = 10000 ) ¶
-
Bases:
RiskEngineConfig
Configuration for
LiveRiskEngine
instances.- Parameters :
-
qsize ( PositiveInt , default 10_000 ) – 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
- 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 = 2000 , inflight_check_threshold_ms : int = 5000 , qsize : int = 10000 ) ¶
-
Bases:
ExecEngineConfig
Configuration for
LiveExecEngine
instances.The purpose of the in-flight order check is for live reconciliation, events emitted from the exchange 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. -
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).
-
qsize ( PositiveInt , default 10_000 ) – 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
- 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
- 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 ( handle_revised_bars : bool = False , 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 :
-
-
handle_revised_bars ( bool ) – If DataClient will emit bar updates as soon new bar opens.
-
instrument_provider ( InstrumentProviderConfig ) – The clients instrument provider configuration.
-
routing ( RoutingConfig ) – The clients message routing 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
- 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 :
-
-
instrument_provider ( InstrumentProviderConfig ) – The clients instrument provider configuration.
-
routing ( RoutingConfig ) – The clients message routing 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
- 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 ( environment: ~nautilus_trader.common.Environment = Environment.LIVE , trader_id: str = 'TRADER-001' , instance_id: ~typing.Optional[str] = None , cache: ~typing.Optional[~nautilus_trader.config.common.CacheConfig] = None , cache_database: ~typing.Optional[~nautilus_trader.config.common.CacheDatabaseConfig] = None , data_engine: ~nautilus_trader.config.live.LiveDataEngineConfig = LiveDataEngineConfig(time_bars_build_with_no_updates=True , time_bars_timestamp_on_close=True , validate_data_sequence=False , debug=False , qsize=10000) , risk_engine: ~nautilus_trader.config.live.LiveRiskEngineConfig = LiveRiskEngineConfig(bypass=False , 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: ~nautilus_trader.config.live.LiveExecEngineConfig = LiveExecEngineConfig(load_cache=True , allow_cash_positions=True , debug=False , reconciliation=True , reconciliation_lookback_mins=None , inflight_check_interval_ms=2000 , inflight_check_threshold_ms=5000 , qsize=10000) , streaming: ~typing.Optional[~nautilus_trader.config.common.StreamingConfig] = None , catalog: ~typing.Optional[~nautilus_trader.config.common.DataCatalogConfig] = None , actors: list[nautilus_trader.config.common.ImportableActorConfig] = <factory> , strategies: list[nautilus_trader.config.common.ImportableStrategyConfig] = <factory> , load_state: bool = False , save_state: bool = False , loop_debug: bool = False , log_level: str = 'INFO' , log_level_file: str = 'DEBUG' , log_file_path: ~typing.Optional[str] = None , log_rate_limit: int = 100000 , bypass_logging: bool = False , data_clients: dict[str , nautilus_trader.config.common.ImportableConfig] = <factory> , exec_clients: dict[str , nautilus_trader.config.common.ImportableConfig] = <factory> , 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 | LiveDataClientConfig ] , optional ) – The data client configurations.
-
exec_clients ( dict [ str , ImportableConfig | LiveExecClientConfig ] , 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
- 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