Config¶
Backtest¶
- class BacktestVenueConfig¶
Bases:
NautilusConfigRepresents a venue configuration for one specific backtest engine.
- Parameters:
name (str) – The name of the venue.
oms_type (OmsType | str) – The order management system type for the exchange. If
HEDGINGwill generate new position IDs.account_type (AccountType | str) – The account type for the exchange.
starting_balances (list[Money | str]) – The starting account balances (specify one for a single asset account).
base_currency (Currency | str, optional) – The account base currency for the exchange. Use
Nonefor multi-currency accounts.default_leverage (float, optional) – The account default leverage (for margin accounts).
leverages (dict[str, float], optional) – The instrument specific leverage configuration (for margin accounts).
margin_model (MarginModelConfig, optional) – The margin calculation model configuration. Default ‘leveraged’.
modules (list[ImportableActorConfig], optional) – The simulation modules for the venue.
fill_model (ImportableFillModelConfig, optional) – The fill model for the venue.
latency_model (ImportableLatencyModelConfig, optional) – The latency model for the venue.
fee_model (ImportableFeeModelConfig, optional) – The fee model for the venue.
book_type (str, default 'L1_MBP') – The default order book type.
routing (bool, default False) – If multi-venue routing should be enabled for the execution client.
reject_stop_orders (bool, default True) – If stop orders are rejected on submission if trigger price is in the market.
support_gtd_orders (bool, default True) – If orders with GTD time in force will be supported by the venue.
support_contingent_orders (bool, default True) – If contingent orders will be supported/respected by the venue. If False, then it’s expected the strategy will be managing any contingent orders.
oto_trigger_mode (OtoTriggerMode | str, default "PARTIAL") – The OTO trigger mode for contingent orders: -
PARTIAL: release child orders pro-rata to each partial fill (default). -FULL: release child orders only once the parent is fully filled.use_position_ids (bool, default True) – If venue position IDs will be generated on order fills.
use_random_ids (bool, default False) – If all venue generated identifiers will be random UUID4’s.
use_reduce_only (bool, default True) – If the reduce_only execution instruction on orders will be honored.
use_market_order_acks (bool, default False) – If OrderAccepted events will be generated for market orders before filling.
bar_execution (bool, default True) – If bars should be processed by the matching engine(s) (and move the market).
bar_adaptive_high_low_ordering (bool, default False) – Determines whether the processing order of bar prices is adaptive based on a heuristic. This setting is only relevant when bar_execution is True. If False, bar prices are always processed in the fixed order: Open, High, Low, Close. If True, the processing order adapts with the heuristic: - If High is closer to Open than Low then the processing order is Open, High, Low, Close. - If Low is closer to Open than High then the processing order is Open, Low, High, Close.
trade_execution (bool, default True) – If trades should be processed by the matching engine(s) (and move the market).
liquidity_consumption (bool, default False) – If liquidity consumption should be tracked per price level. When enabled, fills consume available liquidity which resets when fresh data arrives at that level. When disabled, each iteration can fill against the full book liquidity independently.
queue_position (bool, default False) – If queue position tracking should be enabled for limit orders during trade execution mode. When enabled, limit orders only fill after the quantity ahead of them (at order placement time) has been traded through or the price level is deleted. Requires trade_execution=True.
allow_cash_borrowing (bool, default False) – If borrowing is allowed for cash accounts (negative balances).
frozen_account (bool, default False) – If the account for this exchange is frozen (balances will not change).
price_protection_points (NonNegativeInt, default 0) – Defines an exchange-calculated price boundary (in points) to prevent marketable orders from executing at excessively aggressive prices. For BUY orders: protection_price = ask + (points * price_increment). For SELL orders: protection_price = bid - (points * price_increment). Set to 0 to disable price protection.
settlement_prices (dict[InstrumentId, float], optional) – Map of instrument ID to settlement price for expiring instruments. For futures, positions close at this price instead of market. For options, the option leg settles at this price.
- name: str¶
- oms_type: OmsType | str¶
- account_type: AccountType | str¶
- starting_balances: list[str]¶
- base_currency: str | None¶
- default_leverage: float¶
- leverages: dict[str, float] | None¶
- margin_model: MarginModelConfig | None¶
- modules: list[ImportableActorConfig] | None¶
- fill_model: ImportableFillModelConfig | None¶
- latency_model: ImportableLatencyModelConfig | None¶
- fee_model: ImportableFeeModelConfig | None¶
- book_type: BookType | str¶
- routing: bool¶
- reject_stop_orders: bool¶
- support_gtd_orders: bool¶
- support_contingent_orders: bool¶
- oto_trigger_mode: OtoTriggerMode | str¶
- use_position_ids: bool¶
- use_random_ids: bool¶
- use_reduce_only: bool¶
- use_market_order_acks: bool¶
- bar_execution: bool¶
- bar_adaptive_high_low_ordering: bool¶
- trade_execution: bool¶
- liquidity_consumption: bool¶
- queue_position: bool¶
- allow_cash_borrowing: bool¶
- frozen_account: bool¶
- price_protection_points: Annotated[int, msgspec.Meta(ge=0)]¶
- settlement_prices: dict[InstrumentId, float] | None¶
- dict() dict[str, Any]¶
Return a dictionary representation of the configuration.
- Return type:
dict[str, Any]
- classmethod fully_qualified_name() str¶
Return the fully qualified name for the NautilusConfig class.
- Return type:
str
References
- property id: str¶
Return the hashed identifier for the configuration.
- Return type:
str
- json() bytes¶
Return serialized JSON encoded bytes.
- Return type:
bytes
- json_primitives() dict[str, Any]¶
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type:
dict[str, Any]
- classmethod json_schema() dict[str, Any]¶
Generate a JSON schema for this configuration class.
- Return type:
dict[str, Any]
- classmethod parse(raw: bytes | str) Any¶
Return a decoded object of the given cls.
- Parameters:
cls (type) – The type to decode to.
raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type:
Any
- validate() bool¶
Return whether the configuration can be represented as valid JSON.
- Return type:
bool
- class BacktestDataConfig¶
Bases:
NautilusConfigRepresents the data configuration for one specific backtest run.
- Parameters:
catalog_path (str) – The path to the data catalog.
data_cls (str) – The data type for the configuration.
catalog_fs_protocol (str, optional) – The fsspec filesystem protocol for the catalog.
catalog_fs_storage_options (dict, optional) – The fsspec storage options.
catalog_fs_rust_storage_options (dict, optional) – The fsspec storage options for the Rust backend.
instrument_id (InstrumentId | str, optional) – The instrument ID for the data configuration.
start_time (str or int, optional) – The start time for the data configuration. Can be an ISO 8601 format datetime string, or UNIX nanoseconds integer.
end_time (str or int, optional) – The end time for the data configuration. Can be an ISO 8601 format datetime string, or UNIX nanoseconds integer.
filter_expr (str, optional) – The additional filter expressions for a data catalog query that uses pyarrow.
client_id (str, optional) – The client ID for the data configuration.
metadata (dict or callable, optional) – The metadata for the data catalog query.
bar_spec (BarSpecification | str, optional) – The bar specification for the data catalog query.
instrument_ids (list[InstrumentId | str], optional) – The instrument IDs for the data catalog query. Can be used if instrument_id is not specified. If bar_spec is specified an equivalent list of bar_types will be constructed.
bar_types (list[BarType | str], optional) – The bar types for the data catalog query. Can be used if instrument_id is not specified.
optimize_file_loading (bool, default False) – If True, registers entire directories with the query backend for efficient loading. If False, registers each file individually (e.g. for precise file control).
- catalog_path: str¶
- data_cls: str¶
- catalog_fs_protocol: str | None¶
- catalog_fs_storage_options: dict | None¶
- catalog_fs_rust_storage_options: dict | None¶
- instrument_id: InstrumentId | None¶
- start_time: str | int | None¶
- end_time: str | int | None¶
- filter_expr: str | None¶
- client_id: str | None¶
- metadata: dict | Any | None¶
- bar_spec: str | None¶
- instrument_ids: list[str] | None¶
- bar_types: list[str] | None¶
- optimize_file_loading: bool¶
- property data_type: type¶
Return a type for the specified data_cls for the configuration.
- Return type:
- property query: dict[str, Any]¶
Return a catalog query object for the configuration.
- Return type:
dict[str, Any]
- property start_time_nanos: int¶
Return the data configuration start time in UNIX nanoseconds.
Will be zero if no start_time was specified.
- Return type:
int
- property end_time_nanos: int¶
Return the data configuration end time in UNIX nanoseconds.
Will be sys.maxsize if no end_time was specified.
- Return type:
int
- dict() dict[str, Any]¶
Return a dictionary representation of the configuration.
- Return type:
dict[str, Any]
- classmethod fully_qualified_name() str¶
Return the fully qualified name for the NautilusConfig class.
- Return type:
str
References
- property id: str¶
Return the hashed identifier for the configuration.
- Return type:
str
- json() bytes¶
Return serialized JSON encoded bytes.
- Return type:
bytes
- json_primitives() dict[str, Any]¶
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type:
dict[str, Any]
- classmethod json_schema() dict[str, Any]¶
Generate a JSON schema for this configuration class.
- Return type:
dict[str, Any]
- classmethod parse(raw: bytes | str) Any¶
Return a decoded object of the given cls.
- Parameters:
cls (type) – The type to decode to.
raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type:
Any
- validate() bool¶
Return whether the configuration can be represented as valid JSON.
- Return type:
bool
- class BacktestEngineConfig¶
Bases:
NautilusKernelConfigConfiguration for
BacktestEngineinstances.- Parameters:
trader_id (TraderId) – The trader ID for the node (must be a name and ID tag separated by a hyphen).
log_level (str, default "INFO") – The stdout log level for the node.
loop_debug (bool, default False) – If the asyncio event loop should be in debug mode.
cache (CacheConfig, optional) – The cache configuration.
data_engine (DataEngineConfig, optional) – The live data engine configuration.
risk_engine (RiskEngineConfig, optional) – The live risk engine configuration.
exec_engine (ExecEngineConfig, optional) – The live execution engine configuration.
streaming (StreamingConfig, optional) – The configuration for streaming to feather files.
strategies (list[ImportableStrategyConfig]) – The strategy configurations for the kernel.
actors (list[ImportableActorConfig]) – The actor configurations for the kernel.
exec_algorithms (list[ImportableExecAlgorithmConfig]) – The execution algorithm configurations for the kernel.
controller (ImportableControllerConfig, optional) – The trader controller for the kernel.
load_state (bool, default True) – If trading strategy state should be loaded from the database on start.
save_state (bool, default True) – If trading strategy state should be saved to the database on stop.
bypass_logging (bool, default False) – If logging should be bypassed.
run_analysis (bool, default True) – If post backtest performance analysis should be run.
- environment: Environment¶
- cache: CacheConfig | None¶
- data_engine: DataEngineConfig | None¶
- risk_engine: RiskEngineConfig | None¶
- exec_engine: ExecEngineConfig | None¶
- run_analysis: bool¶
- actors: list[ImportableActorConfig]¶
- catalogs: list[DataCatalogConfig]¶
- controller: ImportableControllerConfig | None¶
- dict() dict[str, Any]¶
Return a dictionary representation of the configuration.
- Return type:
dict[str, Any]
- emulator: OrderEmulatorConfig | None¶
- exec_algorithms: list[ImportableExecAlgorithmConfig]¶
- classmethod fully_qualified_name() str¶
Return the fully qualified name for the NautilusConfig class.
- Return type:
str
References
- property id: str¶
Return the hashed identifier for the configuration.
- Return type:
str
- json() bytes¶
Return serialized JSON encoded bytes.
- Return type:
bytes
- json_primitives() dict[str, Any]¶
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type:
dict[str, Any]
- classmethod json_schema() dict[str, Any]¶
Generate a JSON schema for this configuration class.
- Return type:
dict[str, Any]
- load_state: bool¶
- logging: LoggingConfig | None¶
- loop_debug: bool¶
- message_bus: MessageBusConfig | None¶
- classmethod parse(raw: bytes | str) Any¶
Return a decoded object of the given cls.
- Parameters:
cls (type) – The type to decode to.
raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type:
Any
- portfolio: PortfolioConfig | None¶
- save_state: bool¶
- strategies: list[ImportableStrategyConfig]¶
- streaming: StreamingConfig | None¶
- timeout_connection: Annotated[float, msgspec.Meta(gt=0.0)]¶
- timeout_disconnection: Annotated[float, msgspec.Meta(gt=0.0)]¶
- timeout_portfolio: Annotated[float, msgspec.Meta(gt=0.0)]¶
- timeout_post_stop: Annotated[float, msgspec.Meta(gt=0.0)]¶
- timeout_reconciliation: Annotated[float, msgspec.Meta(gt=0.0)]¶
- timeout_shutdown: Annotated[float, msgspec.Meta(gt=0.0)]¶
- validate() bool¶
Return whether the configuration can be represented as valid JSON.
- Return type:
bool
- class BacktestRunConfig¶
Bases:
NautilusConfigRepresents the configuration for one specific backtest run.
This includes a backtest engine with its actors and strategies, with the external inputs of venues and data.
- Parameters:
venues (list[BacktestVenueConfig]) – The venue configurations for the backtest run.
data (list[BacktestDataConfig]) – The data configurations for the backtest run.
engine (BacktestEngineConfig) – The backtest engine configuration (the core system kernel).
chunk_size (int, optional) – The number of data points to process in each chunk during streaming mode. If None, the backtest will run without streaming, loading all data at once.
raise_exception (bool, default False) – If exceptions during an engine build or run should be raised to interrupt the nodes process.
dispose_on_completion (bool, default True) – If the backtest engine should be disposed on completion of the run. If True, then will drop data and all state. If False, then will only drop data.
start (datetime or str or int, optional) – The start datetime (UTC) for the backtest run. If
Noneengine runs from the start of the data.end (datetime or str or int, optional) – The end datetime (UTC) for the backtest run. If
Noneengine runs to the end of the data.data_clients (dict[str, type[LiveDataClientConfig]], optional) – The data clients configuration for the backtest run.
Notes
- A valid backtest run configuration must include:
At least one venues config.
At least one data config.
- venues: list[BacktestVenueConfig]¶
- data: list[BacktestDataConfig]¶
- engine: BacktestEngineConfig | None¶
- chunk_size: int | None¶
- raise_exception: bool¶
- dispose_on_completion: bool¶
- start: str | int | None¶
- end: str | int | None¶
- data_clients: dict[str, type[LiveDataClientConfig]] | None¶
- dict() dict[str, Any]¶
Return a dictionary representation of the configuration.
- Return type:
dict[str, Any]
- classmethod fully_qualified_name() str¶
Return the fully qualified name for the NautilusConfig class.
- Return type:
str
References
- property id: str¶
Return the hashed identifier for the configuration.
- Return type:
str
- json() bytes¶
Return serialized JSON encoded bytes.
- Return type:
bytes
- json_primitives() dict[str, Any]¶
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type:
dict[str, Any]
- classmethod json_schema() dict[str, Any]¶
Generate a JSON schema for this configuration class.
- Return type:
dict[str, Any]
- classmethod parse(raw: bytes | str) Any¶
Return a decoded object of the given cls.
- Parameters:
cls (type) – The type to decode to.
raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type:
Any
- validate() bool¶
Return whether the configuration can be represented as valid JSON.
- Return type:
bool
- class SimulationModuleConfig¶
Bases:
ActorConfigConfiguration for
SimulationModuleinstances.- component_id: ComponentId | None¶
- dict() dict[str, Any]¶
Return a dictionary representation of the configuration.
- Return type:
dict[str, Any]
- classmethod fully_qualified_name() str¶
Return the fully qualified name for the NautilusConfig class.
- Return type:
str
References
- property id: str¶
Return the hashed identifier for the configuration.
- Return type:
str
- json() bytes¶
Return serialized JSON encoded bytes.
- Return type:
bytes
- json_primitives() dict[str, Any]¶
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type:
dict[str, Any]
- classmethod json_schema() dict[str, Any]¶
Generate a JSON schema for this configuration class.
- Return type:
dict[str, Any]
- log_commands: bool¶
- log_events: bool¶
- classmethod parse(raw: bytes | str) Any¶
Return a decoded object of the given cls.
- Parameters:
cls (type) – The type to decode to.
raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type:
Any
- validate() bool¶
Return whether the configuration can be represented as valid JSON.
- Return type:
bool
- class FillModelConfig¶
Bases:
NautilusConfigConfiguration for
FillModelinstances.- Parameters:
prob_fill_on_limit (float, default 1.0) – The probability of limit order filling if the market rests on its price.
prob_slippage (float, default 0.0) – The probability of order fill prices slipping by one tick.
random_seed (int, optional) – The random seed (if None then no random seed).
- prob_fill_on_limit: float¶
- prob_slippage: float¶
- random_seed: int | None¶
- dict() dict[str, Any]¶
Return a dictionary representation of the configuration.
- Return type:
dict[str, Any]
- classmethod fully_qualified_name() str¶
Return the fully qualified name for the NautilusConfig class.
- Return type:
str
References
- property id: str¶
Return the hashed identifier for the configuration.
- Return type:
str
- json() bytes¶
Return serialized JSON encoded bytes.
- Return type:
bytes
- json_primitives() dict[str, Any]¶
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type:
dict[str, Any]
- classmethod json_schema() dict[str, Any]¶
Generate a JSON schema for this configuration class.
- Return type:
dict[str, Any]
- classmethod parse(raw: bytes | str) Any¶
Return a decoded object of the given cls.
- Parameters:
cls (type) – The type to decode to.
raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type:
Any
- validate() bool¶
Return whether the configuration can be represented as valid JSON.
- Return type:
bool
- class ImportableFillModelConfig¶
Bases:
NautilusConfigConfiguration for a fill model instance.
- Parameters:
fill_model_path (str) – The fully qualified name of the fill model class.
config_path (str) – The fully qualified name of the config class.
config (dict[str, Any]) – The fill model configuration.
- fill_model_path: str¶
- config_path: str¶
- config: dict[str, Any]¶
- dict() dict[str, Any]¶
Return a dictionary representation of the configuration.
- Return type:
dict[str, Any]
- classmethod fully_qualified_name() str¶
Return the fully qualified name for the NautilusConfig class.
- Return type:
str
References
- property id: str¶
Return the hashed identifier for the configuration.
- Return type:
str
- json() bytes¶
Return serialized JSON encoded bytes.
- Return type:
bytes
- json_primitives() dict[str, Any]¶
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type:
dict[str, Any]
- classmethod json_schema() dict[str, Any]¶
Generate a JSON schema for this configuration class.
- Return type:
dict[str, Any]
- classmethod parse(raw: bytes | str) Any¶
Return a decoded object of the given cls.
- Parameters:
cls (type) – The type to decode to.
raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type:
Any
- validate() bool¶
Return whether the configuration can be represented as valid JSON.
- Return type:
bool
- class FillModelFactory¶
Bases:
objectProvides fill model creation from importable configurations.
- static create(config: ImportableFillModelConfig)¶
Create a fill model from the given configuration.
- Parameters:
config (ImportableFillModelConfig) – The configuration for the building step.
- Return type:
- Raises:
TypeError – If config is not of type ImportableFillModelConfig.
- class LatencyModelConfig¶
Bases:
NautilusConfigConfiguration for
LatencyModelinstances.- Parameters:
base_latency_nanos (int, default 1_000_000_000) – The base latency (nanoseconds) for the model.
insert_latency_nanos (int, default 0) – The order insert latency (nanoseconds) for the model.
update_latency_nanos (int, default 0) – The order update latency (nanoseconds) for the model.
cancel_latency_nanos (int, default 0) – The order cancel latency (nanoseconds) for the model.
- base_latency_nanos: Annotated[int, msgspec.Meta(ge=0)]¶
- insert_latency_nanos: Annotated[int, msgspec.Meta(ge=0)]¶
- update_latency_nanos: Annotated[int, msgspec.Meta(ge=0)]¶
- cancel_latency_nanos: Annotated[int, msgspec.Meta(ge=0)]¶
- dict() dict[str, Any]¶
Return a dictionary representation of the configuration.
- Return type:
dict[str, Any]
- classmethod fully_qualified_name() str¶
Return the fully qualified name for the NautilusConfig class.
- Return type:
str
References
- property id: str¶
Return the hashed identifier for the configuration.
- Return type:
str
- json() bytes¶
Return serialized JSON encoded bytes.
- Return type:
bytes
- json_primitives() dict[str, Any]¶
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type:
dict[str, Any]
- classmethod json_schema() dict[str, Any]¶
Generate a JSON schema for this configuration class.
- Return type:
dict[str, Any]
- classmethod parse(raw: bytes | str) Any¶
Return a decoded object of the given cls.
- Parameters:
cls (type) – The type to decode to.
raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type:
Any
- validate() bool¶
Return whether the configuration can be represented as valid JSON.
- Return type:
bool
- class ImportableLatencyModelConfig¶
Bases:
NautilusConfigConfiguration for a latency model instance.
- Parameters:
latency_model_path (str) – The fully qualified name of the latency model class.
config_path (str) – The fully qualified name of the config class.
config (dict[str, Any]) – The latency model configuration.
- latency_model_path: str¶
- config_path: str¶
- config: dict[str, Any]¶
- dict() dict[str, Any]¶
Return a dictionary representation of the configuration.
- Return type:
dict[str, Any]
- classmethod fully_qualified_name() str¶
Return the fully qualified name for the NautilusConfig class.
- Return type:
str
References
- property id: str¶
Return the hashed identifier for the configuration.
- Return type:
str
- json() bytes¶
Return serialized JSON encoded bytes.
- Return type:
bytes
- json_primitives() dict[str, Any]¶
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type:
dict[str, Any]
- classmethod json_schema() dict[str, Any]¶
Generate a JSON schema for this configuration class.
- Return type:
dict[str, Any]
- classmethod parse(raw: bytes | str) Any¶
Return a decoded object of the given cls.
- Parameters:
cls (type) – The type to decode to.
raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type:
Any
- validate() bool¶
Return whether the configuration can be represented as valid JSON.
- Return type:
bool
- class LatencyModelFactory¶
Bases:
objectProvides latency model creation from importable configurations.
- static create(config: ImportableLatencyModelConfig)¶
Create a latency model from the given configuration.
- Parameters:
config (ImportableLatencyModelConfig) – The configuration for the building step.
- Return type:
- Raises:
TypeError – If config is not of type ImportableLatencyModelConfig.
- class FeeModelConfig¶
Bases:
NautilusConfigBase configuration for
FeeModelinstances.- dict() dict[str, Any]¶
Return a dictionary representation of the configuration.
- Return type:
dict[str, Any]
- classmethod fully_qualified_name() str¶
Return the fully qualified name for the NautilusConfig class.
- Return type:
str
References
- property id: str¶
Return the hashed identifier for the configuration.
- Return type:
str
- json() bytes¶
Return serialized JSON encoded bytes.
- Return type:
bytes
- json_primitives() dict[str, Any]¶
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type:
dict[str, Any]
- classmethod json_schema() dict[str, Any]¶
Generate a JSON schema for this configuration class.
- Return type:
dict[str, Any]
- classmethod parse(raw: bytes | str) Any¶
Return a decoded object of the given cls.
- Parameters:
cls (type) – The type to decode to.
raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type:
Any
- validate() bool¶
Return whether the configuration can be represented as valid JSON.
- Return type:
bool
- class MakerTakerFeeModelConfig¶
Bases:
FeeModelConfigConfiguration for
MakerTakerFeeModelinstances.This fee model uses the maker/taker fees defined on the instrument.
- dict() dict[str, Any]¶
Return a dictionary representation of the configuration.
- Return type:
dict[str, Any]
- classmethod fully_qualified_name() str¶
Return the fully qualified name for the NautilusConfig class.
- Return type:
str
References
- property id: str¶
Return the hashed identifier for the configuration.
- Return type:
str
- json() bytes¶
Return serialized JSON encoded bytes.
- Return type:
bytes
- json_primitives() dict[str, Any]¶
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type:
dict[str, Any]
- classmethod json_schema() dict[str, Any]¶
Generate a JSON schema for this configuration class.
- Return type:
dict[str, Any]
- classmethod parse(raw: bytes | str) Any¶
Return a decoded object of the given cls.
- Parameters:
cls (type) – The type to decode to.
raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type:
Any
- validate() bool¶
Return whether the configuration can be represented as valid JSON.
- Return type:
bool
- class FixedFeeModelConfig¶
Bases:
FeeModelConfigConfiguration for
FixedFeeModelinstances.- Parameters:
commission (Money | str) – The fixed commission amount for trades.
charge_commission_once (bool, default True) – Whether to charge the commission once per order or per fill.
- commission: str¶
- charge_commission_once: bool¶
- dict() dict[str, Any]¶
Return a dictionary representation of the configuration.
- Return type:
dict[str, Any]
- classmethod fully_qualified_name() str¶
Return the fully qualified name for the NautilusConfig class.
- Return type:
str
References
- property id: str¶
Return the hashed identifier for the configuration.
- Return type:
str
- json() bytes¶
Return serialized JSON encoded bytes.
- Return type:
bytes
- json_primitives() dict[str, Any]¶
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type:
dict[str, Any]
- classmethod json_schema() dict[str, Any]¶
Generate a JSON schema for this configuration class.
- Return type:
dict[str, Any]
- classmethod parse(raw: bytes | str) Any¶
Return a decoded object of the given cls.
- Parameters:
cls (type) – The type to decode to.
raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type:
Any
- validate() bool¶
Return whether the configuration can be represented as valid JSON.
- Return type:
bool
- class PerContractFeeModelConfig¶
Bases:
FeeModelConfigConfiguration for
PerContractFeeModelinstances.- Parameters:
commission (Money | str) – The commission amount per contract.
- commission: str¶
- dict() dict[str, Any]¶
Return a dictionary representation of the configuration.
- Return type:
dict[str, Any]
- classmethod fully_qualified_name() str¶
Return the fully qualified name for the NautilusConfig class.
- Return type:
str
References
- property id: str¶
Return the hashed identifier for the configuration.
- Return type:
str
- json() bytes¶
Return serialized JSON encoded bytes.
- Return type:
bytes
- json_primitives() dict[str, Any]¶
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type:
dict[str, Any]
- classmethod json_schema() dict[str, Any]¶
Generate a JSON schema for this configuration class.
- Return type:
dict[str, Any]
- classmethod parse(raw: bytes | str) Any¶
Return a decoded object of the given cls.
- Parameters:
cls (type) – The type to decode to.
raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type:
Any
- validate() bool¶
Return whether the configuration can be represented as valid JSON.
- Return type:
bool
- class ImportableFeeModelConfig¶
Bases:
NautilusConfigConfiguration for a fee model instance.
- Parameters:
fee_model_path (str) – The fully qualified name of the fee model class.
config_path (str) – The fully qualified name of the config class.
config (dict[str, Any]) – The fee model configuration.
- fee_model_path: str¶
- config_path: str¶
- config: dict[str, Any]¶
- dict() dict[str, Any]¶
Return a dictionary representation of the configuration.
- Return type:
dict[str, Any]
- classmethod fully_qualified_name() str¶
Return the fully qualified name for the NautilusConfig class.
- Return type:
str
References
- property id: str¶
Return the hashed identifier for the configuration.
- Return type:
str
- json() bytes¶
Return serialized JSON encoded bytes.
- Return type:
bytes
- json_primitives() dict[str, Any]¶
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type:
dict[str, Any]
- classmethod json_schema() dict[str, Any]¶
Generate a JSON schema for this configuration class.
- Return type:
dict[str, Any]
- classmethod parse(raw: bytes | str) Any¶
Return a decoded object of the given cls.
- Parameters:
cls (type) – The type to decode to.
raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type:
Any
- validate() bool¶
Return whether the configuration can be represented as valid JSON.
- Return type:
bool
- class FeeModelFactory¶
Bases:
objectProvides fee model creation from importable configurations.
- static create(config: ImportableFeeModelConfig)¶
Create a fee model from the given configuration.
- Parameters:
config (ImportableFeeModelConfig) – The configuration for the building step.
- Return type:
- Raises:
TypeError – If config is not of type ImportableFeeModelConfig.
- class FXRolloverInterestConfig¶
Bases:
SimulationModuleConfigProvides an FX rollover interest simulation module.
- Parameters:
rate_data (pd.DataFrame) – The interest rate data for the internal rollover interest calculator.
- rate_data: DataFrame¶
- component_id: ComponentId | None¶
- dict() dict[str, Any]¶
Return a dictionary representation of the configuration.
- Return type:
dict[str, Any]
- classmethod fully_qualified_name() str¶
Return the fully qualified name for the NautilusConfig class.
- Return type:
str
References
- property id: str¶
Return the hashed identifier for the configuration.
- Return type:
str
- json() bytes¶
Return serialized JSON encoded bytes.
- Return type:
bytes
- json_primitives() dict[str, Any]¶
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type:
dict[str, Any]
- classmethod json_schema() dict[str, Any]¶
Generate a JSON schema for this configuration class.
- Return type:
dict[str, Any]
- log_commands: bool¶
- log_events: bool¶
- classmethod parse(raw: bytes | str) Any¶
Return a decoded object of the given cls.
- Parameters:
cls (type) – The type to decode to.
raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type:
Any
- validate() bool¶
Return whether the configuration can be represented as valid JSON.
- Return type:
bool
- class MarginModelConfig¶
Bases:
NautilusConfigConfiguration for margin calculation models.
- Parameters:
model_type (str, default 'leveraged') – The type of margin model to use. Options: - “standard”: Fixed percentages without leverage division (traditional brokers) - “leveraged”: Margin requirements reduced by leverage (current Nautilus behavior) - Custom class path for custom models
config (dict, optional) – Additional configuration parameters for custom models.
- model_type: str¶
- config: dict¶
- dict() dict[str, Any]¶
Return a dictionary representation of the configuration.
- Return type:
dict[str, Any]
- classmethod fully_qualified_name() str¶
Return the fully qualified name for the NautilusConfig class.
- Return type:
str
References
- property id: str¶
Return the hashed identifier for the configuration.
- Return type:
str
- json() bytes¶
Return serialized JSON encoded bytes.
- Return type:
bytes
- json_primitives() dict[str, Any]¶
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type:
dict[str, Any]
- classmethod json_schema() dict[str, Any]¶
Generate a JSON schema for this configuration class.
- Return type:
dict[str, Any]
- classmethod parse(raw: bytes | str) Any¶
Return a decoded object of the given cls.
- Parameters:
cls (type) – The type to decode to.
raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type:
Any
- validate() bool¶
Return whether the configuration can be represented as valid JSON.
- Return type:
bool
- class MarginModelFactory¶
Bases:
objectProvides margin model creation from configurations.
- static create(config: MarginModelConfig)¶
Create a margin model from the given configuration.
- Parameters:
config (MarginModelConfig) – The configuration for the margin model.
- Returns:
The created margin model instance.
- Return type:
- Raises:
ValueError – If the model type is unknown or invalid.
Cache¶
- class CacheConfig¶
Bases:
NautilusConfigConfiguration for
Cacheinstances.- Parameters:
database (DatabaseConfig, optional) – The configuration for the cache backing database.
encoding (str, {'msgpack', 'json'}, default 'msgpack') – The encoding for database operations, controls the type of serializer used.
timestamps_as_iso8601 (bool, default False) – If timestamps should be persisted as ISO 8601 strings. If False then will persist as UNIX nanoseconds.
persist_account_events (bool, default True) – If account state events are written to the backing database. Set to False in place of purging account state events.
buffer_interval_ms (PositiveInt, optional) – The buffer interval (milliseconds) between pipelined/batched transactions. The recommended range if using buffered pipelining is [10, 1000] milliseconds, with a good compromise being 100 milliseconds.
bulk_read_batch_size (PositiveInt, optional) – The batch size for bulk read operations (e.g., MGET). If set, bulk reads will be batched into chunks of this size to avoid exceeding request size limits on some Redis providers. If None, all keys are fetched in a single operation.
use_trader_prefix (bool, default True) – If a ‘trader-’ prefix is used for keys.
use_instance_id (bool, default False) – If the traders instance ID is used for keys.
flush_on_start (bool, default False) – If database should be flushed on start.
drop_instruments_on_reset (bool, default True) – If instruments data should be dropped from the caches memory on reset.
tick_capacity (PositiveInt, default 10_000) – The maximum length for internal tick dequeues.
bar_capacity (PositiveInt, default 10_000) – The maximum length for internal bar dequeues.
- database: DatabaseConfig | None¶
- encoding: str¶
- timestamps_as_iso8601: bool¶
- persist_account_events: bool¶
- buffer_interval_ms: Annotated[int, msgspec.Meta(gt=0)] | None¶
- bulk_read_batch_size: Annotated[int, msgspec.Meta(gt=0)] | None¶
- use_trader_prefix: bool¶
- use_instance_id: bool¶
- flush_on_start: bool¶
- drop_instruments_on_reset: bool¶
- tick_capacity: Annotated[int, msgspec.Meta(gt=0)]¶
- bar_capacity: Annotated[int, msgspec.Meta(gt=0)]¶
- dict() dict[str, Any]¶
Return a dictionary representation of the configuration.
- Return type:
dict[str, Any]
- classmethod fully_qualified_name() str¶
Return the fully qualified name for the NautilusConfig class.
- Return type:
str
References
- property id: str¶
Return the hashed identifier for the configuration.
- Return type:
str
- json() bytes¶
Return serialized JSON encoded bytes.
- Return type:
bytes
- json_primitives() dict[str, Any]¶
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type:
dict[str, Any]
- classmethod json_schema() dict[str, Any]¶
Generate a JSON schema for this configuration class.
- Return type:
dict[str, Any]
- classmethod parse(raw: bytes | str) Any¶
Return a decoded object of the given cls.
- Parameters:
cls (type) – The type to decode to.
raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type:
Any
- validate() bool¶
Return whether the configuration can be represented as valid JSON.
- Return type:
bool
Common¶
- exception InvalidConfiguration¶
Bases:
RuntimeErrorRaised when there is a violation of a configuration condition, making it invalid.
- add_note(object, /)¶
Exception.add_note(note) – add a note to the exception
- args¶
- with_traceback(object, /)¶
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- resolve_config_path(path: str) type[NautilusConfig]¶
- msgspec_encoding_hook(obj: Any) Any¶
- tokenize_config(obj: NautilusConfig) str¶
- class NautilusConfig¶
Bases:
StructThe base class for all Nautilus configuration objects.
- property id: str¶
Return the hashed identifier for the configuration.
- Return type:
str
- classmethod fully_qualified_name() str¶
Return the fully qualified name for the NautilusConfig class.
- Return type:
str
References
- classmethod json_schema() dict[str, Any]¶
Generate a JSON schema for this configuration class.
- Return type:
dict[str, Any]
- classmethod parse(raw: bytes | str) Any¶
Return a decoded object of the given cls.
- Parameters:
cls (type) – The type to decode to.
raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type:
Any
- dict() dict[str, Any]¶
Return a dictionary representation of the configuration.
- Return type:
dict[str, Any]
- json() bytes¶
Return serialized JSON encoded bytes.
- Return type:
bytes
- json_primitives() dict[str, Any]¶
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type:
dict[str, Any]
- validate() bool¶
Return whether the configuration can be represented as valid JSON.
- Return type:
bool
- class DatabaseConfig¶
Bases:
NautilusConfigConfiguration for database connections.
- Parameters:
type (str, {'redis'}, default 'redis') – The database type.
host (str, optional) – The database host address. If None then should use the typical default.
port (int, optional) – The database port. If None then should use the typical default.
username (str, optional) – The account username for the database connection.
password (str, optional) – The account password for the database connection. If a value is provided then it will be redacted in the string repr for this object.
ssl (bool, default False) – If socket should use an SSL (TLS encryption) enabled connection.
timeout (int, default 20) – The timeout (seconds) to wait for a new connection.
Notes
If type is ‘redis’ then requires Redis version 6.2 or higher for correct operation (required for streams functionality).
- type: str¶
- host: str | None¶
- port: int | None¶
- username: str | None¶
- password: str | None¶
- ssl: bool¶
- timeout: int | None¶
- dict() dict[str, Any]¶
Return a dictionary representation of the configuration.
- Return type:
dict[str, Any]
- classmethod fully_qualified_name() str¶
Return the fully qualified name for the NautilusConfig class.
- Return type:
str
References
- property id: str¶
Return the hashed identifier for the configuration.
- Return type:
str
- json() bytes¶
Return serialized JSON encoded bytes.
- Return type:
bytes
- json_primitives() dict[str, Any]¶
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type:
dict[str, Any]
- classmethod json_schema() dict[str, Any]¶
Generate a JSON schema for this configuration class.
- Return type:
dict[str, Any]
- classmethod parse(raw: bytes | str) Any¶
Return a decoded object of the given cls.
- Parameters:
cls (type) – The type to decode to.
raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type:
Any
- validate() bool¶
Return whether the configuration can be represented as valid JSON.
- Return type:
bool
- class MessageBusConfig¶
Bases:
NautilusConfigConfiguration for
MessageBusinstances.- Parameters:
database (DatabaseConfig, optional) – The configuration for the message bus backing database.
encoding (str, {'msgpack', 'json'}, default 'msgpack') – The encoding for database operations, controls the type of serializer used.
timestamps_as_iso8601 – If timestamps should be persisted as ISO 8601 strings. If False then will persist as UNIX nanoseconds.
False (default) – If timestamps should be persisted as ISO 8601 strings. If False then will persist as UNIX nanoseconds.
buffer_interval_ms (PositiveInt, optional) – The buffer interval (milliseconds) between pipelined/batched transactions. The recommended range if using buffered pipelining is [10, 1000] milliseconds, with a good compromise being 100 milliseconds.
autotrim_mins (int, optional) – The lookback window in minutes for automatic stream trimming. The actual window may extend up to one minute beyond the specified value since streams are trimmed at most once every minute. Note that this feature requires Redis version 6.2 or higher; otherwise it will result in a command syntax error.
use_trader_prefix (bool, default True) – If a ‘trader-’ prefix is used for stream names.
use_trader_id (bool, default True) – If the traders ID is used for stream names.
use_instance_id (bool, default False) – If the traders instance ID is used for stream names.
streams_prefix (str, default 'stream') – The prefix for externally published stream names (must have a database config). If use_trader_id and use_instance_id are both false, then it becomes possible for many traders to be configured to write to the same streams.
stream_per_topic (bool, default True) – If True, messages will be written to separate streams per topic. If False, all messages will be written to the same stream.
external_streams (list[str], optional) – The external stream keys the node will listen to for publishing deserialized message payloads on the internal message bus.
types_filter (list[type], optional) – A list of serializable types not to publish externally.
heartbeat_interval_secs (PositiveInt, optional) – The heartbeat interval (seconds) to use for trading node health.
- database: DatabaseConfig | None¶
- encoding: str¶
- timestamps_as_iso8601: bool¶
- buffer_interval_ms: Annotated[int, msgspec.Meta(gt=0)] | None¶
- autotrim_mins: int | None¶
- use_trader_prefix: bool¶
- use_trader_id: bool¶
- use_instance_id: bool¶
- streams_prefix: str¶
- stream_per_topic: bool¶
- external_streams: list[str] | None¶
- heartbeat_interval_secs: Annotated[int, msgspec.Meta(gt=0)] | None¶
- dict() dict[str, Any]¶
Return a dictionary representation of the configuration.
- Return type:
dict[str, Any]
- classmethod fully_qualified_name() str¶
Return the fully qualified name for the NautilusConfig class.
- Return type:
str
References
- property id: str¶
Return the hashed identifier for the configuration.
- Return type:
str
- json() bytes¶
Return serialized JSON encoded bytes.
- Return type:
bytes
- json_primitives() dict[str, Any]¶
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type:
dict[str, Any]
- classmethod json_schema() dict[str, Any]¶
Generate a JSON schema for this configuration class.
- Return type:
dict[str, Any]
- classmethod parse(raw: bytes | str) Any¶
Return a decoded object of the given cls.
- Parameters:
cls (type) – The type to decode to.
raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type:
Any
- validate() bool¶
Return whether the configuration can be represented as valid JSON.
- Return type:
bool
- class InstrumentProviderConfig¶
Bases:
NautilusConfigConfiguration for
InstrumentProviderinstances.- Parameters:
load_all (bool, default False) – If all venue instruments should be loaded on start.
load_ids (frozenset[InstrumentId], optional) – The list of instrument IDs to be loaded on start (if load_all is False).
filters (frozendict or dict[str, Any], optional) – The venue specific instrument loading filters to apply.
filter_callable (str, optional) – A fully qualified path to a callable that takes a single argument, instrument and returns a bool, indicating whether the instrument should be loaded
log_warnings (bool, default True) – If parser warnings should be logged.
use_gamma_markets (bool, default False) – Determines which API to use for loading market data: - True: Gamma Markets API (experimental) - faster with server-side filtering, but provides less detailed data - False: CLOB API (stable, default) - complete data, but slower due to sequential fetching
- load_all: bool¶
- load_ids: frozenset[InstrumentId] | None¶
- filters: dict[str, Any] | None¶
- filter_callable: str | None¶
- log_warnings: bool¶
- use_gamma_markets: bool¶
- dict() dict[str, Any]¶
Return a dictionary representation of the configuration.
- Return type:
dict[str, Any]
- classmethod fully_qualified_name() str¶
Return the fully qualified name for the NautilusConfig class.
- Return type:
str
References
- property id: str¶
Return the hashed identifier for the configuration.
- Return type:
str
- json() bytes¶
Return serialized JSON encoded bytes.
- Return type:
bytes
- json_primitives() dict[str, Any]¶
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type:
dict[str, Any]
- classmethod json_schema() dict[str, Any]¶
Generate a JSON schema for this configuration class.
- Return type:
dict[str, Any]
- classmethod parse(raw: bytes | str) Any¶
Return a decoded object of the given cls.
- Parameters:
cls (type) – The type to decode to.
raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type:
Any
- validate() bool¶
Return whether the configuration can be represented as valid JSON.
- Return type:
bool
- class OrderEmulatorConfig¶
Bases:
NautilusConfigConfiguration for
OrderEmulatorinstances.- Parameters:
debug (bool, default False) – If debug mode is active (will provide extra debug logging).
- debug: bool¶
- dict() dict[str, Any]¶
Return a dictionary representation of the configuration.
- Return type:
dict[str, Any]
- classmethod fully_qualified_name() str¶
Return the fully qualified name for the NautilusConfig class.
- Return type:
str
References
- property id: str¶
Return the hashed identifier for the configuration.
- Return type:
str
- json() bytes¶
Return serialized JSON encoded bytes.
- Return type:
bytes
- json_primitives() dict[str, Any]¶
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type:
dict[str, Any]
- classmethod json_schema() dict[str, Any]¶
Generate a JSON schema for this configuration class.
- Return type:
dict[str, Any]
- classmethod parse(raw: bytes | str) Any¶
Return a decoded object of the given cls.
- Parameters:
cls (type) – The type to decode to.
raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type:
Any
- validate() bool¶
Return whether the configuration can be represented as valid JSON.
- Return type:
bool
- class ActorConfig¶
Bases:
NautilusConfigThe base model for all actor configurations.
- Parameters:
component_id (ComponentId, optional) – The component ID. If
Nonethen the identifier will be taken from type(self).__name__.log_events (bool, default True) – If events should be logged by the actor. If False, then only warning events and above are logged.
log_commands (bool, default True) – If commands should be logged by the actor.
- component_id: ComponentId | None¶
- log_events: bool¶
- log_commands: bool¶
- dict() dict[str, Any]¶
Return a dictionary representation of the configuration.
- Return type:
dict[str, Any]
- classmethod fully_qualified_name() str¶
Return the fully qualified name for the NautilusConfig class.
- Return type:
str
References
- property id: str¶
Return the hashed identifier for the configuration.
- Return type:
str
- json() bytes¶
Return serialized JSON encoded bytes.
- Return type:
bytes
- json_primitives() dict[str, Any]¶
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type:
dict[str, Any]
- classmethod json_schema() dict[str, Any]¶
Generate a JSON schema for this configuration class.
- Return type:
dict[str, Any]
- classmethod parse(raw: bytes | str) Any¶
Return a decoded object of the given cls.
- Parameters:
cls (type) – The type to decode to.
raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type:
Any
- validate() bool¶
Return whether the configuration can be represented as valid JSON.
- Return type:
bool
- class ImportableActorConfig¶
Bases:
NautilusConfigConfiguration for an actor instance.
- Parameters:
actor_path (str) – The fully qualified name of the Actor class.
config_path (str) – The fully qualified name of the Actor Config class.
config (dict) – The actor configuration.
- actor_path: str¶
- config_path: str¶
- config: dict¶
- dict() dict[str, Any]¶
Return a dictionary representation of the configuration.
- Return type:
dict[str, Any]
- classmethod fully_qualified_name() str¶
Return the fully qualified name for the NautilusConfig class.
- Return type:
str
References
- property id: str¶
Return the hashed identifier for the configuration.
- Return type:
str
- json() bytes¶
Return serialized JSON encoded bytes.
- Return type:
bytes
- json_primitives() dict[str, Any]¶
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type:
dict[str, Any]
- classmethod json_schema() dict[str, Any]¶
Generate a JSON schema for this configuration class.
- Return type:
dict[str, Any]
- classmethod parse(raw: bytes | str) Any¶
Return a decoded object of the given cls.
- Parameters:
cls (type) – The type to decode to.
raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type:
Any
- validate() bool¶
Return whether the configuration can be represented as valid JSON.
- Return type:
bool
- class ActorFactory¶
Bases:
objectProvides actor creation from importable configurations.
- static create(config: ImportableActorConfig)¶
Create an actor from the given configuration.
- Parameters:
config (ImportableActorConfig) – The configuration for the building step.
- Return type:
- Raises:
TypeError – If config is not of type ImportableActorConfig.
- class LoggingConfig¶
Bases:
NautilusConfigConfiguration for standard output and file logging for a
NautilusKernelinstance.- Parameters:
log_level (str, default "INFO") – The minimum log level to write to stdout. Will always write ERROR level logs to stderr (unless bypass_logging is True).
log_level_file (str, optional) – The minimum log level to write to a log file. If
Nonethen no file logging will occur.log_directory (str, optional) – The path to the log file directory. If
Nonethen will write to the current working directory.log_file_name (str, optional) – The custom log file name (will use a ‘.log’ suffix for plain text or ‘.json’ for JSON). This will override automatic naming, and no daily file rotation will occur.
log_file_format (str { 'JSON' }, optional) – The log file format. If
None(default) then will log in plain text.log_file_max_size (PositiveInt, optional) – The maximum size of log files in bytes before rotation occurs.
log_file_max_backup_count (NonNegativeInt, default 5) – The maximum number of backup log files to keep when rotating.
log_colors (bool, default True) – If ANSI codes should be used to produce colored log lines.
log_component_levels (dict[str, str]) – The additional per component log level filters, where keys are component IDs (e.g. actor/strategy IDs) and values are log level strings (case-insensitive).
log_components_only (bool, default False) – If only components with explicit component-level filters should be logged. When enabled, only log messages from components that have been explicitly configured in log_component_levels will be output.
bypass_logging (bool, default False) – If all logging should be bypassed.
print_config (bool, default False) – If the core logging configuration should be printed to stdout at initialization.
use_tracing (bool, default False) – If the tracing subscriber should be enabled for capturing logs from external Rust crates that use the tracing crate. Use the
RUST_LOGenvironment variable to control which crates emit tracing events (e.g.,RUST_LOG=hyper_util=debug).use_pyo3 (bool, default False) – If the logging subsystem should be initialized via pyo3, this isn’t recommended for backtesting as the performance is much lower but can be useful for seeing logs originating from Rust.
clear_log_file (bool, default False) – If the log file name should be cleared before being used (e.g. for testing). Only applies if log_file_name is not
None.
- log_level: str¶
- log_level_file: str | None¶
- log_directory: str | None¶
- log_file_name: str | None¶
- log_file_format: str | None¶
- log_file_max_size: Annotated[int, msgspec.Meta(gt=0)] | None¶
- log_file_max_backup_count: Annotated[int, msgspec.Meta(ge=0)]¶
- log_colors: bool¶
- log_component_levels: dict[str, str] | None¶
- log_components_only: bool¶
- bypass_logging: bool¶
- print_config: bool¶
- use_tracing: bool¶
- use_pyo3: bool¶
- clear_log_file: bool¶
- dict() dict[str, Any]¶
Return a dictionary representation of the configuration.
- Return type:
dict[str, Any]
- classmethod fully_qualified_name() str¶
Return the fully qualified name for the NautilusConfig class.
- Return type:
str
References
- property id: str¶
Return the hashed identifier for the configuration.
- Return type:
str
- json() bytes¶
Return serialized JSON encoded bytes.
- Return type:
bytes
- json_primitives() dict[str, Any]¶
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type:
dict[str, Any]
- classmethod json_schema() dict[str, Any]¶
Generate a JSON schema for this configuration class.
- Return type:
dict[str, Any]
- classmethod parse(raw: bytes | str) Any¶
Return a decoded object of the given cls.
- Parameters:
cls (type) – The type to decode to.
raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type:
Any
- validate() bool¶
Return whether the configuration can be represented as valid JSON.
- Return type:
bool
- class ImportableFactoryConfig¶
Bases:
NautilusConfigRepresents an importable (JSON) factory config.
- path: str¶
- create()¶
- dict() dict[str, Any]¶
Return a dictionary representation of the configuration.
- Return type:
dict[str, Any]
- classmethod fully_qualified_name() str¶
Return the fully qualified name for the NautilusConfig class.
- Return type:
str
References
- property id: str¶
Return the hashed identifier for the configuration.
- Return type:
str
- json() bytes¶
Return serialized JSON encoded bytes.
- Return type:
bytes
- json_primitives() dict[str, Any]¶
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type:
dict[str, Any]
- classmethod json_schema() dict[str, Any]¶
Generate a JSON schema for this configuration class.
- Return type:
dict[str, Any]
- classmethod parse(raw: bytes | str) Any¶
Return a decoded object of the given cls.
- Parameters:
cls (type) – The type to decode to.
raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type:
Any
- validate() bool¶
Return whether the configuration can be represented as valid JSON.
- Return type:
bool
- class ImportableConfig¶
Bases:
NautilusConfigRepresents an importable configuration (typically live data client or live execution client).
- path: str¶
- config: dict¶
- factory: ImportableFactoryConfig | None¶
- static is_importable(data: dict) bool¶
- create()¶
- dict() dict[str, Any]¶
Return a dictionary representation of the configuration.
- Return type:
dict[str, Any]
- classmethod fully_qualified_name() str¶
Return the fully qualified name for the NautilusConfig class.
- Return type:
str
References
- property id: str¶
Return the hashed identifier for the configuration.
- Return type:
str
- json() bytes¶
Return serialized JSON encoded bytes.
- Return type:
bytes
- json_primitives() dict[str, Any]¶
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type:
dict[str, Any]
- classmethod json_schema() dict[str, Any]¶
Generate a JSON schema for this configuration class.
- Return type:
dict[str, Any]
- classmethod parse(raw: bytes | str) Any¶
Return a decoded object of the given cls.
- Parameters:
cls (type) – The type to decode to.
raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type:
Any
- validate() bool¶
Return whether the configuration can be represented as valid JSON.
- Return type:
bool
Data¶
- class DataEngineConfig¶
Bases:
NautilusConfigConfiguration for
DataEngineinstances.- Parameters:
time_bars_interval_type (str, default 'left-open') – Determines the type of interval used for time aggregation. - ‘left-open’: start time is excluded and end time is included (default). - ‘right-open’: start time is included and end time is excluded.
time_bars_timestamp_on_close (bool, default True) – If time bar aggregators will timestamp ts_event on bar close. If False, then will timestamp on bar open.
time_bars_skip_first_non_full_bar (bool, default False) – If time bar aggregators will skip emitting a bar if the aggregation starts mid-interval.
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_origin_offset (dict[BarAggregation, pd.Timedelta | pd.DateOffset], optional) – A dictionary mapping time bar aggregations to their origin time offsets.
time_bars_build_delay (int, default 0) – The time delay (microseconds) before building and emitting a bar. This can be useful in a backtest context to ensure data at bar boundary timestamps is processed before the bar close timer fires.
validate_data_sequence (bool, default False) – If data objects timestamp sequencing will be validated and handled.
buffer_deltas (bool, default False) – If order book deltas should be buffered until the F_LAST flag is set for a delta.
emit_quotes_from_book (bool, default False) – If quotes should be emitted on order book updates.
emit_quotes_from_book_depths (bool, default False) – If quotes should be emitted on order book depth updates.
external_clients (list[ClientId], optional) – Client IDs representing external data streams. Commands with these client IDs will be published on the message bus only; the data engine will not attempt to forward them to a local DataClient.
debug (bool, default False) – If debug mode is active (will provide extra debug logging).
- time_bars_interval_type: str¶
- time_bars_timestamp_on_close: bool¶
- time_bars_skip_first_non_full_bar: bool¶
- time_bars_build_with_no_updates: bool¶
- time_bars_origin_offset: dict | None¶
- time_bars_build_delay: int¶
- validate_data_sequence: bool¶
- buffer_deltas: bool¶
- emit_quotes_from_book: bool¶
- emit_quotes_from_book_depths: bool¶
- debug: bool¶
- dict() dict[str, Any]¶
Return a dictionary representation of the configuration.
- Return type:
dict[str, Any]
- classmethod fully_qualified_name() str¶
Return the fully qualified name for the NautilusConfig class.
- Return type:
str
References
- property id: str¶
Return the hashed identifier for the configuration.
- Return type:
str
- json() bytes¶
Return serialized JSON encoded bytes.
- Return type:
bytes
- json_primitives() dict[str, Any]¶
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type:
dict[str, Any]
- classmethod json_schema() dict[str, Any]¶
Generate a JSON schema for this configuration class.
- Return type:
dict[str, Any]
- classmethod parse(raw: bytes | str) Any¶
Return a decoded object of the given cls.
- Parameters:
cls (type) – The type to decode to.
raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type:
Any
- validate() bool¶
Return whether the configuration can be represented as valid JSON.
- Return type:
bool
Execution¶
- class ExecEngineConfig¶
Bases:
NautilusConfigConfiguration for
ExecutionEngineinstances.- Parameters:
load_cache (bool, default True) – If the cache should be loaded on initialization.
manage_own_order_books (bool, default False) – If the execution engine should maintain own/user order books based on commands and events.
snapshot_orders (bool, default False) – If order state snapshot lists are persisted to a backing database. Snapshots will be taken at every order state update (when events are applied).
snapshot_positions (bool, default False) – If position state snapshot lists are persisted to a backing database. Snapshots will be taken at position opened, changed and closed (when events are applied). To include the unrealized PnL in the snapshot then quotes for the positions instrument must be available in the cache.
snapshot_positions_interval_secs (PositiveFloat, optional) – The interval (seconds) at which additional position state snapshots are persisted to a backing database. If
Nonethen no additional snapshots will be taken. To include unrealized PnL in these snapshots, quotes for the position’s instrument must be available in the cache.convert_quote_qty_to_base (bool, default True) – If quote-denominated order quantities should be converted to base units before submission. Deprecated: future releases will remove this automatic conversion. Set
Falseto keep behaviour consistent with venues which expect quote-denominated quantities.external_clients (list[ClientId], optional) – Client IDs representing external execution streams. Commands with these client IDs will be published on the message bus only; the execution engine will not attempt to forward them to a local ExecutionClient.
allow_overfills (bool, default False) – If True, allows order fills that exceed the original order quantity. When an overfill is detected, the order’s
overfill_qtyis set and a warning is logged. When False (default), a ValueError is raised for backward compatibility.debug (bool, default False) – If debug mode is active (will provide extra debug logging).
- load_cache: bool¶
- manage_own_order_books: bool¶
- convert_quote_qty_to_base: bool¶
- snapshot_orders: bool¶
- snapshot_positions: bool¶
- snapshot_positions_interval_secs: Annotated[float, msgspec.Meta(gt=0.0)] | None¶
- allow_overfills: bool¶
- debug: bool¶
- dict() dict[str, Any]¶
Return a dictionary representation of the configuration.
- Return type:
dict[str, Any]
- classmethod fully_qualified_name() str¶
Return the fully qualified name for the NautilusConfig class.
- Return type:
str
References
- property id: str¶
Return the hashed identifier for the configuration.
- Return type:
str
- json() bytes¶
Return serialized JSON encoded bytes.
- Return type:
bytes
- json_primitives() dict[str, Any]¶
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type:
dict[str, Any]
- classmethod json_schema() dict[str, Any]¶
Generate a JSON schema for this configuration class.
- Return type:
dict[str, Any]
- classmethod parse(raw: bytes | str) Any¶
Return a decoded object of the given cls.
- Parameters:
cls (type) – The type to decode to.
raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type:
Any
- validate() bool¶
Return whether the configuration can be represented as valid JSON.
- Return type:
bool
- class ExecAlgorithmConfig¶
Bases:
NautilusConfigThe base model for all execution algorithm configurations.
- Parameters:
exec_algorithm_id (ExecAlgorithmId, optional) – The unique ID for the execution algorithm. If not
Nonethen will become the execution algorithm ID.log_events (bool, default True) – If events should be logged by the execution algorithm. If False, then only warning events and above are logged.
log_commands (bool, default True) – If commands should be logged by the execution algorithm.
- exec_algorithm_id: ExecAlgorithmId | None¶
- log_events: bool¶
- log_commands: bool¶
- dict() dict[str, Any]¶
Return a dictionary representation of the configuration.
- Return type:
dict[str, Any]
- classmethod fully_qualified_name() str¶
Return the fully qualified name for the NautilusConfig class.
- Return type:
str
References
- property id: str¶
Return the hashed identifier for the configuration.
- Return type:
str
- json() bytes¶
Return serialized JSON encoded bytes.
- Return type:
bytes
- json_primitives() dict[str, Any]¶
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type:
dict[str, Any]
- classmethod json_schema() dict[str, Any]¶
Generate a JSON schema for this configuration class.
- Return type:
dict[str, Any]
- classmethod parse(raw: bytes | str) Any¶
Return a decoded object of the given cls.
- Parameters:
cls (type) – The type to decode to.
raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type:
Any
- validate() bool¶
Return whether the configuration can be represented as valid JSON.
- Return type:
bool
- class ImportableExecAlgorithmConfig¶
Bases:
NautilusConfigConfiguration for an execution algorithm instance.
- Parameters:
exec_algorithm_path (str) – The fully qualified name of the execution algorithm class.
config_path (str) – The fully qualified name of the config class.
config (dict[str, Any]) – The execution algorithm configuration.
- exec_algorithm_path: str¶
- config_path: str¶
- config: dict[str, Any]¶
- dict() dict[str, Any]¶
Return a dictionary representation of the configuration.
- Return type:
dict[str, Any]
- classmethod fully_qualified_name() str¶
Return the fully qualified name for the NautilusConfig class.
- Return type:
str
References
- property id: str¶
Return the hashed identifier for the configuration.
- Return type:
str
- json() bytes¶
Return serialized JSON encoded bytes.
- Return type:
bytes
- json_primitives() dict[str, Any]¶
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type:
dict[str, Any]
- classmethod json_schema() dict[str, Any]¶
Generate a JSON schema for this configuration class.
- Return type:
dict[str, Any]
- classmethod parse(raw: bytes | str) Any¶
Return a decoded object of the given cls.
- Parameters:
cls (type) – The type to decode to.
raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type:
Any
- validate() bool¶
Return whether the configuration can be represented as valid JSON.
- Return type:
bool
- class ExecAlgorithmFactory¶
Bases:
objectProvides execution algorithm creation from importable configurations.
- static create(config: ImportableExecAlgorithmConfig)¶
Create an execution algorithm from the given configuration.
- Parameters:
config (ImportableExecAlgorithmConfig) – The configuration for the building step.
- Return type:
- Raises:
TypeError – If config is not of type ImportableExecAlgorithmConfig.
Live¶
- class LiveDataEngineConfig¶
Bases:
DataEngineConfigConfiguration for
LiveDataEngineinstances.- Parameters:
qsize (PositiveInt, default 100_000) – The queue size for the engines internal queue buffers.
graceful_shutdown_on_exception (bool, default False) – If the system should perform a graceful shutdown when an unexpected exception occurs during message queue processing (does not include user actor/strategy exceptions).
- qsize: Annotated[int, msgspec.Meta(gt=0)]¶
- graceful_shutdown_on_exception: bool¶
- buffer_deltas: bool¶
- debug: bool¶
- dict() dict[str, Any]¶
Return a dictionary representation of the configuration.
- Return type:
dict[str, Any]
- emit_quotes_from_book: bool¶
- emit_quotes_from_book_depths: bool¶
- classmethod fully_qualified_name() str¶
Return the fully qualified name for the NautilusConfig class.
- Return type:
str
References
- property id: str¶
Return the hashed identifier for the configuration.
- Return type:
str
- json() bytes¶
Return serialized JSON encoded bytes.
- Return type:
bytes
- json_primitives() dict[str, Any]¶
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type:
dict[str, Any]
- classmethod json_schema() dict[str, Any]¶
Generate a JSON schema for this configuration class.
- Return type:
dict[str, Any]
- classmethod parse(raw: bytes | str) Any¶
Return a decoded object of the given cls.
- Parameters:
cls (type) – The type to decode to.
raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type:
Any
- time_bars_build_delay: int¶
- time_bars_build_with_no_updates: bool¶
- time_bars_interval_type: str¶
- time_bars_origin_offset: dict | None¶
- time_bars_skip_first_non_full_bar: bool¶
- time_bars_timestamp_on_close: bool¶
- validate() bool¶
Return whether the configuration can be represented as valid JSON.
- Return type:
bool
- validate_data_sequence: bool¶
- class LiveRiskEngineConfig¶
Bases:
RiskEngineConfigConfiguration for
LiveRiskEngineinstances.- Parameters:
qsize (PositiveInt, default 100_000) – The queue size for the engines internal queue buffers.
graceful_shutdown_on_exception (bool, default False) – If the system should perform a graceful shutdown when an unexpected exception occurs during message queue processing (does not include user actor/strategy exceptions).
- qsize: Annotated[int, msgspec.Meta(gt=0)]¶
- graceful_shutdown_on_exception: bool¶
- bypass: bool¶
- debug: bool¶
- dict() dict[str, Any]¶
Return a dictionary representation of the configuration.
- Return type:
dict[str, Any]
- classmethod fully_qualified_name() str¶
Return the fully qualified name for the NautilusConfig class.
- Return type:
str
References
- property id: str¶
Return the hashed identifier for the configuration.
- Return type:
str
- json() bytes¶
Return serialized JSON encoded bytes.
- Return type:
bytes
- json_primitives() dict[str, Any]¶
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type:
dict[str, Any]
- classmethod json_schema() dict[str, Any]¶
Generate a JSON schema for this configuration class.
- Return type:
dict[str, Any]
- max_notional_per_order: dict[str, int]¶
- max_order_modify_rate: str¶
- max_order_submit_rate: str¶
- classmethod parse(raw: bytes | str) Any¶
Return a decoded object of the given cls.
- Parameters:
cls (type) – The type to decode to.
raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type:
Any
- validate() bool¶
Return whether the configuration can be represented as valid JSON.
- Return type:
bool
- class LiveExecEngineConfig¶
Bases:
ExecEngineConfigConfiguration for
LiveExecEngineinstances.The purpose of the in-flight order check is for live reconciliation, events emitted from the venue may have been lost at some point - leaving an order in an intermediate state, the check can recover these events via status reports.
- Parameters:
reconciliation (bool, default True) – If execution reconciliation is active at start-up.
reconciliation_lookback_mins (NonNegativeInt, optional) – The maximum lookback minutes to reconcile execution state for. If
Noneor 0 then will use the maximum lookback available from the venues.reconciliation_instrument_ids (list[InstrumentId], optional) – An include list of instrument IDs for execution reconciliation. If provided, only these instruments are reconciled. If
Noneor empty then all instruments are reconciled.filter_unclaimed_external_orders (bool, default False) – If unclaimed order events with an EXTERNAL strategy ID should be filtered/dropped.
filter_position_reports (bool, default False) – If position status reports are filtered from reconciliation. This may be applicable when other nodes are trading the same instrument(s), on the same account - which could cause conflicts in position status.
filtered_client_order_ids (list[ClientOrderId], optional) – A list of client order IDs to filter from reconciliation.
generate_missing_orders (bool, default True) – If MARKET order events will be generated during reconciliation to align discrepancies between internal and external positions.
inflight_check_interval_ms (NonNegativeInt, default 2_000) – The interval (milliseconds) between checking whether in-flight orders have exceeded their time-in-flight threshold. This should not be set less than the inflight_check_threshold_ms.
inflight_check_threshold_ms (NonNegativeInt, default 5_000) – The threshold (milliseconds) beyond which an in-flight orders status is checked with the venue. As a rule of thumb, you shouldn’t consider reducing this setting unless you are colocated with the venue (to avoid the potential for race conditions).
inflight_check_retries (NonNegativeInt, default 5) – The number of retry attempts the engine will make to verify the status of an in-flight order with the venue, should the initial attempt fail.
own_books_audit_interval_secs (NonNegativeFloat, optional) – The interval (seconds) between auditing all own books against public order books. The audit will ensure all order statuses are in sync and that no closed orders remain in an own book. Logs all failures as errors.
open_check_interval_secs (PositiveFloat, optional) – The interval (seconds) between checks for open orders at the venue. If there is a discrepancy then an order status report is generated and reconciled. A recommended setting is between 5-10 seconds, consider API rate limits and the additional request weights. If no value is specified then the open order checking task is not started.
open_check_open_only (bool, default True) – If True, the check_open_orders requests only currently open orders from the venue. If False, it requests the entire order history, which can be a heavy API call. This parameter only applies if the check_open_orders task is running.
open_check_lookback_mins (PositiveInt, default 60) – The lookback window (minutes) for order status polling during continuous reconciliation. Only orders modified within this time window will be considered for reconciliation.
open_check_threshold_ms (NonNegativeInt, default 5_000) – The minimum elapsed time (milliseconds) since the order’s last cached event before the open-order check acts on venue discrepancies (missing, status drift, etc.).
open_check_missing_retries (NonNegativeInt, default 5) – The maximum number of retries before resolving an order that is open in cache but not found at the venue. This prevents race conditions where orders are resolved too quickly due to network delays or venue processing time.
max_single_order_queries_per_cycle (PositiveInt, default 10) – The maximum number of single-order queries to perform per reconciliation cycle. Prevents rate limit exhaustion when many orders fail bulk query checks.
single_order_query_delay_ms (NonNegativeInt, default 100) – The delay (milliseconds) between single-order queries to prevent rate limit exhaustion.
position_check_interval_secs (PositiveFloat, optional) – The interval (seconds) between checks for position discrepancies between cache and venue. When a discrepancy is detected, the system queries for missing fills that may have been lost. A recommended setting is between 30-60 seconds. If no value is specified then position checking is not started.
position_check_lookback_mins (PositiveInt, default 60) – The lookback window (minutes) for querying fill reports when a position discrepancy is detected. Only fills within this window will be requested from the venue.
position_check_threshold_ms (NonNegativeInt, default 5_000) – The minimum elapsed time (milliseconds) since the position’s last local activity before the position check acts on discrepancies. This prevents race conditions with in-flight fills.
position_check_retries (NonNegativeInt, default 3) – The maximum number of reconciliation attempts for a position discrepancy before the engine stops retrying for that instrument. Once exceeded, an error is logged and the discrepancy is no longer actively reconciled.
reconciliation_startup_delay_secs (PositiveFloat, default 10.0) – The additional delay (seconds) applied AFTER startup reconciliation completes before starting the continuous reconciliation loop. This provides time for additional system stabilization after initial reconciliation.
purge_closed_orders_interval_mins (PositiveInt, optional) – The interval (minutes) between purging closed orders from the in-memory cache, will not purge from the database. If None, closed orders will not be automatically purged. A recommended setting is 10-15 minutes for HFT.
purge_closed_orders_buffer_mins (NonNegativeInt, optional) – The time buffer (minutes) from when an order was closed before it can be purged. Only orders closed for at least this amount of time will be purged. A recommended setting is 60 minutes for HFT.
purge_closed_positions_interval_mins (PositiveInt, optional) – The interval (minutes) between purging closed positions from the in-memory cache, will not purge from the database. If None, closed positions will not be automatically purged. A recommended setting is 10-15 minutes for HFT.
purge_closed_positions_buffer_mins (NonNegativeInt, optional) – The time buffer (minutes) from when a position was closed before it can be purged. Only positions closed for at least this amount of time will be purged. A recommended setting is 60 minutes for HFT.
purge_account_events_interval_mins (PositiveInt, optional) – The interval (minutes) between purging account events from the in-memory cache, will not purge from the database. If None, account events will not be automatically purged. A recommended setting is 10-15 minutes for HFT.
purge_account_events_lookback_mins (NonNegativeInt, optional) – The time buffer (minutes) from when an account event occurred before it can be purged. Only events outside the lookback window will be purged. A recommended setting is 60 minutes for HFT.
purge_from_database (bool, default False) – If purging operations will also delete from the backing database, in addition to the in-memory cache. Note: Currently account events are not purged from the database - pending reimplementation.
qsize (PositiveInt, default 100_000) – The queue size for the engines internal queue buffers.
graceful_shutdown_on_exception (bool, default False) – If the system should perform a graceful shutdown when an unexpected exception occurs during message queue processing (does not include user actor/strategy exceptions).
- reconciliation: bool¶
- reconciliation_lookback_mins: Annotated[int, msgspec.Meta(ge=0)] | None¶
- reconciliation_instrument_ids: list[InstrumentId] | None¶
- filter_unclaimed_external_orders: bool¶
- filter_position_reports: bool¶
- filtered_client_order_ids: list[ClientOrderId] | None¶
- generate_missing_orders: bool¶
- inflight_check_interval_ms: Annotated[int, msgspec.Meta(ge=0)]¶
- inflight_check_threshold_ms: Annotated[int, msgspec.Meta(ge=0)]¶
- inflight_check_retries: Annotated[int, msgspec.Meta(ge=0)]¶
- own_books_audit_interval_secs: Annotated[float, msgspec.Meta(gt=0.0)] | None¶
- open_check_interval_secs: Annotated[float, msgspec.Meta(gt=0.0)] | None¶
- open_check_open_only: bool¶
- open_check_lookback_mins: Annotated[int, msgspec.Meta(gt=0)]¶
- open_check_threshold_ms: Annotated[int, msgspec.Meta(ge=0)]¶
- open_check_missing_retries: Annotated[int, msgspec.Meta(ge=0)]¶
- max_single_order_queries_per_cycle: Annotated[int, msgspec.Meta(gt=0)]¶
- single_order_query_delay_ms: Annotated[int, msgspec.Meta(ge=0)]¶
- position_check_interval_secs: Annotated[float, msgspec.Meta(gt=0.0)] | None¶
- position_check_lookback_mins: Annotated[int, msgspec.Meta(gt=0)]¶
- position_check_threshold_ms: Annotated[int, msgspec.Meta(ge=0)]¶
- position_check_retries: Annotated[int, msgspec.Meta(ge=0)]¶
- reconciliation_startup_delay_secs: Annotated[float, msgspec.Meta(gt=0.0)]¶
- purge_closed_orders_interval_mins: Annotated[int, msgspec.Meta(gt=0)] | None¶
- purge_closed_orders_buffer_mins: Annotated[int, msgspec.Meta(ge=0)] | None¶
- purge_closed_positions_interval_mins: Annotated[int, msgspec.Meta(gt=0)] | None¶
- purge_closed_positions_buffer_mins: Annotated[int, msgspec.Meta(ge=0)] | None¶
- purge_account_events_interval_mins: Annotated[int, msgspec.Meta(gt=0)] | None¶
- purge_account_events_lookback_mins: Annotated[int, msgspec.Meta(ge=0)] | None¶
- purge_from_database: bool¶
- qsize: Annotated[int, msgspec.Meta(gt=0)]¶
- graceful_shutdown_on_exception: bool¶
- allow_overfills: bool¶
- convert_quote_qty_to_base: bool¶
- debug: bool¶
- dict() dict[str, Any]¶
Return a dictionary representation of the configuration.
- Return type:
dict[str, Any]
- classmethod fully_qualified_name() str¶
Return the fully qualified name for the NautilusConfig class.
- Return type:
str
References
- property id: str¶
Return the hashed identifier for the configuration.
- Return type:
str
- json() bytes¶
Return serialized JSON encoded bytes.
- Return type:
bytes
- json_primitives() dict[str, Any]¶
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type:
dict[str, Any]
- classmethod json_schema() dict[str, Any]¶
Generate a JSON schema for this configuration class.
- Return type:
dict[str, Any]
- load_cache: bool¶
- manage_own_order_books: bool¶
- classmethod parse(raw: bytes | str) Any¶
Return a decoded object of the given cls.
- Parameters:
cls (type) – The type to decode to.
raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type:
Any
- snapshot_orders: bool¶
- snapshot_positions: bool¶
- snapshot_positions_interval_secs: Annotated[float, msgspec.Meta(gt=0.0)] | None¶
- validate() bool¶
Return whether the configuration can be represented as valid JSON.
- Return type:
bool
- class RoutingConfig¶
Bases:
NautilusConfigConfiguration for live client message routing.
- Parameters:
default (bool) – If the client should be registered as the default routing client (when a specific venue routing cannot be found).
venues (list[str], optional) – The venues to register for routing.
- default: bool¶
- venues: frozenset[str] | None¶
- dict() dict[str, Any]¶
Return a dictionary representation of the configuration.
- Return type:
dict[str, Any]
- classmethod fully_qualified_name() str¶
Return the fully qualified name for the NautilusConfig class.
- Return type:
str
References
- property id: str¶
Return the hashed identifier for the configuration.
- Return type:
str
- json() bytes¶
Return serialized JSON encoded bytes.
- Return type:
bytes
- json_primitives() dict[str, Any]¶
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type:
dict[str, Any]
- classmethod json_schema() dict[str, Any]¶
Generate a JSON schema for this configuration class.
- Return type:
dict[str, Any]
- classmethod parse(raw: bytes | str) Any¶
Return a decoded object of the given cls.
- Parameters:
cls (type) – The type to decode to.
raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type:
Any
- validate() bool¶
Return whether the configuration can be represented as valid JSON.
- Return type:
bool
- class LiveDataClientConfig¶
Bases:
NautilusConfigConfiguration for
LiveDataClientinstances.- Parameters:
handle_revised_bars (bool) – If DataClient will emit bar updates when a new bar opens.
instrument_provider (InstrumentProviderConfig) – The clients instrument provider configuration.
routing (RoutingConfig) – The clients message routing config.
- handle_revised_bars: bool¶
- instrument_provider: InstrumentProviderConfig¶
- routing: RoutingConfig¶
- dict() dict[str, Any]¶
Return a dictionary representation of the configuration.
- Return type:
dict[str, Any]
- classmethod fully_qualified_name() str¶
Return the fully qualified name for the NautilusConfig class.
- Return type:
str
References
- property id: str¶
Return the hashed identifier for the configuration.
- Return type:
str
- json() bytes¶
Return serialized JSON encoded bytes.
- Return type:
bytes
- json_primitives() dict[str, Any]¶
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type:
dict[str, Any]
- classmethod json_schema() dict[str, Any]¶
Generate a JSON schema for this configuration class.
- Return type:
dict[str, Any]
- classmethod parse(raw: bytes | str) Any¶
Return a decoded object of the given cls.
- Parameters:
cls (type) – The type to decode to.
raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type:
Any
- validate() bool¶
Return whether the configuration can be represented as valid JSON.
- Return type:
bool
- class LiveExecClientConfig¶
Bases:
NautilusConfigConfiguration for
LiveExecutionClientinstances.- Parameters:
instrument_provider (InstrumentProviderConfig) – The clients instrument provider configuration.
routing (RoutingConfig) – The clients message routing config.
- instrument_provider: InstrumentProviderConfig¶
- routing: RoutingConfig¶
- dict() dict[str, Any]¶
Return a dictionary representation of the configuration.
- Return type:
dict[str, Any]
- classmethod fully_qualified_name() str¶
Return the fully qualified name for the NautilusConfig class.
- Return type:
str
References
- property id: str¶
Return the hashed identifier for the configuration.
- Return type:
str
- json() bytes¶
Return serialized JSON encoded bytes.
- Return type:
bytes
- json_primitives() dict[str, Any]¶
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type:
dict[str, Any]
- classmethod json_schema() dict[str, Any]¶
Generate a JSON schema for this configuration class.
- Return type:
dict[str, Any]
- classmethod parse(raw: bytes | str) Any¶
Return a decoded object of the given cls.
- Parameters:
cls (type) – The type to decode to.
raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type:
Any
- validate() bool¶
Return whether the configuration can be represented as valid JSON.
- Return type:
bool
- class ControllerConfig¶
Bases:
ActorConfigThe base model for all controller configurations.
- component_id: ComponentId | None¶
- dict() dict[str, Any]¶
Return a dictionary representation of the configuration.
- Return type:
dict[str, Any]
- classmethod fully_qualified_name() str¶
Return the fully qualified name for the NautilusConfig class.
- Return type:
str
References
- property id: str¶
Return the hashed identifier for the configuration.
- Return type:
str
- json() bytes¶
Return serialized JSON encoded bytes.
- Return type:
bytes
- json_primitives() dict[str, Any]¶
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type:
dict[str, Any]
- classmethod json_schema() dict[str, Any]¶
Generate a JSON schema for this configuration class.
- Return type:
dict[str, Any]
- log_commands: bool¶
- log_events: bool¶
- classmethod parse(raw: bytes | str) Any¶
Return a decoded object of the given cls.
- Parameters:
cls (type) – The type to decode to.
raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type:
Any
- validate() bool¶
Return whether the configuration can be represented as valid JSON.
- Return type:
bool
- class ControllerFactory¶
Bases:
objectProvides controller creation from importable configurations.
- static create(config: ImportableControllerConfig, trader)¶
- class TradingNodeConfig¶
Bases:
NautilusKernelConfigConfiguration for
TradingNodeinstances.- Parameters:
trader_id (TraderId, default "TRADER-001") – The trader ID for the node (must be a name and ID tag separated by a hyphen).
cache (CacheConfig, optional) – The cache 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.
data_clients (dict[str, ImportableConfig | LiveDataClientConfig], optional) – The data client configurations.
exec_clients (dict[str, ImportableConfig | LiveExecClientConfig], optional) – The execution client configurations.
- environment: Environment¶
- data_engine: LiveDataEngineConfig¶
- risk_engine: LiveRiskEngineConfig¶
- exec_engine: LiveExecEngineConfig¶
- data_clients: dict[str, LiveDataClientConfig]¶
- exec_clients: dict[str, LiveExecClientConfig]¶
- actors: list[ImportableActorConfig]¶
- cache: CacheConfig | None¶
- catalogs: list[DataCatalogConfig]¶
- controller: ImportableControllerConfig | None¶
- dict() dict[str, Any]¶
Return a dictionary representation of the configuration.
- Return type:
dict[str, Any]
- emulator: OrderEmulatorConfig | None¶
- exec_algorithms: list[ImportableExecAlgorithmConfig]¶
- classmethod fully_qualified_name() str¶
Return the fully qualified name for the NautilusConfig class.
- Return type:
str
References
- property id: str¶
Return the hashed identifier for the configuration.
- Return type:
str
- json() bytes¶
Return serialized JSON encoded bytes.
- Return type:
bytes
- json_primitives() dict[str, Any]¶
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type:
dict[str, Any]
- classmethod json_schema() dict[str, Any]¶
Generate a JSON schema for this configuration class.
- Return type:
dict[str, Any]
- load_state: bool¶
- logging: LoggingConfig | None¶
- loop_debug: bool¶
- message_bus: MessageBusConfig | None¶
- classmethod parse(raw: bytes | str) Any¶
Return a decoded object of the given cls.
- Parameters:
cls (type) – The type to decode to.
raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type:
Any
- portfolio: PortfolioConfig | None¶
- save_state: bool¶
- strategies: list[ImportableStrategyConfig]¶
- streaming: StreamingConfig | None¶
- timeout_connection: Annotated[float, msgspec.Meta(gt=0.0)]¶
- timeout_disconnection: Annotated[float, msgspec.Meta(gt=0.0)]¶
- timeout_portfolio: Annotated[float, msgspec.Meta(gt=0.0)]¶
- timeout_post_stop: Annotated[float, msgspec.Meta(gt=0.0)]¶
- timeout_reconciliation: Annotated[float, msgspec.Meta(gt=0.0)]¶
- timeout_shutdown: Annotated[float, msgspec.Meta(gt=0.0)]¶
- validate() bool¶
Return whether the configuration can be represented as valid JSON.
- Return type:
bool
Persistence¶
- class StreamingConfig¶
Bases:
NautilusConfigConfiguration 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.
fs_rust_storage_options (dict, optional) – The fsspec storage options for the Rust backend.
flush_interval_ms (int, optional) – The flush interval (milliseconds) for writing chunks.
replace_existing (bool, default False) – If any existing feather files should be replaced.
include_types (list[type], optional) – A list of Arrow serializable types to write. If this is specified then only the included types will be written.
rotation_mode (RotationMode, default RotationMode.NO_ROTATION) – The mode for file rotation.
max_file_size (int, default 1GB) – The maximum file size in bytes before rotation (for SIZE mode).
rotation_interval (pd.Timedelta, optional) – The time interval for file rotation (for INTERVAL mode and SCHEDULED_DATES mode).
rotation_time (time, default 00:00) – The time of day for file rotation (for SCHEDULED_DATES mode).
rotation_timezone (str, default 'UTC') – The timezone for rotation calculations (for SCHEDULED_DATES mode).
- catalog_path: str¶
- fs_protocol: str | None¶
- fs_storage_options: dict | None¶
- fs_rust_storage_options: dict | None¶
- flush_interval_ms: int | None¶
- replace_existing: bool¶
- rotation_mode: RotationMode¶
- max_file_size: int¶
- rotation_interval: Timedelta | None¶
- rotation_time: time¶
- rotation_timezone: str¶
- property fs¶
- as_catalog()¶
- dict() dict[str, Any]¶
Return a dictionary representation of the configuration.
- Return type:
dict[str, Any]
- classmethod fully_qualified_name() str¶
Return the fully qualified name for the NautilusConfig class.
- Return type:
str
References
- property id: str¶
Return the hashed identifier for the configuration.
- Return type:
str
- json() bytes¶
Return serialized JSON encoded bytes.
- Return type:
bytes
- json_primitives() dict[str, Any]¶
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type:
dict[str, Any]
- classmethod json_schema() dict[str, Any]¶
Generate a JSON schema for this configuration class.
- Return type:
dict[str, Any]
- classmethod parse(raw: bytes | str) Any¶
Return a decoded object of the given cls.
- Parameters:
cls (type) – The type to decode to.
raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type:
Any
- validate() bool¶
Return whether the configuration can be represented as valid JSON.
- Return type:
bool
- class DataCatalogConfig¶
Bases:
NautilusConfigConfiguration 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.
fs_rust_storage_options (dict, optional) – The fsspec storage options for the Rust backend.
- path: str¶
- fs_protocol: str | None¶
- fs_storage_options: dict | None¶
- fs_rust_storage_options: dict | None¶
- name: str | None¶
- dict() dict[str, Any]¶
Return a dictionary representation of the configuration.
- Return type:
dict[str, Any]
- classmethod fully_qualified_name() str¶
Return the fully qualified name for the NautilusConfig class.
- Return type:
str
References
- property id: str¶
Return the hashed identifier for the configuration.
- Return type:
str
- json() bytes¶
Return serialized JSON encoded bytes.
- Return type:
bytes
- json_primitives() dict[str, Any]¶
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type:
dict[str, Any]
- classmethod json_schema() dict[str, Any]¶
Generate a JSON schema for this configuration class.
- Return type:
dict[str, Any]
- classmethod parse(raw: bytes | str) Any¶
Return a decoded object of the given cls.
- Parameters:
cls (type) – The type to decode to.
raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type:
Any
- validate() bool¶
Return whether the configuration can be represented as valid JSON.
- Return type:
bool
Risk¶
- class RiskEngineConfig¶
Bases:
NautilusConfigConfiguration for
RiskEngineinstances.- Parameters:
bypass (bool, default False) – If True, then will bypass all pre-trade risk checks and rate limits (will still check for duplicate IDs).
max_order_submit_rate (str, default 100/00:00:01) – The maximum rate of submit order commands per timedelta.
max_order_modify_rate (str, default 100/00:00:01) – The maximum rate of modify order commands per timedelta.
max_notional_per_order (dict[str, int], default empty dict) – The maximum notional value of an order per instrument ID. The value should be a valid decimal format.
debug (bool, default False) – If debug mode is active (will provide extra debug logging).
- bypass: bool¶
- max_order_submit_rate: str¶
- max_order_modify_rate: str¶
- max_notional_per_order: dict[str, int]¶
- debug: bool¶
- dict() dict[str, Any]¶
Return a dictionary representation of the configuration.
- Return type:
dict[str, Any]
- classmethod fully_qualified_name() str¶
Return the fully qualified name for the NautilusConfig class.
- Return type:
str
References
- property id: str¶
Return the hashed identifier for the configuration.
- Return type:
str
- json() bytes¶
Return serialized JSON encoded bytes.
- Return type:
bytes
- json_primitives() dict[str, Any]¶
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type:
dict[str, Any]
- classmethod json_schema() dict[str, Any]¶
Generate a JSON schema for this configuration class.
- Return type:
dict[str, Any]
- classmethod parse(raw: bytes | str) Any¶
Return a decoded object of the given cls.
- Parameters:
cls (type) – The type to decode to.
raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type:
Any
- validate() bool¶
Return whether the configuration can be represented as valid JSON.
- Return type:
bool
System¶
- class NautilusKernelConfig¶
Bases:
NautilusConfigConfiguration for a
NautilusKernelcore system instance.- Parameters:
environment (Environment {
BACKTEST,SANDBOX,LIVE}) – The kernel environment context.trader_id (TraderId) – The trader ID for the kernel (must be a name and ID tag separated by a hyphen).
instance_id (UUID4, optional) – The unique instance identifier for the kernel.
cache (CacheConfig, optional) – The cache configuration.
message_bus (MessageBusConfig, optional) – The message bus configuration.
data_engine (DataEngineConfig, optional) – The data engine configuration.
risk_engine (RiskEngineConfig, optional) – The risk engine configuration.
exec_engine (ExecEngineConfig, optional) – The execution engine configuration.
portfolio (PortfolioConfig, optional) – The portfolio configuration.
emulator (OrderEmulatorConfig, optional) – The order emulator configuration.
streaming (StreamingConfig, optional) – The configuration for streaming to feather files.
catalogs (list[DataCatalogConfig], optional) – The list of data catalog configurations.
actors (list[ImportableActorConfig]) – The actor configurations for the kernel.
strategies (list[ImportableStrategyConfig]) – The strategy configurations for the kernel.
exec_algorithms (list[ImportableExecAlgorithmConfig]) – The execution algorithm configurations for the kernel.
controller (ImportableControllerConfig, optional) – The trader controller for the kernel.
load_state (bool, default True) – If trading strategy state should be loaded from the database on start.
save_state (bool, default True) – If trading strategy state should be saved to the database on stop.
loop_debug (bool, default False) – If the asyncio event loop should be in debug mode.
logging (LoggingConfig, optional) – The logging configuration for the kernel.
timeout_connection (PositiveFloat, default 60) – The timeout (seconds) for all clients to connect and initialize.
timeout_reconciliation (PositiveFloat, default 30) – The timeout (seconds) for execution state to reconcile.
timeout_portfolio (PositiveFloat, default 10) – The timeout (seconds) for portfolio to initialize margins and unrealized PnLs.
timeout_disconnection (PositiveFloat, default 10) – The timeout (seconds) for all engine clients to disconnect.
timeout_post_stop (PositiveFloat, default 10) – The timeout (seconds) after stopping the node to await residual events before final shutdown.
timeout_shutdown (PositiveFloat, default 5) – The timeout (seconds) to await pending tasks cancellation during shutdown.
Notes
We assume that catalogs have no duplicate data in time series. Also, if some time series are contained in several catalogs (one per month for example), ensure that the DataCatalogConfig list passed to BacktestEngineConfig is ordered in ascending chronological order.
- environment: Environment¶
- cache: CacheConfig | None¶
- message_bus: MessageBusConfig | None¶
- data_engine: DataEngineConfig | None¶
- risk_engine: RiskEngineConfig | None¶
- exec_engine: ExecEngineConfig | None¶
- portfolio: PortfolioConfig | None¶
- emulator: OrderEmulatorConfig | None¶
- streaming: StreamingConfig | None¶
- catalogs: list[DataCatalogConfig]¶
- actors: list[ImportableActorConfig]¶
- strategies: list[ImportableStrategyConfig]¶
- exec_algorithms: list[ImportableExecAlgorithmConfig]¶
- controller: ImportableControllerConfig | None¶
- load_state: bool¶
- save_state: bool¶
- loop_debug: bool¶
- logging: LoggingConfig | None¶
- timeout_connection: Annotated[float, msgspec.Meta(gt=0.0)]¶
- timeout_reconciliation: Annotated[float, msgspec.Meta(gt=0.0)]¶
- timeout_portfolio: Annotated[float, msgspec.Meta(gt=0.0)]¶
- timeout_disconnection: Annotated[float, msgspec.Meta(gt=0.0)]¶
- timeout_post_stop: Annotated[float, msgspec.Meta(gt=0.0)]¶
- timeout_shutdown: Annotated[float, msgspec.Meta(gt=0.0)]¶
- dict() dict[str, Any]¶
Return a dictionary representation of the configuration.
- Return type:
dict[str, Any]
- classmethod fully_qualified_name() str¶
Return the fully qualified name for the NautilusConfig class.
- Return type:
str
References
- property id: str¶
Return the hashed identifier for the configuration.
- Return type:
str
- json() bytes¶
Return serialized JSON encoded bytes.
- Return type:
bytes
- json_primitives() dict[str, Any]¶
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type:
dict[str, Any]
- classmethod json_schema() dict[str, Any]¶
Generate a JSON schema for this configuration class.
- Return type:
dict[str, Any]
- classmethod parse(raw: bytes | str) Any¶
Return a decoded object of the given cls.
- Parameters:
cls (type) – The type to decode to.
raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type:
Any
- validate() bool¶
Return whether the configuration can be represented as valid JSON.
- Return type:
bool
Trading¶
- class StrategyConfig¶
Bases:
NautilusConfigThe base model for all trading strategy configurations.
- Parameters:
strategy_id (StrategyId, optional) – The unique ID for the strategy. Will become the strategy ID if not None.
order_id_tag (str, optional) – The unique order ID tag for the strategy. Must be unique amongst all running strategies for a particular trader ID.
use_uuid_client_order_ids (bool, default False) – If UUID4’s should be used for client order ID values.
use_hyphens_in_client_order_ids (bool, default True) – If hyphens should be used in generated client order ID values.
oms_type (OmsType, optional) – The order management system type for the strategy. This will determine how the ExecutionEngine handles position IDs.
external_order_claims (list[InstrumentId], optional) – The external order claim instrument IDs. External orders for matching instrument IDs will be associated with (claimed by) the strategy.
manage_contingent_orders (bool, default False) – If OTO, OCO, and OUO open contingent orders should be managed automatically by the strategy. Any emulated orders which are active local will be managed by the OrderEmulator instead.
manage_gtd_expiry (bool, default False) – If all order GTD time in force expirations should be managed by the strategy. If True, then will ensure open orders have their GTD timers re-activated on start.
manage_stop (bool, default False) – If the strategy should automatically perform a market exit when stopped. If True, calling stop() will first cancel all orders and close all positions before the strategy transitions to the STOPPED state.
market_exit_interval_ms (int, default 100) – The interval in milliseconds to check for in-flight orders and open positions during a market exit.
market_exit_max_attempts (int, default 100) – The maximum number of attempts to wait for orders and positions to close during a market exit before completing. Defaults to 100 attempts (10 seconds at 100ms intervals).
market_exit_time_in_force (TimeInForce, default
GTC) – The time in force for closing market orders during a market exit.market_exit_reduce_only (bool, default True) – If closing market orders during a market exit should be reduce only.
log_events (bool, default True) – If events should be logged by the strategy. If False, then only warning events and above are logged.
log_commands (bool, default True) – If commands should be logged by the strategy.
log_rejected_due_post_only_as_warning (bool, default True) – If order rejected events where due_post_only is True should be logged as warnings.
- strategy_id: StrategyId | None¶
- order_id_tag: str | None¶
- use_uuid_client_order_ids: bool¶
- use_hyphens_in_client_order_ids: bool¶
- oms_type: str | None¶
- external_order_claims: list[InstrumentId] | None¶
- manage_contingent_orders: bool¶
- manage_gtd_expiry: bool¶
- manage_stop: bool¶
- market_exit_interval_ms: Annotated[int, msgspec.Meta(gt=0)]¶
- market_exit_max_attempts: Annotated[int, msgspec.Meta(gt=0)]¶
- market_exit_time_in_force: TimeInForce¶
- market_exit_reduce_only: bool¶
- log_events: bool¶
- log_commands: bool¶
- log_rejected_due_post_only_as_warning: bool¶
- dict() dict[str, Any]¶
Return a dictionary representation of the configuration.
- Return type:
dict[str, Any]
- classmethod fully_qualified_name() str¶
Return the fully qualified name for the NautilusConfig class.
- Return type:
str
References
- property id: str¶
Return the hashed identifier for the configuration.
- Return type:
str
- json() bytes¶
Return serialized JSON encoded bytes.
- Return type:
bytes
- json_primitives() dict[str, Any]¶
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type:
dict[str, Any]
- classmethod json_schema() dict[str, Any]¶
Generate a JSON schema for this configuration class.
- Return type:
dict[str, Any]
- classmethod parse(raw: bytes | str) Any¶
Return a decoded object of the given cls.
- Parameters:
cls (type) – The type to decode to.
raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type:
Any
- validate() bool¶
Return whether the configuration can be represented as valid JSON.
- Return type:
bool
- class ImportableStrategyConfig¶
Bases:
NautilusConfigConfiguration for a trading strategy instance.
- Parameters:
strategy_path (str) – The fully qualified name of the strategy class.
config_path (str) – The fully qualified name of the config class.
config (dict[str, Any]) – The strategy configuration.
- strategy_path: str¶
- config_path: str¶
- config: dict[str, Any]¶
- dict() dict[str, Any]¶
Return a dictionary representation of the configuration.
- Return type:
dict[str, Any]
- classmethod fully_qualified_name() str¶
Return the fully qualified name for the NautilusConfig class.
- Return type:
str
References
- property id: str¶
Return the hashed identifier for the configuration.
- Return type:
str
- json() bytes¶
Return serialized JSON encoded bytes.
- Return type:
bytes
- json_primitives() dict[str, Any]¶
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type:
dict[str, Any]
- classmethod json_schema() dict[str, Any]¶
Generate a JSON schema for this configuration class.
- Return type:
dict[str, Any]
- classmethod parse(raw: bytes | str) Any¶
Return a decoded object of the given cls.
- Parameters:
cls (type) – The type to decode to.
raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type:
Any
- validate() bool¶
Return whether the configuration can be represented as valid JSON.
- Return type:
bool
- class StrategyFactory¶
Bases:
objectProvides strategy creation from importable configurations.
- static create(config: ImportableStrategyConfig)¶
Create a trading strategy from the given configuration.
- Parameters:
config (ImportableStrategyConfig) – The configuration for the building step.
- Return type:
- Raises:
TypeError – If config is not of type ImportableStrategyConfig.
- class ImportableControllerConfig¶
Bases:
NautilusConfigConfiguration for a controller instance.
- Parameters:
controller_path (str) – The fully qualified name of the controller class.
config_path (str) – The fully qualified name of the config class.
config (dict[str, Any]) – The controller configuration.
- controller_path: str¶
- config_path: str¶
- config: dict¶
- dict() dict[str, Any]¶
Return a dictionary representation of the configuration.
- Return type:
dict[str, Any]
- classmethod fully_qualified_name() str¶
Return the fully qualified name for the NautilusConfig class.
- Return type:
str
References
- property id: str¶
Return the hashed identifier for the configuration.
- Return type:
str
- json() bytes¶
Return serialized JSON encoded bytes.
- Return type:
bytes
- json_primitives() dict[str, Any]¶
Return a dictionary representation of the configuration with JSON primitive types as values.
- Return type:
dict[str, Any]
- classmethod json_schema() dict[str, Any]¶
Generate a JSON schema for this configuration class.
- Return type:
dict[str, Any]
- classmethod parse(raw: bytes | str) Any¶
Return a decoded object of the given cls.
- Parameters:
cls (type) – The type to decode to.
raw (bytes or str) – The raw bytes or JSON string to decode.
- Return type:
Any
- validate() bool¶
Return whether the configuration can be represented as valid JSON.
- Return type:
bool