Config

The config subpackage groups all configuration classes and factories.

All configurations inherit from pydantic.pydantic.BaseModel .

Common

class NautilusConfig

Bases: pydantic.main.BaseModel

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/

classmethod construct ( _fields_set : Optional [ SetStr ] = None , ** values : Any ) Model

Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values

copy ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , update : DictStrAny = None , deep : bool = False ) Model

Duplicate a model, optionally choose which fields to include, exclude and change.

Parameters
  • include – fields to include in new model

  • exclude – fields to exclude from new model, as with values this takes precedence over include

  • update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data

  • deep – set to True to make a deep copy of the model

Returns

new model instance

dict ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , by_alias : bool = False , skip_defaults : bool = None , exclude_unset : bool = False , exclude_defaults : bool = False , exclude_none : bool = False ) DictStrAny

Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

json ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , by_alias : bool = False , skip_defaults : bool = None , exclude_unset : bool = False , exclude_defaults : bool = False , exclude_none : bool = False , encoder : Optional [ Callable [ [ Any ] , Any ] ] = None , models_as_dict : bool = True , ** dumps_kwargs : Any ) unicode

Generate a JSON representation of the model, include and exclude arguments as per dict() .

encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps() .

classmethod update_forward_refs ( ** localns : Any ) None

Try to update ForwardRefs on fields based on this Model, globalns and localns.

class CacheConfig ( * , tick_capacity : pydantic.types.PositiveInt = 1000 , bar_capacity : pydantic.types.PositiveInt = 1000 )

Bases: nautilus_trader.config.common.NautilusConfig

Configuration for Cache instances.

Parameters
  • tick_capacity ( int ) – The maximum length for internal tick deques.

  • bar_capacity ( int ) – The maximum length for internal bar deques.

classmethod construct ( _fields_set : Optional [ SetStr ] = None , ** values : Any ) Model

Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values

copy ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , update : DictStrAny = None , deep : bool = False ) Model

Duplicate a model, optionally choose which fields to include, exclude and change.

Parameters
  • include – fields to include in new model

  • exclude – fields to exclude from new model, as with values this takes precedence over include

  • update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data

  • deep – set to True to make a deep copy of the model

Returns

new model instance

dict ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , by_alias : bool = False , skip_defaults : bool = None , exclude_unset : bool = False , exclude_defaults : bool = False , exclude_none : bool = False ) DictStrAny

Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

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 ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , by_alias : bool = False , skip_defaults : bool = None , exclude_unset : bool = False , exclude_defaults : bool = False , exclude_none : bool = False , encoder : Optional [ Callable [ [ Any ] , Any ] ] = None , models_as_dict : bool = True , ** dumps_kwargs : Any ) unicode

Generate a JSON representation of the model, include and exclude arguments as per dict() .

encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps() .

classmethod update_forward_refs ( ** localns : Any ) None

Try to update ForwardRefs on fields based on this Model, globalns and localns.

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

Bases: nautilus_trader.config.common.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.

classmethod construct ( _fields_set : Optional [ SetStr ] = None , ** values : Any ) Model

Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values

copy ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , update : DictStrAny = None , deep : bool = False ) Model

Duplicate a model, optionally choose which fields to include, exclude and change.

Parameters
  • include – fields to include in new model

  • exclude – fields to exclude from new model, as with values this takes precedence over include

  • update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data

  • deep – set to True to make a deep copy of the model

Returns

new model instance

dict ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , by_alias : bool = False , skip_defaults : bool = None , exclude_unset : bool = False , exclude_defaults : bool = False , exclude_none : bool = False ) DictStrAny

Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

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 ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , by_alias : bool = False , skip_defaults : bool = None , exclude_unset : bool = False , exclude_defaults : bool = False , exclude_none : bool = False , encoder : Optional [ Callable [ [ Any ] , Any ] ] = None , models_as_dict : bool = True , ** dumps_kwargs : Any ) unicode

Generate a JSON representation of the model, include and exclude arguments as per dict() .

encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps() .

classmethod update_forward_refs ( ** localns : Any ) None

Try to update ForwardRefs on fields based on this Model, globalns and localns.

class InstrumentProviderConfig ( * , load_all : bool = False , load_ids : FrozenSet [ str ] = None , filters : Dict [ str , Any ] = None )

Bases: nautilus_trader.config.common.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.

class Config

Bases: object

The base model config

classmethod construct ( _fields_set : Optional [ SetStr ] = None , ** values : Any ) Model

Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values

copy ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , update : DictStrAny = None , deep : bool = False ) Model

Duplicate a model, optionally choose which fields to include, exclude and change.

Parameters
  • include – fields to include in new model

  • exclude – fields to exclude from new model, as with values this takes precedence over include

  • update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data

  • deep – set to True to make a deep copy of the model

Returns

new model instance

dict ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , by_alias : bool = False , skip_defaults : bool = None , exclude_unset : bool = False , exclude_defaults : bool = False , exclude_none : bool = False ) DictStrAny

Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

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 ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , by_alias : bool = False , skip_defaults : bool = None , exclude_unset : bool = False , exclude_defaults : bool = False , exclude_none : bool = False , encoder : Optional [ Callable [ [ Any ] , Any ] ] = None , models_as_dict : bool = True , ** dumps_kwargs : Any ) unicode

Generate a JSON representation of the model, include and exclude arguments as per dict() .

encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps() .

classmethod update_forward_refs ( ** localns : Any ) None

Try to update ForwardRefs on fields based on this Model, globalns and localns.

class DataEngineConfig ( * , debug : bool = False )

Bases: nautilus_trader.config.common.NautilusConfig

Configuration for DataEngine instances.

Parameters

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

classmethod construct ( _fields_set : Optional [ SetStr ] = None , ** values : Any ) Model

Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values

copy ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , update : DictStrAny = None , deep : bool = False ) Model

Duplicate a model, optionally choose which fields to include, exclude and change.

Parameters
  • include – fields to include in new model

  • exclude – fields to exclude from new model, as with values this takes precedence over include

  • update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data

  • deep – set to True to make a deep copy of the model

Returns

new model instance

dict ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , by_alias : bool = False , skip_defaults : bool = None , exclude_unset : bool = False , exclude_defaults : bool = False , exclude_none : bool = False ) DictStrAny

Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

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 ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , by_alias : bool = False , skip_defaults : bool = None , exclude_unset : bool = False , exclude_defaults : bool = False , exclude_none : bool = False , encoder : Optional [ Callable [ [ Any ] , Any ] ] = None , models_as_dict : bool = True , ** dumps_kwargs : Any ) unicode

Generate a JSON representation of the model, include and exclude arguments as per dict() .

encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps() .

classmethod update_forward_refs ( ** localns : Any ) None

Try to update ForwardRefs on fields based on this Model, globalns and localns.

class RiskEngineConfig ( * , bypass : bool = False , max_order_rate : pydantic.types.ConstrainedStr = '100/00:00:01' , max_notional_per_order : Dict [ str , str ] = {} , debug : bool = False )

Bases: nautilus_trader.config.common.NautilusConfig

Configuration for RiskEngine instances.

Parameters
  • bypass ( bool ) – If True then all risk checks are bypassed (will still check for duplicate IDs).

  • max_order_rate ( str , default 100/00:00:01 ) – The maximum order rate per timedelta.

  • max_notional_per_order ( Dict [ str , str ] ) – 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).

classmethod construct ( _fields_set : Optional [ SetStr ] = None , ** values : Any ) Model

Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values

copy ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , update : DictStrAny = None , deep : bool = False ) Model

Duplicate a model, optionally choose which fields to include, exclude and change.

Parameters
  • include – fields to include in new model

  • exclude – fields to exclude from new model, as with values this takes precedence over include

  • update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data

  • deep – set to True to make a deep copy of the model

Returns

new model instance

dict ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , by_alias : bool = False , skip_defaults : bool = None , exclude_unset : bool = False , exclude_defaults : bool = False , exclude_none : bool = False ) DictStrAny

Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

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 ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , by_alias : bool = False , skip_defaults : bool = None , exclude_unset : bool = False , exclude_defaults : bool = False , exclude_none : bool = False , encoder : Optional [ Callable [ [ Any ] , Any ] ] = None , models_as_dict : bool = True , ** dumps_kwargs : Any ) unicode

Generate a JSON representation of the model, include and exclude arguments as per dict() .

encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps() .

classmethod update_forward_refs ( ** localns : Any ) None

Try to update ForwardRefs on fields based on this Model, globalns and localns.

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

Bases: nautilus_trader.config.common.NautilusConfig

Configuration for ExecutionEngine instances.

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

  • allow_cash_positions ( bool , default False ) – If unleveraged spot cash assets should track positions.

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

classmethod construct ( _fields_set : Optional [ SetStr ] = None , ** values : Any ) Model

Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values

copy ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , update : DictStrAny = None , deep : bool = False ) Model

Duplicate a model, optionally choose which fields to include, exclude and change.

Parameters
  • include – fields to include in new model

  • exclude – fields to exclude from new model, as with values this takes precedence over include

  • update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data

  • deep – set to True to make a deep copy of the model

Returns

new model instance

dict ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , by_alias : bool = False , skip_defaults : bool = None , exclude_unset : bool = False , exclude_defaults : bool = False , exclude_none : bool = False ) DictStrAny

Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

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 ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , by_alias : bool = False , skip_defaults : bool = None , exclude_unset : bool = False , exclude_defaults : bool = False , exclude_none : bool = False , encoder : Optional [ Callable [ [ Any ] , Any ] ] = None , models_as_dict : bool = True , ** dumps_kwargs : Any ) unicode

Generate a JSON representation of the model, include and exclude arguments as per dict() .

encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps() .

classmethod update_forward_refs ( ** localns : Any ) None

Try to update ForwardRefs on fields based on this Model, globalns and localns.

class StreamingConfig ( * , catalog_path : str , fs_protocol : str = None , fs_storage_options : Dict = None , flush_interval_ms : int = None , replace_existing : bool = False , include_types : Tuple [ type ] = None )

Bases: nautilus_trader.config.common.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.

classmethod construct ( _fields_set : Optional [ SetStr ] = None , ** values : Any ) Model

Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values

copy ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , update : DictStrAny = None , deep : bool = False ) Model

Duplicate a model, optionally choose which fields to include, exclude and change.

Parameters
  • include – fields to include in new model

  • exclude – fields to exclude from new model, as with values this takes precedence over include

  • update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data

  • deep – set to True to make a deep copy of the model

Returns

new model instance

dict ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , by_alias : bool = False , skip_defaults : bool = None , exclude_unset : bool = False , exclude_defaults : bool = False , exclude_none : bool = False ) DictStrAny

Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

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 ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , by_alias : bool = False , skip_defaults : bool = None , exclude_unset : bool = False , exclude_defaults : bool = False , exclude_none : bool = False , encoder : Optional [ Callable [ [ Any ] , Any ] ] = None , models_as_dict : bool = True , ** dumps_kwargs : Any ) unicode

Generate a JSON representation of the model, include and exclude arguments as per dict() .

encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps() .

classmethod update_forward_refs ( ** localns : Any ) None

Try to update ForwardRefs on fields based on this Model, globalns and localns.

class ActorConfig ( * , component_id : str = None )

Bases: nautilus_trader.config.common.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__ .

classmethod construct ( _fields_set : Optional [ SetStr ] = None , ** values : Any ) Model

Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values

copy ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , update : DictStrAny = None , deep : bool = False ) Model

Duplicate a model, optionally choose which fields to include, exclude and change.

Parameters
  • include – fields to include in new model

  • exclude – fields to exclude from new model, as with values this takes precedence over include

  • update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data

  • deep – set to True to make a deep copy of the model

Returns

new model instance

dict ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , by_alias : bool = False , skip_defaults : bool = None , exclude_unset : bool = False , exclude_defaults : bool = False , exclude_none : bool = False ) DictStrAny

Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

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 ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , by_alias : bool = False , skip_defaults : bool = None , exclude_unset : bool = False , exclude_defaults : bool = False , exclude_none : bool = False , encoder : Optional [ Callable [ [ Any ] , Any ] ] = None , models_as_dict : bool = True , ** dumps_kwargs : Any ) unicode

Generate a JSON representation of the model, include and exclude arguments as per dict() .

encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps() .

classmethod update_forward_refs ( ** localns : Any ) None

Try to update ForwardRefs on fields based on this Model, globalns and localns.

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

Bases: nautilus_trader.config.common.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

classmethod construct ( _fields_set : Optional [ SetStr ] = None , ** values : Any ) Model

Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values

copy ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , update : DictStrAny = None , deep : bool = False ) Model

Duplicate a model, optionally choose which fields to include, exclude and change.

Parameters
  • include – fields to include in new model

  • exclude – fields to exclude from new model, as with values this takes precedence over include

  • update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data

  • deep – set to True to make a deep copy of the model

Returns

new model instance

dict ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , by_alias : bool = False , skip_defaults : bool = None , exclude_unset : bool = False , exclude_defaults : bool = False , exclude_none : bool = False ) DictStrAny

Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

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 ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , by_alias : bool = False , skip_defaults : bool = None , exclude_unset : bool = False , exclude_defaults : bool = False , exclude_none : bool = False , encoder : Optional [ Callable [ [ Any ] , Any ] ] = None , models_as_dict : bool = True , ** dumps_kwargs : Any ) unicode

Generate a JSON representation of the model, include and exclude arguments as per dict() .

encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps() .

classmethod update_forward_refs ( ** localns : Any ) None

Try to update ForwardRefs on fields based on this Model, globalns and localns.

class ActorFactory

Bases: object

Provides actor creation from importable configurations.

static create ( config : nautilus_trader.config.common.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 : str = None , order_id_tag : str = '000' , oms_type : str = None )

Bases: nautilus_trader.config.common.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 ) – 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).

classmethod construct ( _fields_set : Optional [ SetStr ] = None , ** values : Any ) Model

Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values

copy ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , update : DictStrAny = None , deep : bool = False ) Model

Duplicate a model, optionally choose which fields to include, exclude and change.

Parameters
  • include – fields to include in new model

  • exclude – fields to exclude from new model, as with values this takes precedence over include

  • update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data

  • deep – set to True to make a deep copy of the model

Returns

new model instance

dict ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , by_alias : bool = False , skip_defaults : bool = None , exclude_unset : bool = False , exclude_defaults : bool = False , exclude_none : bool = False ) DictStrAny

Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

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 ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , by_alias : bool = False , skip_defaults : bool = None , exclude_unset : bool = False , exclude_defaults : bool = False , exclude_none : bool = False , encoder : Optional [ Callable [ [ Any ] , Any ] ] = None , models_as_dict : bool = True , ** dumps_kwargs : Any ) unicode

Generate a JSON representation of the model, include and exclude arguments as per dict() .

encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps() .

classmethod update_forward_refs ( ** localns : Any ) None

Try to update ForwardRefs on fields based on this Model, globalns and localns.

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

Bases: nautilus_trader.config.common.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

classmethod construct ( _fields_set : Optional [ SetStr ] = None , ** values : Any ) Model

Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values

copy ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , update : DictStrAny = None , deep : bool = False ) Model

Duplicate a model, optionally choose which fields to include, exclude and change.

Parameters
  • include – fields to include in new model

  • exclude – fields to exclude from new model, as with values this takes precedence over include

  • update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data

  • deep – set to True to make a deep copy of the model

Returns

new model instance

dict ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , by_alias : bool = False , skip_defaults : bool = None , exclude_unset : bool = False , exclude_defaults : bool = False , exclude_none : bool = False ) DictStrAny

Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

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 ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , by_alias : bool = False , skip_defaults : bool = None , exclude_unset : bool = False , exclude_defaults : bool = False , exclude_none : bool = False , encoder : Optional [ Callable [ [ Any ] , Any ] ] = None , models_as_dict : bool = True , ** dumps_kwargs : Any ) unicode

Generate a JSON representation of the model, include and exclude arguments as per dict() .

encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps() .

classmethod update_forward_refs ( ** localns : Any ) None

Try to update ForwardRefs on fields based on this Model, globalns and localns.

class StrategyFactory

Bases: object

Provides strategy creation from importable configurations.

static create ( config : nautilus_trader.config.common.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 , cache : nautilus_trader.config.common.CacheConfig = None , cache_database : nautilus_trader.config.common.CacheDatabaseConfig = None , data_engine : nautilus_trader.config.common.DataEngineConfig = None , risk_engine : nautilus_trader.config.common.RiskEngineConfig = None , exec_engine : nautilus_trader.config.common.ExecEngineConfig = None , streaming : nautilus_trader.config.common.StreamingConfig = None , actors : List [ nautilus_trader.config.common.ImportableActorConfig ] = None , strategies : List [ nautilus_trader.config.common.ImportableStrategyConfig ] = None , load_state : bool = False , save_state : bool = False , loop_debug : bool = False , log_level : str = 'INFO' , bypass_logging : bool = False )

Bases: nautilus_trader.config.common.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.

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

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

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

classmethod construct ( _fields_set : Optional [ SetStr ] = None , ** values : Any ) Model

Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values

copy ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , update : DictStrAny = None , deep : bool = False ) Model

Duplicate a model, optionally choose which fields to include, exclude and change.

Parameters
  • include – fields to include in new model

  • exclude – fields to exclude from new model, as with values this takes precedence over include

  • update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data

  • deep – set to True to make a deep copy of the model

Returns

new model instance

dict ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , by_alias : bool = False , skip_defaults : bool = None , exclude_unset : bool = False , exclude_defaults : bool = False , exclude_none : bool = False ) DictStrAny

Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

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 ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , by_alias : bool = False , skip_defaults : bool = None , exclude_unset : bool = False , exclude_defaults : bool = False , exclude_none : bool = False , encoder : Optional [ Callable [ [ Any ] , Any ] ] = None , models_as_dict : bool = True , ** dumps_kwargs : Any ) unicode

Generate a JSON representation of the model, include and exclude arguments as per dict() .

encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps() .

classmethod update_forward_refs ( ** localns : Any ) None

Try to update ForwardRefs on fields based on this Model, globalns and localns.

Backtest

class Partialable

Bases: object

The abstract base class for all partialable configurations.

update ( ** kwargs )

Update attributes on this instance.

replace ( ** kwargs )

Return a new instance with some attributes replaced.

class BacktestVenueConfig ( name : str , oms_type : str , account_type : str , base_currency : Optional [ str ] , starting_balances : List [ str ] , default_leverage : float = 1.0 , leverages : Optional [ Dict [ str , float ] ] = None , book_type : str = 'L1_TBBO' , routing : bool = False )

Bases: nautilus_trader.config.backtest.Partialable

Represents a venue configuration for one specific backtest engine.

replace ( ** kwargs )

Return a new instance with some attributes replaced.

update ( ** kwargs )

Update attributes on this instance.

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

Bases: nautilus_trader.config.backtest.Partialable

Represents the data configuration for one specific backtest run.

replace ( ** kwargs )

Return a new instance with some attributes replaced.

update ( ** kwargs )

Update attributes on this instance.

class BacktestEngineConfig ( * , environment : nautilus_trader.common.Environment = Environment.BACKTEST , trader_id : str = 'BACKTESTER-001' , cache : nautilus_trader.config.common.CacheConfig = None , cache_database : nautilus_trader.config.common.CacheDatabaseConfig = None , data_engine : nautilus_trader.config.common.DataEngineConfig = DataEngineConfig(debug=False) , risk_engine : nautilus_trader.config.common.RiskEngineConfig = RiskEngineConfig(bypass=False, max_order_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=False, debug=False) , streaming : nautilus_trader.config.common.StreamingConfig = None , actors : List [ nautilus_trader.config.common.ImportableActorConfig ] = None , strategies : List [ nautilus_trader.config.common.ImportableStrategyConfig ] = None , load_state : bool = False , save_state : bool = False , loop_debug : bool = False , log_level : str = 'INFO' , bypass_logging : bool = False , run_analysis : bool = True )

Bases: nautilus_trader.config.common.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.

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

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

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

  • load_strategy_state ( bool , default True ) – If trading strategy state should be loaded from the database on start.

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

classmethod construct ( _fields_set : Optional [ SetStr ] = None , ** values : Any ) Model

Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values

copy ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , update : DictStrAny = None , deep : bool = False ) Model

Duplicate a model, optionally choose which fields to include, exclude and change.

Parameters
  • include – fields to include in new model

  • exclude – fields to exclude from new model, as with values this takes precedence over include

  • update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data

  • deep – set to True to make a deep copy of the model

Returns

new model instance

dict ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , by_alias : bool = False , skip_defaults : bool = None , exclude_unset : bool = False , exclude_defaults : bool = False , exclude_none : bool = False ) DictStrAny

Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

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 ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , by_alias : bool = False , skip_defaults : bool = None , exclude_unset : bool = False , exclude_defaults : bool = False , exclude_none : bool = False , encoder : Optional [ Callable [ [ Any ] , Any ] ] = None , models_as_dict : bool = True , ** dumps_kwargs : Any ) unicode

Generate a JSON representation of the model, include and exclude arguments as per dict() .

encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps() .

classmethod update_forward_refs ( ** localns : Any ) None

Try to update ForwardRefs on fields based on this Model, globalns and localns.

class BacktestRunConfig ( engine : Optional [ nautilus_trader.config.backtest.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: nautilus_trader.config.backtest.Partialable

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

classmethod parse_raw ( raw : Union [ str , bytes ] )

Overloaded so that Partialable base class is explicitly set

replace ( ** kwargs )

Return a new instance with some attributes replaced.

update ( ** kwargs )

Update attributes on this instance.

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 ImportableClientConfig

Bases: nautilus_trader.config.common.NautilusConfig

Represents a live data or execution client configuration.

classmethod construct ( _fields_set : Optional [ SetStr ] = None , ** values : Any ) Model

Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values

copy ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , update : DictStrAny = None , deep : bool = False ) Model

Duplicate a model, optionally choose which fields to include, exclude and change.

Parameters
  • include – fields to include in new model

  • exclude – fields to exclude from new model, as with values this takes precedence over include

  • update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data

  • deep – set to True to make a deep copy of the model

Returns

new model instance

dict ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , by_alias : bool = False , skip_defaults : bool = None , exclude_unset : bool = False , exclude_defaults : bool = False , exclude_none : bool = False ) DictStrAny

Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

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 ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , by_alias : bool = False , skip_defaults : bool = None , exclude_unset : bool = False , exclude_defaults : bool = False , exclude_none : bool = False , encoder : Optional [ Callable [ [ Any ] , Any ] ] = None , models_as_dict : bool = True , ** dumps_kwargs : Any ) unicode

Generate a JSON representation of the model, include and exclude arguments as per dict() .

encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps() .

classmethod update_forward_refs ( ** localns : Any ) None

Try to update ForwardRefs on fields based on this Model, globalns and localns.

class LiveDataEngineConfig ( * , debug : bool = False , qsize : pydantic.types.PositiveInt = 10000 )

Bases: nautilus_trader.config.common.DataEngineConfig

Configuration for LiveDataEngine instances.

classmethod construct ( _fields_set : Optional [ SetStr ] = None , ** values : Any ) Model

Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values

copy ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , update : DictStrAny = None , deep : bool = False ) Model

Duplicate a model, optionally choose which fields to include, exclude and change.

Parameters
  • include – fields to include in new model

  • exclude – fields to exclude from new model, as with values this takes precedence over include

  • update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data

  • deep – set to True to make a deep copy of the model

Returns

new model instance

dict ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , by_alias : bool = False , skip_defaults : bool = None , exclude_unset : bool = False , exclude_defaults : bool = False , exclude_none : bool = False ) DictStrAny

Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

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 ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , by_alias : bool = False , skip_defaults : bool = None , exclude_unset : bool = False , exclude_defaults : bool = False , exclude_none : bool = False , encoder : Optional [ Callable [ [ Any ] , Any ] ] = None , models_as_dict : bool = True , ** dumps_kwargs : Any ) unicode

Generate a JSON representation of the model, include and exclude arguments as per dict() .

encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps() .

classmethod update_forward_refs ( ** localns : Any ) None

Try to update ForwardRefs on fields based on this Model, globalns and localns.

class LiveRiskEngineConfig ( * , bypass : bool = False , max_order_rate : pydantic.types.ConstrainedStr = '100/00:00:01' , max_notional_per_order : Dict [ str , str ] = {} , debug : bool = False , qsize : pydantic.types.PositiveInt = 10000 )

Bases: nautilus_trader.config.common.RiskEngineConfig

Configuration for LiveRiskEngine instances.

classmethod construct ( _fields_set : Optional [ SetStr ] = None , ** values : Any ) Model

Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values

copy ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , update : DictStrAny = None , deep : bool = False ) Model

Duplicate a model, optionally choose which fields to include, exclude and change.

Parameters
  • include – fields to include in new model

  • exclude – fields to exclude from new model, as with values this takes precedence over include

  • update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data

  • deep – set to True to make a deep copy of the model

Returns

new model instance

dict ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , by_alias : bool = False , skip_defaults : bool = None , exclude_unset : bool = False , exclude_defaults : bool = False , exclude_none : bool = False ) DictStrAny

Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

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 ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , by_alias : bool = False , skip_defaults : bool = None , exclude_unset : bool = False , exclude_defaults : bool = False , exclude_none : bool = False , encoder : Optional [ Callable [ [ Any ] , Any ] ] = None , models_as_dict : bool = True , ** dumps_kwargs : Any ) unicode

Generate a JSON representation of the model, include and exclude arguments as per dict() .

encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps() .

classmethod update_forward_refs ( ** localns : Any ) None

Try to update ForwardRefs on fields based on this Model, globalns and localns.

class LiveExecEngineConfig ( * , load_cache : bool = True , allow_cash_positions : bool = False , debug : bool = False , reconciliation_auto : bool = True , reconciliation_lookback_mins : pydantic.types.PositiveInt = None , qsize : pydantic.types.PositiveInt = 10000 )

Bases: nautilus_trader.config.common.ExecEngineConfig

Configuration for LiveExecEngine instances.

Parameters
  • reconciliation_auto ( bool ) – If reconciliation should automatically generate events to align state.

  • reconciliation_lookback_mins ( int , optional ) – The maximum lookback minutes to reconcile state for. If None then will use the maximum lookback available from the venues.

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

classmethod construct ( _fields_set : Optional [ SetStr ] = None , ** values : Any ) Model

Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values

copy ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , update : DictStrAny = None , deep : bool = False ) Model

Duplicate a model, optionally choose which fields to include, exclude and change.

Parameters
  • include – fields to include in new model

  • exclude – fields to exclude from new model, as with values this takes precedence over include

  • update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data

  • deep – set to True to make a deep copy of the model

Returns

new model instance

dict ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , by_alias : bool = False , skip_defaults : bool = None , exclude_unset : bool = False , exclude_defaults : bool = False , exclude_none : bool = False ) DictStrAny

Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

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 ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , by_alias : bool = False , skip_defaults : bool = None , exclude_unset : bool = False , exclude_defaults : bool = False , exclude_none : bool = False , encoder : Optional [ Callable [ [ Any ] , Any ] ] = None , models_as_dict : bool = True , ** dumps_kwargs : Any ) unicode

Generate a JSON representation of the model, include and exclude arguments as per dict() .

encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps() .

classmethod update_forward_refs ( ** localns : Any ) None

Try to update ForwardRefs on fields based on this Model, globalns and localns.

class RoutingConfig ( * , default : bool = False , venues : FrozenSet [ str ] = None )

Bases: nautilus_trader.config.common.NautilusConfig

Configuration for live client message routing.

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.

classmethod construct ( _fields_set : Optional [ SetStr ] = None , ** values : Any ) Model

Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values

copy ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , update : DictStrAny = None , deep : bool = False ) Model

Duplicate a model, optionally choose which fields to include, exclude and change.

Parameters
  • include – fields to include in new model

  • exclude – fields to exclude from new model, as with values this takes precedence over include

  • update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data

  • deep – set to True to make a deep copy of the model

Returns

new model instance

dict ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , by_alias : bool = False , skip_defaults : bool = None , exclude_unset : bool = False , exclude_defaults : bool = False , exclude_none : bool = False ) DictStrAny

Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

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 ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , by_alias : bool = False , skip_defaults : bool = None , exclude_unset : bool = False , exclude_defaults : bool = False , exclude_none : bool = False , encoder : Optional [ Callable [ [ Any ] , Any ] ] = None , models_as_dict : bool = True , ** dumps_kwargs : Any ) unicode

Generate a JSON representation of the model, include and exclude arguments as per dict() .

encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps() .

classmethod update_forward_refs ( ** localns : Any ) None

Try to update ForwardRefs on fields based on this Model, globalns and localns.

class LiveDataClientConfig ( * , instrument_provider : nautilus_trader.config.common.InstrumentProviderConfig = InstrumentProviderConfig(load_all=False, load_ids=None, filters=None) , routing : nautilus_trader.config.live.RoutingConfig = RoutingConfig(default=False, venues=None) )

Bases: nautilus_trader.config.common.NautilusConfig

Configuration for LiveDataClient instances.

Parameters
classmethod construct ( _fields_set : Optional [ SetStr ] = None , ** values : Any ) Model

Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values

copy ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , update : DictStrAny = None , deep : bool = False ) Model

Duplicate a model, optionally choose which fields to include, exclude and change.

Parameters
  • include – fields to include in new model

  • exclude – fields to exclude from new model, as with values this takes precedence over include

  • update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data

  • deep – set to True to make a deep copy of the model

Returns

new model instance

dict ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , by_alias : bool = False , skip_defaults : bool = None , exclude_unset : bool = False , exclude_defaults : bool = False , exclude_none : bool = False ) DictStrAny

Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

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 ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , by_alias : bool = False , skip_defaults : bool = None , exclude_unset : bool = False , exclude_defaults : bool = False , exclude_none : bool = False , encoder : Optional [ Callable [ [ Any ] , Any ] ] = None , models_as_dict : bool = True , ** dumps_kwargs : Any ) unicode

Generate a JSON representation of the model, include and exclude arguments as per dict() .

encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps() .

classmethod update_forward_refs ( ** localns : Any ) None

Try to update ForwardRefs on fields based on this Model, globalns and localns.

class LiveExecClientConfig ( * , instrument_provider : nautilus_trader.config.common.InstrumentProviderConfig = InstrumentProviderConfig(load_all=False, load_ids=None, filters=None) , routing : nautilus_trader.config.live.RoutingConfig = RoutingConfig(default=False, venues=None) )

Bases: nautilus_trader.config.common.NautilusConfig

Configuration for LiveExecutionClient instances.

Parameters
classmethod construct ( _fields_set : Optional [ SetStr ] = None , ** values : Any ) Model

Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values

copy ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , update : DictStrAny = None , deep : bool = False ) Model

Duplicate a model, optionally choose which fields to include, exclude and change.

Parameters
  • include – fields to include in new model

  • exclude – fields to exclude from new model, as with values this takes precedence over include

  • update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data

  • deep – set to True to make a deep copy of the model

Returns

new model instance

dict ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , by_alias : bool = False , skip_defaults : bool = None , exclude_unset : bool = False , exclude_defaults : bool = False , exclude_none : bool = False ) DictStrAny

Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

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 ( * , include : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , exclude : Union [ AbstractSetIntStr , MappingIntStrAny ] = None , by_alias : bool = False , skip_defaults : bool = None , exclude_unset : bool = False , exclude_defaults : bool = False , exclude_none : bool = False , encoder : Optional [ Callable [ [ Any ] , Any ] ] = None , models_as_dict : bool = True , ** dumps_kwargs : Any ) unicode

Generate a JSON representation of the model, include and exclude arguments as per dict() .

encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps() .

classmethod update_forward_refs ( ** localns : Any ) None

Try to update ForwardRefs on fields based on this Model, globalns and localns.

class TradingNodeConfig ( * , environment : nautilus_trader.common.Environment = Environment.LIVE , trader_id : str = 'TRADER-001' , cache : nautilus_trader.config.common.CacheConfig = None , cache_database : nautilus_trader.config.common.CacheDatabaseConfig = None , data_engine : nautilus_trader.config.live.LiveDataEngineConfig = LiveDataEngineConfig(debug=False, qsize=10000) , risk_engine : nautilus_trader.config.live.LiveRiskEngineConfig = LiveRiskEngineConfig(bypass=False, max_order_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=False, debug=False, reconciliation_auto=True, reconciliation_lookback_mins=None, qsize=10000) , streaming : nautilus_trader.config.common.StreamingConfig = None , actors : List [ nautilus_trader.config.common.ImportableActorConfig ] = None , strategies : List [ nautilus_trader.config.common.ImportableStrategyConfig ] = None , load_state : bool = False , save_state : bool = False , loop_debug : bool = False , log_level : str = 'INFO' , bypass_logging : bool = False , data_clients : Dict [ str , nautilus_trader.config.live.LiveDataClientConfig ] = {} , exec_clients : Dict [ str , nautilus_trader.config.live.LiveExecClientConfig ] = {} , timeout_connection : pydantic.types.PositiveFloat = 10.0 , timeout_reconciliation : pydantic.types.PositiveFloat = 10.0 , timeout_portfolio : pydantic.types.PositiveFloat = 10.0 , timeout_disconnection : pydantic.types.PositiveFloat = 10.0 , timeout_post_stop : pydantic.types.PositiveFloat = 10.0 )

Bases: nautilus_trader.config.common.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 , LiveDataClientConfig ] , optional ) – The data client configurations.

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

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

  • load_strategy_state ( bool , default True ) – If trading strategy state should be loaded from the database on start.

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