-
Notifications
You must be signed in to change notification settings - Fork 0
Config
def parse_filters_expr(s: str | None):
"""
Parse a pyarrow.dataset filter expression from a string.
从字符串解析 pyarrow.dataset 过滤器表达式。
>>> parse_filters_expr('field("Currency") == "CHF"')
<pyarrow.dataset.Expression (Currency == "CHF")>
>>> parse_filters_expr("print('hello')")
>>> parse_filters_expr("None")
"""
...
Bases: NautilusConfig
class BacktestVenueConfig(NautilusConfig):
"""
Represents a venue configuration for one specific backtest engine.
表示一个特定回溯测试引擎的场所配置。
"""
def __init__(self):
...
name: str
oms_type: str
account_type: str
starting_balances: list[str]
base_currency: str | None
default_leverage: float
leverages: dict[str, float] | None
book_type: str
routing: bool
frozen_account: bool
bar_execution: bool
reject_stop_orders: bool
support_gtd_orders: bool
support_contingent_orders: bool
use_position_ids: bool
use_random_ids: bool
use_reduce_only: bool
modules: list[ImportableActorConfig] | None
@property
def id(self) -> str:
"""
Return the hashed identifier for the configuration.
返回配置的哈希标识符。
Return type: str
"""
...
def dict(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration.
返回配置的字典表示形式。
Return type: dict[str, Any]
"""
...
@classmethod
def fully_qualified_name(cls) -> str:
"""
Return the fully qualified name for the NautilusConfig class.
返回 NautilusConfig 类的完全限定名称。
Return type: str
"""
...
def json(self) -> bytes:
"""
Return serialized JSON encoded bytes.
返回序列化 JSON 编码的字节。
Return type: bytes
"""
...
def json_primitives(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration with JSON primitive types as values.
返回配置的字典表示形式,其中值为 JSON 原始类型。
Return type: dict[str, Any]
"""
...
@classmethod
def parse(cls, raw: bytes | str):
"""
Return a decoded object of the given cls.
返回给定 cls 的解码对象。
Parameters:
参数:
cls (type) – The type to decode to.
cls (type) - 要解码到的类型。
raw (bytes or str) – The raw bytes or JSON string to decode.
raw (bytes or str) - 要解码的原始字节或 JSON 字符串。
Return type: Any
"""
...
def validate(self) -> bool:
"""
Return whether the configuration can be represented as valid JSON.
返回配置是否可以表示为有效的 JSON。
Return type: bool
"""
...
Bases: NautilusConfig
class BacktestDataConfig(NautilusConfig):
"""
Represents the data configuration for one specific backtest run.
表示一个特定回溯测试运行的数据配置。
"""
def __init__(self):
...
catalog_path: str
data_cls: str
catalog_fs_protocol: str | None
catalog_fs_storage_options: dict | None
instrument_id: InstrumentId | None
start_time: str | int | None
end_time: str | int | None
filter_expr: str | None
client_id: str | None
metadata: dict | None
bar_spec: str | None
batch_size: int | None
@property
def data_type(self) -> type:
"""
Return a type for the specified data_cls for the configuration.
返回配置的指定 data_cls 的类型。
Return type: type
"""
...
@property
def query(self) -> dict[str, Any]:
"""
Return a catalog query object for the configuration.
返回配置的目录查询对象。
Return type: dict[str, Any]
"""
...
@property
def start_time_nanos(self) -> int:
"""
Return the data configuration start time in UNIX nanoseconds.
返回数据配置的开始时间(以 UNIX 纳秒为单位)。
Will be zero if no start_time was specified.
如果没有指定 start_time,则将为零。
Return type: int
"""
...
@property
def end_time_nanos(self) -> int:
"""
Return the data configuration end time in UNIX nanoseconds.
返回数据配置的结束时间(以 UNIX 纳秒为单位)。
Will be sys.maxsize if no end_time was specified.
如果没有指定 end_time,则将为 sys.maxsize。
Return type: int
"""
...
@property
def id(self) -> str:
"""
Return the hashed identifier for the configuration.
返回配置的哈希标识符。
Return type: str
"""
...
def dict(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration.
返回配置的字典表示形式。
Return type: dict[str, Any]
"""
...
@classmethod
def fully_qualified_name(cls) -> str:
"""
Return the fully qualified name for the NautilusConfig class.
返回 NautilusConfig 类的完全限定名称。
Return type: str
"""
...
def json(self) -> bytes:
"""
Return serialized JSON encoded bytes.
返回序列化 JSON 编码的字节。
Return type: bytes
"""
...
def json_primitives(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration with JSON primitive types as values.
返回配置的字典表示形式,其中值为 JSON 原始类型。
Return type: dict[str, Any]
"""
...
@classmethod
def parse(cls, raw: bytes | str):
"""
Return a decoded object of the given cls.
返回给定 cls 的解码对象。
Parameters:
参数:
cls (type) – The type to decode to.
cls (type) - 要解码到的类型。
raw (bytes or str) – The raw bytes or JSON string to decode.
raw (bytes or str) - 要解码的原始字节或 JSON 字符串。
Return type: Any
"""
...
def validate(self) -> bool:
"""
Return whether the configuration can be represented as valid JSON.
返回配置是否可以表示为有效的 JSON。
Return type: bool
"""
...
Bases: NautilusKernelConfig
class BacktestEngineConfig(NautilusKernelConfig):
"""
Configuration for BacktestEngine instances.
BacktestEngine 实例的配置。
Parameters:
参数:
trader_id (TraderId) – The trader ID for the node (must be a name and ID tag separated by a hyphen).
trader_id (TraderId) - 节点的交易者 ID(必须是名称和 ID 标签,用连字符分隔)。
log_level (str , default "INFO") – The stdout log level for the node.
log_level (str,默认 "INFO") - 节点的标准输出日志级别。
loop_debug (bool , default False) – If the asyncio event loop should be in debug mode.
loop_debug (bool,默认 False) - asyncio 事件循环是否应处于调试模式。
cache (CacheConfig , optional) – The cache configuration.
cache (CacheConfig,可选) - 缓存配置。
data_engine (DataEngineConfig , optional) – The live data engine configuration.
data_engine (DataEngineConfig,可选) - 实时数据引擎配置。
risk_engine (RiskEngineConfig , optional) – The live risk engine configuration.
risk_engine (RiskEngineConfig,可选) - 实时风险引擎配置。
exec_engine (ExecEngineConfig , optional) – The live execution engine configuration.
exec_engine (ExecEngineConfig,可选) - 实时执行引擎配置。
streaming (StreamingConfig , optional) – The configuration for streaming to feather files.
streaming (StreamingConfig,可选) - 流式传输到 feather 文件的配置。
strategies (list [ImportableStrategyConfig ]) – The strategy configurations for the kernel.
strategies (list [ImportableStrategyConfig ]) - 内核的策略配置。
actors (list [ImportableActorConfig ]) – The actor configurations for the kernel.
actors (list [ImportableActorConfig ]) - 内核的执行器配置。
exec_algorithms (list [ImportableExecAlgorithmConfig ]) – The execution algorithm configurations for the kernel.
exec_algorithms (list [ImportableExecAlgorithmConfig ]) - 内核的执行算法配置。
controller (ImportableControllerConfig , optional) – The trader controller for the kernel.
controller (ImportableControllerConfig,可选) - 内核的交易者控制器。
load_state (bool , default True) – If trading strategy state should be loaded from the database on start.
load_state (bool,默认 True) - 是否应在启动时从数据库加载交易策略状态。
save_state (bool , default True) – If trading strategy state should be saved to the database on stop.
save_state (bool,默认 True) - 是否应在停止时将交易策略状态保存到数据库。
bypass_logging (bool , default False) – If logging should be bypassed.
bypass_logging (bool,默认 False) - 是否应绕过日志记录。
run_analysis (bool , default True) – If post backtest performance analysis should be run.
run_analysis (bool,默认 True) - 是否应运行回溯测试后性能分析。
"""
def __init__(self):
...
environment: Environment
trader_id: TraderId
data_engine: DataEngineConfig
risk_engine: RiskEngineConfig
exec_engine: ExecEngineConfig
run_analysis: bool
actors: list[ImportableActorConfig]
cache: CacheConfig | None
catalog: DataCatalogConfig | None
controller: ImportableControllerConfig | None
emulator: OrderEmulatorConfig | None
exec_algorithms: list[ImportableExecAlgorithmConfig]
instance_id: UUID4 | None
load_state: bool
logging: LoggingConfig | None
loop_debug: bool
message_bus: MessageBusConfig | None
save_state: bool
strategies: list[ImportableStrategyConfig]
streaming: StreamingConfig | None
timeout_connection: PositiveFloat
timeout_disconnection: PositiveFloat
timeout_portfolio: PositiveFloat
timeout_post_stop: PositiveFloat
timeout_reconciliation: PositiveFloat
@property
def id(self) -> str:
"""
Return the hashed identifier for the configuration.
返回配置的哈希标识符。
Return type: str
"""
...
def dict(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration.
返回配置的字典表示形式。
Return type: dict[str, Any]
"""
...
@classmethod
def fully_qualified_name(cls) -> str:
"""
Return the fully qualified name for the NautilusConfig class.
返回 NautilusConfig 类的完全限定名称。
Return type: str
"""
...
def json(self) -> bytes:
"""
Return serialized JSON encoded bytes.
返回序列化 JSON 编码的字节。
Return type: bytes
"""
...
def json_primitives(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration with JSON primitive types as values.
返回配置的字典表示形式,其中值为 JSON 原始类型。
Return type: dict[str, Any]
"""
...
@classmethod
def parse(cls, raw: bytes | str):
"""
Return a decoded object of the given cls.
返回给定 cls 的解码对象。
Parameters:
参数:
cls (type) – The type to decode to.
cls (type) - 要解码到的类型。
raw (bytes or str) – The raw bytes or JSON string to decode.
raw (bytes or str) - 要解码的原始字节或 JSON 字符串。
Return type: Any
"""
...
def validate(self) -> bool:
"""
Return whether the configuration can be represented as valid JSON.
返回配置是否可以表示为有效的 JSON。
Return type: bool
"""
...
Bases: NautilusConfig
class BacktestRunConfig(NautilusConfig):
"""
Represents the configuration for one specific backtest run.
表示一个特定回溯测试运行的配置。
This includes a backtest engine with its actors and strategies, with the external inputs of venues and data.
这包括一个回溯测试引擎及其执行器和策略,以及场所和数据的外部输入。
Parameters:
参数:
venues (list [BacktestVenueConfig ]) – The venue configurations for the backtest run. A valid configuration must include at least one venue config.
venues (list [BacktestVenueConfig ]) - 回溯测试运行的场所配置。有效的配置必须至少包含一个场所配置。
data (list [BacktestDataConfig ]) – The data configurations for the backtest run. A valid configuration must include at least one data config.
data (list [BacktestDataConfig ]) - 回溯测试运行的数据配置。有效的配置必须至少包含一个数据配置。
engine (BacktestEngineConfig) – The backtest engine configuration (the core system kernel).
engine (BacktestEngineConfig) - 回溯测试引擎配置(核心系统内核)。
batch_size_bytes (optional) – The batch block size in bytes (will then run in streaming mode).
batch_size_bytes(可选) - 批处理块大小(以字节为单位)(然后将以流模式运行)。
dispose_on_completion (bool , default True) – If the backtest engine should be disposed on completion of the run. If True, then will drop both data and all state. If False, then will only drop data.
dispose_on_completion (bool,默认 True) - 回溯测试引擎是否应在运行完成后释放。如果为 True,则将同时丢弃数据和所有状态。如果为 False,则只会丢弃数据。
"""
def __init__(self):
...
venues: list[BacktestVenueConfig]
data: list[BacktestDataConfig]
engine: BacktestEngineConfig | None
batch_size_bytes: int | None
dispose_on_completion: bool
@property
def id(self) -> str:
"""
Return the hashed identifier for the configuration.
返回配置的哈希标识符。
Return type: str
"""
...
def dict(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration.
返回配置的字典表示形式。
Return type: dict[str, Any]
"""
...
@classmethod
def fully_qualified_name(cls) -> str:
"""
Return the fully qualified name for the NautilusConfig class.
返回 NautilusConfig 类的完全限定名称。
Return type: str
"""
...
def json(self) -> bytes:
"""
Return serialized JSON encoded bytes.
返回序列化 JSON 编码的字节。
Return type: bytes
"""
...
def json_primitives(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration with JSON primitive types as values.
返回配置的字典表示形式,其中值为 JSON 原始类型。
Return type: dict[str, Any]
"""
...
@classmethod
def parse(cls, raw: bytes | str):
"""
Return a decoded object of the given cls.
返回给定 cls 的解码对象。
Parameters:
参数:
cls (type) – The type to decode to.
cls (type) - 要解码到的类型。
raw (bytes or str) – The raw bytes or JSON string to decode.
raw (bytes or str) - 要解码的原始字节或 JSON 字符串。
Return type: Any
"""
...
def validate(self) -> bool:
"""
Return whether the configuration can be represented as valid JSON.
返回配置是否可以表示为有效的 JSON。
Return type: bool
"""
...
Bases: ActorConfig
class SimulationModuleConfig(ActorConfig):
"""
Configuration for SimulationModule instances.
SimulationModule 实例的配置。
"""
def __init__(self):
...
component_id: ComponentId | None
@property
def id(self) -> str:
"""
Return the hashed identifier for the configuration.
返回配置的哈希标识符。
Return type: str
"""
...
def dict(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration.
返回配置的字典表示形式。
Return type: dict[str, Any]
"""
...
@classmethod
def fully_qualified_name(cls) -> str:
"""
Return the fully qualified name for the NautilusConfig class.
返回 NautilusConfig 类的完全限定名称。
Return type: str
"""
...
def json(self) -> bytes:
"""
Return serialized JSON encoded bytes.
返回序列化 JSON 编码的字节。
Return type: bytes
"""
...
def json_primitives(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration with JSON primitive types as values.
返回配置的字典表示形式,其中值为 JSON 原始类型。
Return type: dict[str, Any]
"""
...
@classmethod
def parse(cls, raw: bytes | str):
"""
Return a decoded object of the given cls.
返回给定 cls 的解码对象。
Parameters:
参数:
cls (type) – The type to decode to.
cls (type) - 要解码到的类型。
raw (bytes or str) – The raw bytes or JSON string to decode.
raw (bytes or str) - 要解码的原始字节或 JSON 字符串。
Return type: Any
"""
...
def validate(self) -> bool:
"""
Return whether the configuration can be represented as valid JSON.
返回配置是否可以表示为有效的 JSON。
Return type: bool
"""
...
Bases: SimulationModuleConfig
class FXRolloverInterestConfig(SimulationModuleConfig):
"""
Provides an FX rollover interest simulation module.
提供外汇隔夜利息模拟模块。
Parameters:
参数:
rate_data (pd.DataFrame) – The interest rate data for the internal rollover interest calculator.
rate_data (pd.DataFrame) - 内部隔夜利息计算器的利率数据。
"""
def __init__(self):
...
rate_data: pd.DataFrame
component_id: ComponentId | None
@property
def id(self) -> str:
"""
Return the hashed identifier for the configuration.
返回配置的哈希标识符。
Return type: str
"""
...
def dict(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration.
返回配置的字典表示形式。
Return type: dict[str, Any]
"""
...
@classmethod
def fully_qualified_name(cls) -> str:
"""
Return the fully qualified name for the NautilusConfig class.
返回 NautilusConfig 类的完全限定名称。
Return type: str
"""
...
def json(self) -> bytes:
"""
Return serialized JSON encoded bytes.
返回序列化 JSON 编码的字节。
Return type: bytes
"""
...
def json_primitives(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration with JSON primitive types as values.
返回配置的字典表示形式,其中值为 JSON 原始类型。
Return type: dict[str, Any]
"""
...
@classmethod
def parse(cls, raw: bytes | str):
"""
Return a decoded object of the given cls.
返回给定 cls 的解码对象。
Parameters:
参数:
cls (type) – The type to decode to.
cls (type) - 要解码到的类型。
raw (bytes or str) – The raw bytes or JSON string to decode.
raw (bytes or str) - 要解码的原始字节或 JSON 字符串。
Return type: Any
"""
...
def validate(self) -> bool:
"""
Return whether the configuration can be represented as valid JSON.
返回配置是否可以表示为有效的 JSON。
Return type: bool
"""
...
Bases: NautilusConfig
class CacheConfig(NautilusConfig):
"""
Configuration for Cache instances.
Cache 实例的配置。
Parameters:
参数:
database (DatabaseConfig , optional) – The configuration for the cache backing database.
database (DatabaseConfig,可选) - 缓存后备数据库的配置。
encoding (str , {'msgpack' , 'json'} , default 'msgpack') – The encoding for database operations, controls the type of serializer used.
encoding (str,{'msgpack','json'},默认 'msgpack') - 数据库操作的编码,控制使用的序列化器类型。
timestamps_as_iso8601 – If timestamps should be persisted as ISO 8601 strings. If False then will persit as UNIX nanoseconds.
timestamps_as_iso8601 - 时间戳是否应作为 ISO 8601 字符串持久化。如果为 False,则将作为 UNIX 纳秒持久化。
False (default) – If timestamps should be persisted as ISO 8601 strings. If False then will persit as UNIX nanoseconds.
False(默认) - 时间戳是否应作为 ISO 8601 字符串持久化。如果为 False,则将作为 UNIX 纳秒持久化。
buffer_interval_ms (PositiveInt , optional) – The buffer interval (milliseconds) between pipelined/batched transactions. The recommended range if using buffered pipeling is [10, 1000] milliseconds, with a good compromise being 100 milliseconds.
buffer_interval_ms (PositiveInt,可选) - 流水线/批处理事务之间的缓冲间隔(毫秒)。如果使用缓冲流水线,建议范围为 [10, 1000] 毫秒,最佳折衷方案为 100 毫秒。
use_trader_prefix (bool , default True) – If a ‘trader-’ prefix is used for keys.
use_trader_prefix (bool,默认 True) - 是否对键使用“trader-”前缀。
use_instance_id (bool , default False) – If the traders instance ID is used for keys.
use_instance_id (bool,默认 False) - 是否对键使用交易者的实例 ID。
flush_on_start (bool , default False) – If database should be flushed on start.
flush_on_start (bool,默认 False) - 是否应在启动时刷新数据库。
drop_instruments_on_reset (bool , default True) – If instruments data should be dropped from the caches memory on reset.
drop_instruments_on_reset (bool,默认 True) - 是否应在重置时从缓存内存中丢弃金融工具数据。
tick_capacity (PositiveInt , default 10_000) – The maximum length for internal tick dequeues.
tick_capacity (PositiveInt,默认 10_000) - 内部 tick 双端队列的最大长度。
bar_capacity (PositiveInt , default 10_000) – The maximum length for internal bar dequeues.
bar_capacity (PositiveInt,默认 10_000) - 内部 bar 双端队列的最大长度。
"""
def __init__(self):
...
database: DatabaseConfig | None
encoding: str
timestamps_as_iso8601: bool
buffer_interval_ms: Annotated[int, msgspec.Meta(gt=0)] | None
use_trader_prefix: bool
use_instance_id: bool
flush_on_start: bool
drop_instruments_on_reset: bool
tick_capacity: Annotated[int, msgspec.Meta(gt=0)]
bar_capacity: Annotated[int, msgspec.Meta(gt=0)]
@property
def id(self) -> str:
"""
Return the hashed identifier for the configuration.
返回配置的哈希标识符。
Return type: str
"""
...
def dict(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration.
返回配置的字典表示形式。
Return type: dict[str, Any]
"""
...
@classmethod
def fully_qualified_name(cls) -> str:
"""
Return the fully qualified name for the NautilusConfig class.
返回 NautilusConfig 类的完全限定名称。
Return type: str
"""
...
def json(self) -> bytes:
"""
Return serialized JSON encoded bytes.
返回序列化 JSON 编码的字节。
Return type: bytes
"""
...
def json_primitives(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration with JSON primitive types as values.
返回配置的字典表示形式,其中值为 JSON 原始类型。
Return type: dict[str, Any]
"""
...
@classmethod
def parse(cls, raw: bytes | str):
"""
Return a decoded object of the given cls.
返回给定 cls 的解码对象。
Parameters:
参数:
cls (type) – The type to decode to.
cls (type) - 要解码到的类型。
raw (bytes or str) – The raw bytes or JSON string to decode.
raw (bytes or str) - 要解码的原始字节或 JSON 字符串。
Return type: Any
"""
...
def validate(self) -> bool:
"""
Return whether the configuration can be represented as valid JSON.
返回配置是否可以表示为有效的 JSON。
Return type: bool
"""
...
class InvalidConfiguration(RuntimeError):
"""
Raised when there is a violation of a configuration condition, making it invalid.
当违反配置条件,使其无效时引发。
"""
def __init__(self):
...
def add_note(self):
"""
Exception.add_note(note) – add a note to the exception
Exception.add_note(note) - 向异常添加注释
"""
...
@property
def args(self):
"""
"""
...
def with_traceback(self):
"""
Exception.with_traceback(tb) – set self._traceback_ to tb and return self.
Exception.with_traceback(tb) - 将 self._traceback_ 设置为 tb 并返回 self。
"""
...
def resolve_path(path: str) -> type:
"""
"""
...
def resolve_config_path(path: str):
"""
"""
...
def msgspec_encoding_hook(obj):
"""
"""
...
def msgspec_decoding_hook(obj_type: type, obj):
"""
"""
...
def register_config_encoding(type_: type, encoder: Callable) -> None:
"""
"""
...
def register_config_decoding(type_: type, decoder: Callable) -> None:
"""
"""
...
def tokenize_config(obj: NautilusConfig) -> str:
"""
"""
...
Bases: Struct
class NautilusConfig(Struct):
"""
The base class for all Nautilus configuration objects.
所有 Nautilus 配置对象的基类。
"""
def __init__(self):
...
@property
def id(self) -> str:
"""
Return the hashed identifier for the configuration.
返回配置的哈希标识符。
Return type: str
"""
...
@classmethod
def fully_qualified_name(cls) -> str:
"""
Return the fully qualified name for the NautilusConfig class.
返回 NautilusConfig 类的完全限定名称。
Return type: str
"""
...
@classmethod
def parse(cls, raw: bytes | str):
"""
Return a decoded object of the given cls.
返回给定 cls 的解码对象。
Parameters:
参数:
cls (type) – The type to decode to.
cls (type) - 要解码到的类型。
raw (bytes or str) – The raw bytes or JSON string to decode.
raw (bytes or str) - 要解码的原始字节或 JSON 字符串。
Return type: Any
"""
...
def dict(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration.
返回配置的字典表示形式。
Return type: dict[str, Any]
"""
...
def json(self) -> bytes:
"""
Return serialized JSON encoded bytes.
返回序列化 JSON 编码的字节。
Return type: bytes
"""
...
def json_primitives(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration with JSON primitive types as values.
返回配置的字典表示形式,其中值为 JSON 原始类型。
Return type: dict[str, Any]
"""
...
def validate(self) -> bool:
"""
Return whether the configuration can be represented as valid JSON.
返回配置是否可以表示为有效的 JSON。
Return type: bool
"""
...
Bases: NautilusConfig
class DatabaseConfig(NautilusConfig):
"""
Configuration for database connections.
数据库连接的配置。
Parameters:
参数:
type (str , {'redis'} , default 'redis') – The database type.
type (str,{'redis'},默认 'redis') - 数据库类型。
host (str , optional) – The database host address. If None then should use the typical default.
host (str,可选) - 数据库主机地址。如果为 None,则应使用典型的默认值。
port (int , optional) – The database port. If None then should use the typical default.
port (int,可选) - 数据库端口。如果为 None,则应使用典型的默认值。
username (str , optional) – The account username for the database connection.
username (str,可选) - 数据库连接的帐户用户名。
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.
password (str,可选) - 数据库连接的帐户密码。如果提供了值,则它将在该对象的字符串表示形式中被编辑。
ssl (bool , default False) – If database should use an SSL enabled connection.
ssl (bool,默认 False) - 数据库是否应使用启用了 SSL 的连接。
timeout (int , default 20) – The timeout (seconds) to wait for a new connection.
timeout (int,默认 20) - 等待新连接的超时时间(秒)。
"""
def __init__(self):
...
type: str
host: str | None
port: int | None
username: str | None
password: str | None
ssl: bool
timeout: int | None
@property
def id(self) -> str:
"""
Return the hashed identifier for the configuration.
返回配置的哈希标识符。
Return type: str
"""
...
def dict(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration.
返回配置的字典表示形式。
Return type: dict[str, Any]
"""
...
@classmethod
def fully_qualified_name(cls) -> str:
"""
Return the fully qualified name for the NautilusConfig class.
返回 NautilusConfig 类的完全限定名称。
Return type: str
"""
...
def json(self) -> bytes:
"""
Return serialized JSON encoded bytes.
返回序列化 JSON 编码的字节。
Return type: bytes
"""
...
def json_primitives(self) -> dict[str, Any]:
"""
```python
Return a dictionary representation of the configuration with JSON primitive types as values.
返回配置的字典表示形式,其中值为 JSON 原始类型。
Return type: dict[str, Any]
"""
...
@classmethod
def parse(cls, raw: bytes | str):
"""
Return a decoded object of the given cls.
返回给定 cls 的解码对象。
Parameters:
参数:
cls (type) – The type to decode to.
cls (type) - 要解码到的类型。
raw (bytes or str) – The raw bytes or JSON string to decode.
raw (bytes or str) - 要解码的原始字节或 JSON 字符串。
Return type: Any
"""
...
def validate(self) -> bool:
"""
Return whether the configuration can be represented as valid JSON.
返回配置是否可以表示为有效的 JSON。
Return type: bool
"""
...
Bases: NautilusConfig
class MessageBusConfig(NautilusConfig):
"""
Configuration for MessageBus instances.
MessageBus 实例的配置。
Parameters:
参数:
database (DatabaseConfig , optional) – The configuration for the message bus backing database.
database (DatabaseConfig,可选) - 消息总线后备数据库的配置。
encoding (str , {'msgpack' , 'json'} , default 'msgpack') – The encoding for database operations, controls the type of serializer used.
encoding (str,{'msgpack','json'},默认 'msgpack') - 数据库操作的编码,控制使用的序列化器类型。
timestamps_as_iso8601 – If timestamps should be persisted as ISO 8601 strings. If False then will persit as UNIX nanoseconds.
timestamps_as_iso8601 - 时间戳是否应作为 ISO 8601 字符串持久化。如果为 False,则将作为 UNIX 纳秒持久化。
False (default) – If timestamps should be persisted as ISO 8601 strings. If False then will persit as UNIX nanoseconds.
False(默认) - 时间戳是否应作为 ISO 8601 字符串持久化。如果为 False,则将作为 UNIX 纳秒持久化。
buffer_interval_ms (PositiveInt , optional) – The buffer interval (milliseconds) between pipelined/batched transactions. The recommended range if using buffered pipeling is [10, 1000] milliseconds, with a good compromise being 100 milliseconds.
buffer_interval_ms (PositiveInt,可选) - 流水线/批处理事务之间的缓冲间隔(毫秒)。如果使用缓冲流水线,建议范围为 [10, 1000] 毫秒,最佳折衷方案为 100 毫秒。
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.0 or higher; otherwise it will result in a command syntax error.
autotrim_mins (int,可选) - 自动流修剪的回溯窗口(以分钟为单位)。实际窗口可能会超出指定值最多一分钟,因为流最多每分钟修剪一次。请注意,此功能需要 Redis 6.2.0 或更高版本;否则将导致命令语法错误。
use_trader_prefix (bool , default True) – If a ‘trader-’ prefix is used for stream names.
use_trader_prefix (bool,默认 True) - 是否对流名称使用“trader-”前缀。
use_trader_id (bool , default True) – If the traders ID is used for stream names.
use_trader_id (bool,默认 True) - 是否对流名称使用交易者的 ID。
use_instance_id (bool , default False) – If the traders instance ID is used for stream names.
use_instance_id (bool,默认 False) - 是否对流名称使用交易者的实例 ID。
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.
streams_prefix (str,默认 'stream') - 外部发布的流名称的前缀(必须具有数据库配置)。如果 use_trader_id 和 use_instance_id 均为 false,则可以将多个交易者配置为写入相同的流。
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.
stream_per_topic (bool,默认 True) - 如果为 True,则消息将写入每个主题的单独流。如果为 False,则所有消息都将写入同一个流。
external_streams (list *[*str ] , optional) – The external stream keys the node will listen to for publishing deserialized message payloads on the internal message bus.
external_streams (list *[*str],可选) - 节点将监听的外部流密钥,用于在内部消息总线上发布反序列化消息有效负载。
types_filter (list *[*type ] , optional) – A list of serializable types not to publish externally.
types_filter (list *[*type],可选) - 不在外部发布的可序列化类型列表。
heartbeat_interval_secs (PositiveInt , optional) – The heartbeat interval (seconds) to use for trading node health.
heartbeat_interval_secs (PositiveInt,可选) - 用于交易节点运行状况的心跳间隔(秒)。
"""
def __init__(self):
...
database: DatabaseConfig | None
encoding: str
timestamps_as_iso8601: bool
buffer_interval_ms: Annotated[int, msgspec.Meta(gt=0)] | None
autotrim_mins: int | None
use_trader_prefix: bool
use_trader_id: bool
use_instance_id: bool
streams_prefix: str
stream_per_topic: bool
external_streams: list[str] | None
types_filter: list[type] | None
heartbeat_interval_secs: Annotated[int, msgspec.Meta(gt=0)] | None
@property
def id(self) -> str:
"""
Return the hashed identifier for the configuration.
返回配置的哈希标识符。
Return type: str
"""
...
def dict(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration.
返回配置的字典表示形式。
Return type: dict[str, Any]
"""
...
@classmethod
def fully_qualified_name(cls) -> str:
"""
Return the fully qualified name for the NautilusConfig class.
返回 NautilusConfig 类的完全限定名称。
Return type: str
"""
...
def json(self) -> bytes:
"""
Return serialized JSON encoded bytes.
返回序列化 JSON 编码的字节。
Return type: bytes
"""
...
def json_primitives(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration with JSON primitive types as values.
返回配置的字典表示形式,其中值为 JSON 原始类型。
Return type: dict[str, Any]
"""
...
@classmethod
def parse(cls, raw: bytes | str):
"""
Return a decoded object of the given cls.
返回给定 cls 的解码对象。
Parameters:
参数:
cls (type) – The type to decode to.
cls (type) - 要解码到的类型。
raw (bytes or str) – The raw bytes or JSON string to decode.
raw (bytes or str) - 要解码的原始字节或 JSON 字符串。
Return type: Any
"""
...
def validate(self) -> bool:
"""
Return whether the configuration can be represented as valid JSON.
返回配置是否可以表示为有效的 JSON。
Return type: bool
"""
...
Bases: NautilusConfig
class InstrumentProviderConfig(NautilusConfig):
"""
Configuration for InstrumentProvider instances.
InstrumentProvider 实例的配置。
Parameters:
参数:
load_all (bool , default False) – If all venue instruments should be loaded on start.
load_all (bool,默认 False) - 是否应在启动时加载所有场所金融工具。
load_ids (frozenset [InstrumentId ] , optional) – The list of instrument IDs to be loaded on start (if load_all_instruments is False).
load_ids (frozenset [InstrumentId],可选) - 要在启动时加载的金融工具 ID 列表(如果 load_all_instruments 为 False)。
filters (frozendict or dict *[*str , Any ] , optional) – The venue specific instrument loading filters to apply.
filters (frozendict 或 dict *[*str,Any],可选) - 要应用的特定场所的金融工具加载过滤器。
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
filter_callable (str,可选) - 可调用对象的完全限定路径,该对象接受单个参数 instrument 并返回一个布尔值,指示是否应加载该金融工具。
log_warnings (bool , default True) – If parser warnings should be logged.
log_warnings (bool,默认 True) - 是否应记录解析器警告。
"""
def __init__(self):
...
load_all: bool
load_ids: frozenset[InstrumentId] | None
filters: dict[str, Any] | None
filter_callable: str | None
log_warnings: bool
@property
def id(self) -> str:
"""
Return the hashed identifier for the configuration.
返回配置的哈希标识符。
Return type: str
"""
...
def dict(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration.
返回配置的字典表示形式。
Return type: dict[str, Any]
"""
...
@classmethod
def fully_qualified_name(cls) -> str:
"""
Return the fully qualified name for the NautilusConfig class.
返回 NautilusConfig 类的完全限定名称。
Return type: str
"""
...
def json(self) -> bytes:
"""
Return serialized JSON encoded bytes.
返回序列化 JSON 编码的字节。
Return type: bytes
"""
...
def json_primitives(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration with JSON primitive types as values.
返回配置的字典表示形式,其中值为 JSON 原始类型。
Return type: dict[str, Any]
"""
...
@classmethod
def parse(cls, raw: bytes | str):
"""
Return a decoded object of the given cls.
返回给定 cls 的解码对象。
Parameters:
参数:
cls (type) – The type to decode to.
cls (type) - 要解码到的类型。
raw (bytes or str) – The raw bytes or JSON string to decode.
raw (bytes or str) - 要解码的原始字节或 JSON 字符串。
Return type: Any
"""
...
def validate(self) -> bool:
"""
Return whether the configuration can be represented as valid JSON.
返回配置是否可以表示为有效的 JSON。
Return type: bool
"""
...
Bases: NautilusConfig
class OrderEmulatorConfig(NautilusConfig):
"""
Configuration for OrderEmulator instances.
OrderEmulator 实例的配置。
Parameters:
参数:
debug (bool , default False) – If debug mode is active (will provide extra debug logging).
debug (bool,默认 False) - 是否激活调试模式(将提供额外的调试日志)。
"""
def __init__(self):
...
debug: bool
@property
def id(self) -> str:
"""
Return the hashed identifier for the configuration.
返回配置的哈希标识符。
Return type: str
"""
...
def dict(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration.
返回配置的字典表示形式。
Return type: dict[str, Any]
"""
...
@classmethod
def fully_qualified_name(cls) -> str:
"""
Return the fully qualified name for the NautilusConfig class.
返回 NautilusConfig 类的完全限定名称。
Return type: str
"""
...
def json(self) -> bytes:
"""
Return serialized JSON encoded bytes.
返回序列化 JSON 编码的字节。
Return type: bytes
"""
...
def json_primitives(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration with JSON primitive types as values.
返回配置的字典表示形式,其中值为 JSON 原始类型。
Return type: dict[str, Any]
"""
...
@classmethod
def parse(cls, raw: bytes | str):
"""
Return a decoded object of the given cls.
返回给定 cls 的解码对象。
Parameters:
参数:
cls (type) – The type to decode to.
cls (type) - 要解码到的类型。
raw (bytes or str) – The raw bytes or JSON string to decode.
raw (bytes or str) - 要解码的原始字节或 JSON 字符串。
Return type: Any
"""
...
def validate(self) -> bool:
"""
Return whether the configuration can be represented as valid JSON.
返回配置是否可以表示为有效的 JSON。
Return type: bool
"""
...
Bases: NautilusConfig
class ActorConfig(NautilusConfig):
"""
The base model for all actor configurations.
所有执行器配置的基模型。
Parameters:
参数:
component_id (ComponentId , optional) – The component ID. If None then the identifier will be taken from type(self)._name_.
component_id (ComponentId,可选) - 组件 ID。如果为 None,则将从 type(self)._name_ 获取标识符。
"""
def __init__(self):
...
component_id: ComponentId | None
@property
def id(self) -> str:
"""
Return the hashed identifier for the configuration.
返回配置的哈希标识符。
Return type: str
"""
...
def dict(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration.
返回配置的字典表示形式。
Return type: dict[str, Any]
"""
...
@classmethod
def fully_qualified_name(cls) -> str:
"""
Return the fully qualified name for the NautilusConfig class.
返回 NautilusConfig 类的完全限定名称。
Return type: str
"""
...
def json(self) -> bytes:
"""
Return serialized JSON encoded bytes.
返回序列化 JSON 编码的字节。
Return type: bytes
"""
...
def json_primitives(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration with JSON primitive types as values.
返回配置的字典表示形式,其中值为 JSON 原始类型。
Return type: dict[str, Any]
"""
...
@classmethod
def parse(cls, raw: bytes | str):
"""
Return a decoded object of the given cls.
返回给定 cls 的解码对象。
Parameters:
参数:
cls (type) – The type to decode to.
cls (type) - 要解码到的类型。
raw (bytes or str) – The raw bytes or JSON string to decode.
raw (bytes or str) - 要解码的原始字节或 JSON 字符串。
Return type: Any
"""
...
def validate(self) -> bool:
"""
Return whether the configuration can be represented as valid JSON.
返回配置是否可以表示为有效的 JSON。
Return type: bool
"""
...
Bases: NautilusConfig
class ImportableActorConfig(NautilusConfig):
"""
Configuration for an actor instance.
执行器实例的配置。
Parameters:
参数:
actor_path (str) – The fully qualified name of the Actor class.
actor_path (str) - Actor 类的完全限定名称。
config_path (str) – The fully qualified name of the Actor Config class.
config_path (str) - Actor Config 类的完全限定名称。
config (dict) – The actor configuration.
config (dict) - 执行器配置。
"""
def __init__(self):
...
actor_path: str
config_path: str
config: dict
@property
def id(self) -> str:
"""
Return the hashed identifier for the configuration.
返回配置的哈希标识符。
Return type: str
"""
...
def dict(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration.
返回配置的字典表示形式。
Return type: dict[str, Any]
"""
...
@classmethod
def fully_qualified_name(cls) -> str:
"""
Return the fully qualified name for the NautilusConfig class.
返回 NautilusConfig 类的完全限定名称。
Return type: str
"""
...
def json(self) -> bytes:
"""
Return serialized JSON encoded bytes.
返回序列化 JSON 编码的字节。
Return type: bytes
"""
...
def json_primitives(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration with JSON primitive types as values.
返回配置的字典表示形式,其中值为 JSON 原始类型。
Return type: dict[str, Any]
"""
...
@classmethod
def parse(cls, raw: bytes | str):
"""
Return a decoded object of the given cls.
返回给定 cls 的解码对象。
Parameters:
参数:
cls (type) – The type to decode to.
cls (type) - 要解码到的类型。
raw (bytes or str) – The raw bytes or JSON string to decode.
raw (bytes or str) - 要解码的原始字节或 JSON 字符串。
Return type: Any
"""
...
def validate(self) -> bool:
"""
Return whether the configuration can be represented as valid JSON.
返回配置是否可以表示为有效的 JSON。
Return type: bool
"""
...
Bases: object
class ActorFactory(object):
"""
Provides actor creation from importable configurations.
从可导入配置提供执行器创建。
"""
def __init__(self):
...
@staticmethod
def create(config: ImportableActorConfig):
"""
Create an actor from the given configuration.
从给定配置创建执行器。
Parameters:
参数:
config (ImportableActorConfig) – The configuration for the building step.
config (ImportableActorConfig) - 构建步骤的配置。
Return type: Actor
Raises: TypeError – If config is not of type ImportableActorConfig.
引发:TypeError - 如果 config 的类型不是 ImportableActorConfig。
"""
...
Bases: NautilusConfig
class LoggingConfig(NautilusConfig):
"""
Configuration for standard output and file logging for a NautilusKernel instance.
NautilusKernel 实例的标准输出和文件日志记录的配置。
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 (str,默认 "INFO") - 写入标准输出的最低日志级别。将始终将 ERROR 级别的日志写入标准错误(除非 bypass_logging 为 True)。
log_level_file (str , optional) – The minimum log level to write to a log file. If None then no file logging will occur.
log_level_file (str,可选) - 写入日志文件的最低日志级别。如果为 None,则不会进行文件日志记录。
log_directory (str , optional) – The path to the log file directory. If None then will write to the current working directory.
log_directory (str,可选) - 日志文件目录的路径。如果为 None,则将写入当前工作目录。
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_name (str,可选) - 自定义日志文件名(将对纯文本使用“.log”后缀,对 JSON 使用“.json”)。这将覆盖自动命名,并且不会进行每日文件轮换。
log_file_format (str { 'JSON' } , optional) – The log file format. If None (default) then will log in plain text. If set to ‘JSON’ then logs will be in JSON format.
log_file_format (str {'JSON'},可选) - 日志文件格式。如果为 None(默认值),则将以纯文本格式记录。如果设置为“JSON”,则日志将采用 JSON 格式。
log_colors (bool , default True) – If ANSI codes should be used to produce colored log lines.
log_colors (bool,默认 True) - 是否应使用 ANSI 代码生成彩色日志行。
log_component_levels (dict *[*str , LogLevel ]) – The additional per component log level filters, where keys are component IDs (e.g. actor/strategy IDs) and values are log levels.
log_component_levels (dict *[*str,LogLevel]) - 每个组件的附加日志级别过滤器,其中键是组件 ID(例如,执行器/策略 ID),值是日志级别。
bypass_logging (bool , default False) – If all logging should be bypassed.
bypass_logging (bool,默认 False) - 是否应绕过所有日志记录。
print_config (bool , default False) – If the core logging configuration should be printed to stdout at initialization.
print_config (bool,默认 False) - 是否应在初始化时将核心日志记录配置打印到标准输出。
use_pyo3 (bool , default False) – If the logging system should be initialized via pyo3, this isn’t recommended for backtesting as the performance is much lower but can be useful for seeing logs originating from Rust.
use_pyo3 (bool,默认 False) - 是否应通过 pyo3 初始化日志记录系统,不建议在回测中使用此方法,因为性能要低得多,但对于查看源自 Rust 的日志很有用。
"""
def __init__(self):
...
log_level: str
log_level_file: str | None
log_directory: str | None
log_file_name: str | None
log_file_format: str | None
log_colors: bool
log_component_levels: dict[str, str] | None
bypass_logging: bool
print_config: bool
use_pyo3: bool
@property
def id(self) -> str:
"""
Return the hashed identifier for the configuration.
返回配置的哈希标识符。
Return type: str
"""
...
def dict(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration.
返回配置的字典表示形式。
Return type: dict[str, Any]
"""
...
@classmethod
def fully_qualified_name(cls) -> str:
"""
Return the fully qualified name for the NautilusConfig class.
返回 NautilusConfig 类的完全限定名称。
Return type: str
"""
...
def json(self) -> bytes:
"""
Return serialized JSON encoded bytes.
返回序列化 JSON 编码的字节。
Return type: bytes
"""
...
def json_primitives(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration with JSON primitive types as values.
返回配置的字典表示形式,其中值为 JSON 原始类型。
Return type: dict[str, Any]
"""
...
@classmethod
def parse(cls, raw: bytes | str):
"""
Return a decoded object of the given cls.
返回给定 cls 的解码对象。
Parameters:
参数:
cls (type) – The type to decode to.
cls (type) - 要解码到的类型。
raw (bytes or str) – The raw bytes or JSON string to decode.
raw (bytes or str) - 要解码的原始字节或 JSON 字符串。
Return type: Any
"""
...
def validate(self) -> bool:
"""
Return whether the configuration can be represented as valid JSON.
返回配置是否可以表示为有效的 JSON。
Return type: bool
"""
...
Bases: NautilusConfig
class ImportableFactoryConfig(NautilusConfig):
"""
Represents an importable (JSON) factory config.
表示可导入的(JSON)工厂配置。
"""
def __init__(self):
...
path: str
def create(self):
"""
"""
...
def dict(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration.
返回配置的字典表示形式。
Return type: dict[str, Any]
"""
...
@classmethod
def fully_qualified_name(cls) -> str:
"""
Return the fully qualified name for the NautilusConfig class.
返回 NautilusConfig 类的完全限定名称。
Return type: str
"""
...
@property
def id(self) -> str:
"""
Return the hashed identifier for the configuration.
返回配置的哈希标识符。
Return type: str
"""
...
def json(self) -> bytes:
"""
Return serialized JSON encoded bytes.
返回序列化 JSON 编码的字节。
Return type: bytes
"""
...
def json_primitives(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration with JSON primitive types as values.
返回配置的字典表示形式,其中值为 JSON 原始类型。
Return type: dict[str, Any]
"""
...
@classmethod
def parse(cls, raw: bytes | str):
"""
Return a decoded object of the given cls.
返回给定 cls 的解码对象。
Parameters:
参数:
cls (type) – The type to decode to.
cls (type) - 要解码到的类型。
raw (bytes or str) – The raw bytes or JSON string to decode.
raw (bytes or str) - 要解码的原始字节或 JSON 字符串。
Return type: Any
"""
...
def validate(self) -> bool:
"""
Return whether the configuration can be represented as valid JSON.
返回配置是否可以表示为有效的 JSON。
Return type: bool
"""
...
Bases: NautilusConfig
class ImportableConfig(NautilusConfig):
"""
Represents an importable configuration (typically live data client or live execution client).
表示可导入的配置(通常是实时数据客户端或实时执行客户端)。
"""
def __init__(self):
...
path: str
config: dict
factory: ImportableFactoryConfig | None
@staticmethod
def is_importable(data: dict) -> bool:
"""
"""
...
def create(self):
"""
"""
...
def dict(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration.
返回配置的字典表示形式。
Return type: dict[str, Any]
"""
...
@classmethod
def fully_qualified_name(cls) -> str:
"""
Return the fully qualified name for the NautilusConfig class.
返回 NautilusConfig 类的完全限定名称。
Return type: str
"""
...
@property
def id(self) -> str:
"""
Return the hashed identifier for the configuration.
返回配置的哈希标识符。
Return type: str
"""
...
def json(self) -> bytes:
"""
Return serialized JSON encoded bytes.
返回序列化 JSON 编码的字节。
Return type: bytes
"""
...
def json_primitives(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration with JSON primitive types as values.
返回配置的字典表示形式,其中值为 JSON 原始类型。
Return type: dict[str, Any]
"""
...
@classmethod
def parse(cls, raw: bytes | str):
"""
Return a decoded object of the given cls.
返回给定 cls 的解码对象。
Parameters:
参数:
cls (type) – The type to decode to.
cls (type) - 要解码到的类型。
raw (bytes or str) – The raw bytes or JSON string to decode.
raw (bytes or str) - 要解码的原始字节或 JSON 字符串。
Return type: Any
"""
...
def validate(self) -> bool:
"""
Return whether the configuration can be represented as valid JSON.
返回配置是否可以表示为有效的 JSON。
Return type: bool
"""
...
Bases: NautilusConfig
class DataEngineConfig(NautilusConfig):
"""
Configuration for DataEngine instances.
DataEngine 实例的配置。
Parameters:
参数:
time_bars_build_with_no_updates (bool , default True) – If time bar aggregators will build and emit bars with no new market updates.
time_bars_build_with_no_updates (bool,默认 True) - 时间条聚合器是否将在没有新的市场更新的情况下构建和发送条。
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_timestamp_on_close (bool,默认 True) - 时间条聚合器是否将在条关闭时对 ts_event 添加时间戳。如果为 False,则将在条打开时添加时间戳。
time_bars_interval_type (str , default 'left-open') – Determines the type of interval used for time aggregation.
time_bars_interval_type (str,默认 'left-open') - 确定用于时间聚合的间隔类型。
‘left-open’: start time is excluded and end time is included (default).
'left-open':开始时间不包括在内,结束时间包括在内(默认)。
‘right-open’: start time is included and end time is excluded.
'right-open':开始时间包括在内,结束时间不包括在内。
validate_data_sequence (bool , default False) – If data objects timestamp sequencing will be validated and handled.
validate_data_sequence (bool,默认 False) - 是否将验证和处理数据对象时间戳排序。
buffer_deltas (bool , default False) – If order book deltas should be buffered until the F_LAST flag is set for a delta.
buffer_deltas (bool,默认 False) - 订单簿增量是否应缓冲,直到为增量设置 F_LAST 标志。
external_clients (list [ClientId ] , optional) – The client IDs declared for external stream processing. The data engine will not attempt to send data commands to these client IDs.
external_clients (list [ClientId],可选) - 为外部流处理声明的客户端 ID。数据引擎将不会尝试向这些客户端 ID 发送数据命令。
debug (bool , default False) – If debug mode is active (will provide extra debug logging).
debug (bool,默认 False) - 是否激活调试模式(将提供额外的调试日志)。
"""
def __init__(self):
...
time_bars_build_with_no_updates: bool
time_bars_timestamp_on_close: bool
time_bars_interval_type: str
validate_data_sequence: bool
buffer_deltas: bool
external_clients: list[ClientId] | None
debug: bool
@property
def id(self) -> str:
"""
Return the hashed identifier for the configuration.
返回配置的哈希标识符。
Return type: str
"""
...
def dict(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration.
返回配置的字典表示形式。
Return type: dict[str, Any]
"""
...
@classmethod
def fully_qualified_name(cls) -> str:
```python
"""
Return the fully qualified name for the NautilusConfig class.
返回 NautilusConfig 类的完全限定名称。
Return type: str
"""
...
def json(self) -> bytes:
"""
Return serialized JSON encoded bytes.
返回序列化 JSON 编码的字节。
Return type: bytes
"""
...
def json_primitives(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration with JSON primitive types as values.
返回配置的字典表示形式,其中值为 JSON 原始类型。
Return type: dict[str, Any]
"""
...
@classmethod
def parse(cls, raw: bytes | str):
"""
Return a decoded object of the given cls.
返回给定 cls 的解码对象。
Parameters:
参数:
cls (type) – The type to decode to.
cls (type) - 要解码到的类型。
raw (bytes or str) – The raw bytes or JSON string to decode.
raw (bytes or str) - 要解码的原始字节或 JSON 字符串。
Return type: Any
"""
...
def validate(self) -> bool:
"""
Return whether the configuration can be represented as valid JSON.
返回配置是否可以表示为有效的 JSON。
Return type: bool
"""
...
Bases: NautilusConfig
class ExecEngineConfig(NautilusConfig):
"""
Configuration for ExecutionEngine instances.
ExecutionEngine 实例的配置。
Parameters:
参数:
load_cache (bool , default True) – If the cache should be loaded on initialization.
load_cache (bool,默认 True) - 是否应在初始化时加载缓存。
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_orders (bool,默认 False) - 订单状态快照列表是否持久化到后备数据库。将在每次订单状态更新时(应用事件时)拍摄快照。
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 (bool,默认 False) - 持仓状态快照列表是否持久化到后备数据库。将在持仓打开、更改和关闭时(应用事件时)拍摄快照。要在快照中包含未实现盈亏,则持仓金融工具的报价必须在缓存中可用。
snapshot_positions_interval_secs (PositiveFloat , optional) – The interval (seconds) at which additional position state snapshots are persisted to a backing database. If None then no additional snapshots will be taken. To include unrealized PnL in these snapshots, quotes for the position’s instrument must be available in the cache.
snapshot_positions_interval_secs (PositiveFloat,可选) - 将其他持仓状态快照持久化到后备数据库的间隔(秒)。如果为 None,则不会拍摄其他快照。要在这些快照中包含未实现盈亏,则持仓金融工具的报价必须在缓存中可用。
debug (bool , default False) – If debug mode is active (will provide extra debug logging).
debug (bool,默认 False) - 是否激活调试模式(将提供额外的调试日志)。
"""
def __init__(self):
...
load_cache: bool
snapshot_orders: bool
snapshot_positions: bool
snapshot_positions_interval_secs: Annotated[float, msgspec.Meta(gt=0.0)] | None
debug: bool
@property
def id(self) -> str:
"""
Return the hashed identifier for the configuration.
返回配置的哈希标识符。
Return type: str
"""
...
def dict(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration.
返回配置的字典表示形式。
Return type: dict[str, Any]
"""
...
@classmethod
def fully_qualified_name(cls) -> str:
"""
Return the fully qualified name for the NautilusConfig class.
返回 NautilusConfig 类的完全限定名称。
Return type: str
"""
...
def json(self) -> bytes:
"""
Return serialized JSON encoded bytes.
返回序列化 JSON 编码的字节。
Return type: bytes
"""
...
def json_primitives(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration with JSON primitive types as values.
返回配置的字典表示形式,其中值为 JSON 原始类型。
Return type: dict[str, Any]
"""
...
@classmethod
def parse(cls, raw: bytes | str):
"""
Return a decoded object of the given cls.
返回给定 cls 的解码对象。
Parameters:
参数:
cls (type) – The type to decode to.
cls (type) - 要解码到的类型。
raw (bytes or str) – The raw bytes or JSON string to decode.
raw (bytes or str) - 要解码的原始字节或 JSON 字符串。
Return type: Any
"""
...
def validate(self) -> bool:
"""
Return whether the configuration can be represented as valid JSON.
返回配置是否可以表示为有效的 JSON。
Return type: bool
"""
...
Bases: NautilusConfig
class ExecAlgorithmConfig(NautilusConfig):
"""
The base model for all execution algorithm configurations.
所有执行算法配置的基模型。
Parameters:
参数:
exec_algorithm_id (ExecAlgorithmId , optional) – The unique ID for the execution algorithm. If not None then will become the execution algorithm ID.
exec_algorithm_id (ExecAlgorithmId,可选) - 执行算法的唯一 ID。如果不为 None,则将成为执行算法 ID。
"""
def __init__(self):
...
exec_algorithm_id: ExecAlgorithmId | None
@property
def id(self) -> str:
"""
Return the hashed identifier for the configuration.
返回配置的哈希标识符。
Return type: str
"""
...
def dict(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration.
返回配置的字典表示形式。
Return type: dict[str, Any]
"""
...
@classmethod
def fully_qualified_name(cls) -> str:
"""
Return the fully qualified name for the NautilusConfig class.
返回 NautilusConfig 类的完全限定名称。
Return type: str
"""
...
def json(self) -> bytes:
"""
Return serialized JSON encoded bytes.
返回序列化 JSON 编码的字节。
Return type: bytes
"""
...
def json_primitives(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration with JSON primitive types as values.
返回配置的字典表示形式,其中值为 JSON 原始类型。
Return type: dict[str, Any]
"""
...
@classmethod
def parse(cls, raw: bytes | str):
"""
Return a decoded object of the given cls.
返回给定 cls 的解码对象。
Parameters:
参数:
cls (type) – The type to decode to.
cls (type) - 要解码到的类型。
raw (bytes or str) – The raw bytes or JSON string to decode.
raw (bytes or str) - 要解码的原始字节或 JSON 字符串。
Return type: Any
"""
...
def validate(self) -> bool:
"""
Return whether the configuration can be represented as valid JSON.
返回配置是否可以表示为有效的 JSON。
Return type: bool
"""
...
Bases: NautilusConfig
class ImportableExecAlgorithmConfig(NautilusConfig):
"""
Configuration for an execution algorithm instance.
执行算法实例的配置。
Parameters:
参数:
exec_algorithm_path (str) – The fully qualified name of the execution algorithm class.
exec_algorithm_path (str) - 执行算法类的完全限定名称。
config_path (str) – The fully qualified name of the config class.
config_path (str) - 配置类的完全限定名称。
config (dict *[*str , Any ]) – The execution algorithm configuration.
config (dict *[*str,Any]) - 执行算法配置。
"""
def __init__(self):
...
exec_algorithm_path: str
config_path: str
config: dict[str, Any]
@property
def id(self) -> str:
"""
Return the hashed identifier for the configuration.
返回配置的哈希标识符。
Return type: str
"""
...
def dict(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration.
返回配置的字典表示形式。
Return type: dict[str, Any]
"""
...
@classmethod
def fully_qualified_name(cls) -> str:
"""
Return the fully qualified name for the NautilusConfig class.
返回 NautilusConfig 类的完全限定名称。
Return type: str
"""
...
def json(self) -> bytes:
"""
Return serialized JSON encoded bytes.
返回序列化 JSON 编码的字节。
Return type: bytes
"""
...
def json_primitives(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration with JSON primitive types as values.
返回配置的字典表示形式,其中值为 JSON 原始类型。
Return type: dict[str, Any]
"""
...
@classmethod
def parse(cls, raw: bytes | str):
"""
Return a decoded object of the given cls.
返回给定 cls 的解码对象。
Parameters:
参数:
cls (type) – The type to decode to.
cls (type) - 要解码到的类型。
raw (bytes or str) – The raw bytes or JSON string to decode.
raw (bytes or str) - 要解码的原始字节或 JSON 字符串。
Return type: Any
"""
...
def validate(self) -> bool:
"""
Return whether the configuration can be represented as valid JSON.
返回配置是否可以表示为有效的 JSON。
Return type: bool
"""
...
Bases: object
class ExecAlgorithmFactory(object):
"""
Provides execution algorithm creation from importable configurations.
从可导入配置提供执行算法创建。
"""
def __init__(self):
...
@staticmethod
def create(config: ImportableExecAlgorithmConfig):
"""
Create an execution algorithm from the given configuration.
从给定配置创建执行算法。
Parameters:
参数:
config (ImportableExecAlgorithmConfig) – The configuration for the building step.
config (ImportableExecAlgorithmConfig) - 构建步骤的配置。
Return type: ExecAlgorithm
Raises: TypeError – If config is not of type ImportableExecAlgorithmConfig.
引发:TypeError - 如果 config 的类型不是 ImportableExecAlgorithmConfig。
"""
...
Bases: DataEngineConfig
class LiveDataEngineConfig(DataEngineConfig):
"""
Configuration for LiveDataEngine instances.
LiveDataEngine 实例的配置。
Parameters:
参数:
qsize (PositiveInt , default 100_000) – The queue size for the engines internal queue buffers.
qsize (PositiveInt,默认 100_000) - 引擎内部队列缓冲区的队列大小。
"""
def __init__(self):
...
qsize: PositiveInt
buffer_deltas: bool
debug: bool
external_clients: list[ClientId] | None
time_bars_build_with_no_updates: bool
time_bars_interval_type: str
time_bars_timestamp_on_close: bool
validate_data_sequence: bool
@property
def id(self) -> str:
"""
Return the hashed identifier for the configuration.
返回配置的哈希标识符。
Return type: str
"""
...
def dict(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration.
返回配置的字典表示形式。
Return type: dict[str, Any]
"""
...
@classmethod
def fully_qualified_name(cls) -> str:
"""
Return the fully qualified name for the NautilusConfig class.
返回 NautilusConfig 类的完全限定名称。
Return type: str
"""
...
def json(self) -> bytes:
"""
Return serialized JSON encoded bytes.
返回序列化 JSON 编码的字节。
Return type: bytes
"""
...
def json_primitives(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration with JSON primitive types as values.
返回配置的字典表示形式,其中值为 JSON 原始类型。
Return type: dict[str, Any]
"""
...
@classmethod
def parse(cls, raw: bytes | str):
"""
Return a decoded object of the given cls.
返回给定 cls 的解码对象。
Parameters:
参数:
cls (type) – The type to decode to.
cls (type) - 要解码到的类型。
raw (bytes or str) – The raw bytes or JSON string to decode.
raw (bytes or str) - 要解码的原始字节或 JSON 字符串。
Return type: Any
"""
...
def validate(self) -> bool:
"""
Return whether the configuration can be represented as valid JSON.
返回配置是否可以表示为有效的 JSON。
Return type: bool
"""
...
Bases: RiskEngineConfig
class LiveRiskEngineConfig(RiskEngineConfig):
"""
Configuration for LiveRiskEngine instances.
LiveRiskEngine 实例的配置。
Parameters:
参数:
qsize (PositiveInt , default 100_000) – The queue size for the engines internal queue buffers.
qsize (PositiveInt,默认 100_000) - 引擎内部队列缓冲区的队列大小。
"""
def __init__(self):
...
qsize: Annotated[int, msgspec.Meta(gt=0)]
bypass: bool
debug: bool
max_notional_per_order: dict[str, int]
max_order_modify_rate: str
max_order_submit_rate: str
@property
def id(self) -> str:
"""
Return the hashed identifier for the configuration.
返回配置的哈希标识符。
Return type: str
"""
...
def dict(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration.
返回配置的字典表示形式。
Return type: dict[str, Any]
"""
...
@classmethod
def fully_qualified_name(cls) -> str:
"""
Return the fully qualified name for the NautilusConfig class.
返回 NautilusConfig 类的完全限定名称。
Return type: str
"""
...
def json(self) -> bytes:
"""
Return serialized JSON encoded bytes.
返回序列化 JSON 编码的字节。
Return type: bytes
"""
...
def json_primitives(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration with JSON primitive types as values.
返回配置的字典表示形式,其中值为 JSON 原始类型。
Return type: dict[str, Any]
"""
...
@classmethod
def parse(cls, raw: bytes | str):
"""
Return a decoded object of the given cls.
返回给定 cls 的解码对象。
Parameters:
参数:
cls (type) – The type to decode to.
cls (type) - 要解码到的类型。
raw (bytes or str) – The raw bytes or JSON string to decode.
raw (bytes or str) - 要解码的原始字节或 JSON 字符串。
Return type: Any
"""
...
def validate(self) -> bool:
"""
Return whether the configuration can be represented as valid JSON.
返回配置是否可以表示为有效的 JSON。
Return type: bool
"""
...
Bases: ExecEngineConfig
class LiveExecEngineConfig(ExecEngineConfig):
"""
Configuration for LiveExecEngine instances.
LiveExecEngine 实例的配置。
The purpose of the in-flight order check is for live reconciliation, events emitted from the venue may have been lost at some point - leaving an order in an intermediate state, the check can recover these events via status reports.
进行中订单检查的目的是进行实时对账,从场所发出的事件可能在某个时间点丢失 - 使订单处于中间状态,检查可以通过状态报告恢复这些事件。
Parameters:
参数:
reconciliation (bool , default True) – If reconciliation is active at start-up.
reconciliation (bool,默认 True) - 是否在启动时激活对账。
reconciliation_lookback_mins (NonNegativeInt , optional) – The maximum lookback minutes to reconcile state for. If None or 0 then will use the maximum lookback available from the venues.
reconciliation_lookback_mins (NonNegativeInt,可选) - 对账状态的最大回溯分钟数。如果为 None 或 0,则将使用场所提供的最大回溯时间。
filter_unclaimed_external_orders (bool , default False) – If unclaimed order events with an EXTERNAL strategy ID should be filtered/dropped.
filter_unclaimed_external_orders (bool,默认 False) - 是否应过滤/丢弃具有 EXTERNAL 策略 ID 的未认领订单事件。
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.
filter_position_reports (bool,默认 False) - 是否从对账中过滤持仓状态报告。当其他节点在同一个账户上交易相同的金融工具时,这可能适用,这可能会导致持仓状态冲突。
generate_missing_orders (bool , default True) – If MARKET order events will be generated during reconciliation to align discrepancies between internal and external positions.
generate_missing_orders (bool,默认 True) - 是否在对账期间生成 MARKET 订单事件以调整内部和外部持仓之间的差异。
inflight_check_interval_ms (NonNegativeInt , default 2_000) – The interval (milliseconds) between checking whether in-flight orders have exceeded their time-in-flight threshold. This should not be set less than the inflight_check_interval_ms.
inflight_check_interval_ms (NonNegativeInt,默认 2_000) - 检查进行中订单是否已超过其飞行时间阈值之间的间隔(毫秒)。此值不应小于 inflight_check_interval_ms。
inflight_check_threshold_ms (NonNegativeInt , default 5_000) – The threshold (milliseconds) beyond which an in-flight orders status is checked with the venue. As a rule of thumb, you shouldn’t consider reducing this setting unless you are colocated with the venue (to avoid the potential for race conditions).
inflight_check_threshold_ms (NonNegativeInt,默认 5_000) - 超过此阈值(毫秒)后,将与场所检查进行中订单状态。根据经验,除非您与场所位于同一位置(以避免潜在的竞争条件),否则您不应考虑降低此设置。
qsize (PositiveInt , default 100_000) – The queue size for the engines internal queue buffers.
qsize (PositiveInt,默认 100_000) - 引擎内部队列缓冲区的队列大小。
"""
def __init__(self):
...
reconciliation: bool
reconciliation_lookback_mins: NonNegativeInt | None
filter_unclaimed_external_orders: bool
filter_position_reports: bool
generate_missing_orders: bool
inflight_check_interval_ms: NonNegativeInt
inflight_check_threshold_ms: NonNegativeInt
qsize: PositiveInt
debug: bool
load_cache: bool
snapshot_orders: bool
snapshot_positions: bool
snapshot_positions_interval_secs: PositiveFloat | None
@property
def id(self) -> str:
"""
Return the hashed identifier for the configuration.
返回配置的哈希标识符。
Return type: str
"""
...
def dict(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration.
返回配置的字典表示形式。
Return type: dict[str, Any]
"""
...
@classmethod
def fully_qualified_name(cls) -> str:
"""
Return the fully qualified name for the NautilusConfig class.
返回 NautilusConfig 类的完全限定名称。
Return type: str
"""
...
def json(self) -> bytes:
"""
Return serialized JSON encoded bytes.
返回序列化 JSON 编码的字节。
Return type: bytes
"""
...
def json_primitives(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration with JSON primitive types as values.
返回配置的字典表示形式,其中值为 JSON 原始类型。
Return type: dict[str, Any]
"""
...
@classmethod
def parse(cls, raw: bytes | str):
"""
Return a decoded object of the given cls.
返回给定 cls 的解码对象。
Parameters:
参数:
cls (type) – The type to decode to.
cls (type) - 要解码到的类型。
raw (bytes or str) – The raw bytes or JSON string to decode.
raw (bytes or str) - 要解码的原始字节或 JSON 字符串。
Return type: Any
"""
...
def validate(self) -> bool:
"""
Return whether the configuration can be represented as valid JSON.
返回配置是否可以表示为有效的 JSON。
Return type: bool
"""
...
Bases: NautilusConfig
class RoutingConfig(NautilusConfig):
"""
Configuration for live client message routing.
实时客户端消息路由的配置。
Parameters:
参数:
default (bool) – If the client should be registered as the default routing client (when a specific venue routing cannot be found).
default (bool) - 客户端是否应注册为默认路由客户端(当找不到特定的场所路由时)。
venues (list *[*str ] , optional) – The venues to register for routing.
venues (list *[*str],可选) - 要注册路由的场所。
"""
def __init__(self):
...
default: bool
venues: frozenset[str] | None
@property
def id(self) -> str:
"""
Return the hashed identifier for the configuration.
返回配置的哈希标识符。
Return type: str
"""
...
def dict(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration.
返回配置的字典表示形式。
Return type: dict[str, Any]
"""
...
@classmethod
def fully_qualified_name(cls) -> str:
"""
Return the fully qualified name for the NautilusConfig class.
返回 NautilusConfig 类的完全限定名称。
Return type: str
"""
...
def json(self) -> bytes:
"""
Return serialized JSON encoded bytes.
返回序列化 JSON 编码的字节。
Return type: bytes
"""
...
def json_primitives(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration with JSON primitive types as values.
返回配置的字典表示形式,其中值为 JSON 原始类型。
Return type: dict[str, Any]
"""
...
@classmethod
def parse(cls, raw: bytes | str):
"""
Return a decoded object of the given cls.
返回给定 cls 的解码对象。
Parameters:
参数:
cls (type) – The type to decode to.
cls (type) - 要解码到的类型。
raw (bytes or str) – The raw bytes or JSON string to decode.
raw (bytes or str) - 要解码的原始字节或 JSON 字符串。
Return type: Any
"""
...
def validate(self) -> bool:
"""
Return whether the configuration can be represented as valid JSON.
返回配置是否可以表示为有效的 JSON。
Return type: bool
"""
...
Bases: NautilusConfig
class LiveDataClientConfig(NautilusConfig):
"""
Configuration for LiveDataClient instances.
LiveDataClient 实例的配置。
Parameters:
参数:
handle_revised_bars (bool) – If DataClient will emit bar updates when a new bar opens.
handle_revised_bars (bool) - DataClient 是否在新的条打开时发送条更新。
instrument_provider (InstrumentProviderConfig) – The clients instrument provider configuration.
instrument_provider (InstrumentProviderConfig) - 客户端的金融工具提供器配置。
routing (RoutingConfig) – The clients message routing config.
routing (RoutingConfig) - 客户端的消息路由配置。
"""
def __init__(self):
...
handle_revised_bars: bool
instrument_provider: InstrumentProviderConfig
routing: RoutingConfig
@property
def id(self) -> str:
"""
Return the hashed identifier for the configuration.
返回配置的哈希标识符。
Return type: str
"""
...
def dict(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration.
返回配置的字典表示形式。
Return type: dict[str, Any]
"""
...
@classmethod
def fully_qualified_name(cls) -> str:
"""
Return the fully qualified name for the NautilusConfig class.
返回 NautilusConfig 类的完全限定名称。
Return type: str
"""
...
def json(self) -> bytes:
"""
Return serialized JSON encoded bytes.
返回序列化 JSON 编码的字节。
Return type: bytes
"""
...
def json_primitives(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration with JSON primitive types as values.
返回配置的字典表示形式,其中值为 JSON 原始类型。
Return type: dict[str, Any]
"""
...
@classmethod
def parse(cls, raw: bytes | str):
"""
Return a decoded object of the given cls.
返回给定 cls 的解码对象。
Parameters:
参数:
cls (type) – The type to decode to.
cls (type) - 要解码到的类型。
raw (bytes or str) – The raw bytes or JSON string to decode.
raw (bytes or str) - 要解码的原始字节或 JSON 字符串。
Return type: Any
"""
...
def validate(self) -> bool:
"""
Return whether the configuration can be represented as valid JSON.
返回配置是否可以表示为有效的 JSON。
Return type: bool
"""
...
Bases: NautilusConfig
class LiveExecClientConfig(NautilusConfig):
"""
Configuration for LiveExecutionClient instances.
LiveExecutionClient 实例的配置。
Parameters:
参数:
instrument_provider (InstrumentProviderConfig) – The clients instrument provider configuration.
instrument_provider (InstrumentProviderConfig) - 客户端的金融工具提供器配置。
routing (RoutingConfig) – The clients message routing config.
routing (RoutingConfig) - 客户端的消息路由配置。
"""
def __init__(self):
...
instrument_provider: InstrumentProviderConfig
routing: RoutingConfig
@property
def id(self) -> str:
"""
Return the hashed identifier for the configuration.
返回配置的哈希标识符。
Return type: str
"""
...
def dict(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration.
返回配置的字典表示形式。
Return type: dict[str, Any]
"""
...
@classmethod
def fully_qualified_name(cls) -> str:
"""
Return the fully qualified name for the NautilusConfig class.
返回 NautilusConfig 类的完全限定名称。
Return type: str
"""
...
def json(self) -> bytes:
"""
Return serialized JSON encoded bytes.
返回序列化 JSON 编码的字节。
Return type: bytes
"""
...
def json_primitives(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration with JSON primitive types as values.
返回配置的字典表示形式,其中值为 JSON 原始类型。
Return type: dict[str, Any]
"""
...
@classmethod
def parse(cls, raw: bytes | str):
"""
Return a decoded object of the given cls.
返回给定 cls 的解码对象。
Parameters:
参数:
cls (type) – The type to decode to.
cls (type) - 要解码到的类型。
raw (bytes or str) – The raw bytes or JSON string to decode.
raw (bytes or str) - 要解码的原始字节或 JSON 字符串。
Return type: Any
"""
...
def validate(self) -> bool:
"""
Return whether the configuration can be represented as valid JSON.
返回配置是否可以表示为有效的 JSON。
Return type: bool
"""
...
Bases: ActorConfig
class ControllerConfig(ActorConfig):
"""
The base model for all controller configurations.
所有控制器配置的基模型。
"""
def __init__(self):
...
component_id: ComponentId | None
@property
def id(self) -> str:
"""
Return the hashed identifier for the configuration.
返回配置的哈希标识符。
Return type: str
"""
...
def dict(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration.
返回配置的字典表示形式。
Return type: dict[str, Any]
"""
...
@classmethod
def fully_qualified_name(cls) -> str:
"""
Return the fully qualified name for the NautilusConfig class.
返回 NautilusConfig 类的完全限定名称。
Return type: str
"""
...
def json(self) -> bytes:
"""
Return serialized JSON encoded bytes.
返回序列化 JSON 编码的字节。
Return type: bytes
"""
...
def json_primitives(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration with JSON primitive types as values.
返回配置的字典表示形式,其中值为 JSON 原始类型。
Return type: dict[str, Any]
"""
...
@classmethod
def parse(cls, raw: bytes | str):
"""
Return a decoded object of the given cls.
返回给定 cls 的解码对象。
Parameters:
参数:
cls (type) – The type to decode to.
cls (type) - 要解码到的类型。
raw (bytes or str) – The raw bytes or JSON string to decode.
raw (bytes or str) - 要解码的原始字节或 JSON 字符串。
Return type: Any
"""
...
def validate(self) -> bool:
"""
Return whether the configuration can be represented as valid JSON.
返回配置是否可以表示为有效的 JSON。
Return type: bool
"""
...
Bases: object
class ControllerFactory(object):
"""
Provides controller creation from importable configurations.
从可导入配置提供控制器创建。
"""
def __init__(self):
...
@staticmethod
def create(config: ImportableControllerConfig, trader):
"""
"""
...
Bases: NautilusKernelConfig
class TradingNodeConfig(NautilusKernelConfig):
```python
"""
Configuration for TradingNode instances.
TradingNode 实例的配置。
Parameters:
参数:
trader_id (TraderId , default "TRADER-000") – The trader ID for the node (must be a name and ID tag separated by a hyphen).
trader_id (TraderId,默认 "TRADER-000") - 节点的交易者 ID(必须是名称和 ID 标签,用连字符分隔)。
cache (CacheConfig , optional) – The cache configuration.
cache (CacheConfig,可选) - 缓存配置。
data_engine (LiveDataEngineConfig , optional) – The live data engine configuration.
data_engine (LiveDataEngineConfig,可选) - 实时数据引擎配置。
risk_engine (LiveRiskEngineConfig , optional) – The live risk engine configuration.
risk_engine (LiveRiskEngineConfig,可选) - 实时风险引擎配置。
exec_engine (LiveExecEngineConfig , optional) – The live execution engine configuration.
exec_engine (LiveExecEngineConfig,可选) - 实时执行引擎配置。
data_clients (dict *[*str , ImportableConfig | LiveDataClientConfig ] , optional) – The data client configurations.
data_clients (dict *[*str,ImportableConfig | LiveDataClientConfig],可选) - 数据客户端配置。
exec_clients (dict *[*str , ImportableConfig | LiveExecClientConfig ] , optional) – The execution client configurations.
exec_clients (dict *[*str,ImportableConfig | LiveExecClientConfig],可选) - 执行客户端配置。
"""
def __init__(self):
...
environment: Environment
trader_id: TraderId
data_engine: LiveDataEngineConfig
risk_engine: LiveRiskEngineConfig
exec_engine: LiveExecEngineConfig
data_clients: dict[str, LiveDataClientConfig]
exec_clients: dict[str, LiveExecClientConfig]
actors: list[ImportableActorConfig]
cache: CacheConfig | None
catalog: DataCatalogConfig | None
controller: ImportableControllerConfig | None
emulator: OrderEmulatorConfig | None
exec_algorithms: list[ImportableExecAlgorithmConfig]
instance_id: UUID4 | None
load_state: bool
logging: LoggingConfig | None
loop_debug: bool
message_bus: MessageBusConfig | None
save_state: bool
strategies: list[ImportableStrategyConfig]
streaming: StreamingConfig | None
timeout_connection: PositiveFloat
timeout_disconnection: PositiveFloat
timeout_portfolio: PositiveFloat
timeout_post_stop: PositiveFloat
timeout_reconciliation: PositiveFloat
@property
def id(self) -> str:
"""
Return the hashed identifier for the configuration.
返回配置的哈希标识符。
Return type: str
"""
...
def dict(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration.
返回配置的字典表示形式。
Return type: dict[str, Any]
"""
...
@classmethod
def fully_qualified_name(cls) -> str:
"""
Return the fully qualified name for the NautilusConfig class.
返回 NautilusConfig 类的完全限定名称。
Return type: str
"""
...
def json(self) -> bytes:
"""
Return serialized JSON encoded bytes.
返回序列化 JSON 编码的字节。
Return type: bytes
"""
...
def json_primitives(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration with JSON primitive types as values.
返回配置的字典表示形式,其中值为 JSON 原始类型。
Return type: dict[str, Any]
"""
...
@classmethod
def parse(cls, raw: bytes | str):
"""
Return a decoded object of the given cls.
返回给定 cls 的解码对象。
Parameters:
参数:
cls (type) – The type to decode to.
cls (type) - 要解码到的类型。
raw (bytes or str) – The raw bytes or JSON string to decode.
raw (bytes or str) - 要解码的原始字节或 JSON 字符串。
Return type: Any
"""
...
def validate(self) -> bool:
"""
Return whether the configuration can be represented as valid JSON.
返回配置是否可以表示为有效的 JSON。
Return type: bool
"""
...
Bases: NautilusConfig
class StreamingConfig(NautilusConfig):
"""
Configuration for streaming live or backtest runs to the catalog in feather format.
将实时或回测运行流式传输到 feather 格式目录的配置。
Parameters:
参数:
catalog_path (str) – The path to the data catalog.
catalog_path (str) - 数据目录的路径。
fs_protocol (str , optional) – The fsspec filesystem protocol for the catalog.
fs_protocol (str,可选) - 目录的 fsspec 文件系统协议。
fs_storage_options (dict , optional) – The fsspec storage options.
fs_storage_options (dict,可选) - fsspec 存储选项。
flush_interval_ms (int , optional) – The flush interval (milliseconds) for writing chunks.
flush_interval_ms (int,可选) - 写入块的刷新间隔(毫秒)。
replace_existing (bool , default False) – If any existing feather files should be replaced.
replace_existing (bool,默认 False) - 是否应替换任何现有的 feather 文件。
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.
include_types (list *[*type],可选) - 要写入的 Arrow 可序列化类型列表。如果指定了此项,则只会写入包含的类型。
"""
def __init__(self):
...
catalog_path: str
fs_protocol: str | None
fs_storage_options: dict | None
flush_interval_ms: int | None
replace_existing: bool
include_types: list[type] | None
@property
def fs(self):
"""
"""
...
@property
def id(self) -> str:
"""
Return the hashed identifier for the configuration.
返回配置的哈希标识符。
Return type: str
"""
...
def as_catalog(self):
"""
"""
...
def dict(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration.
返回配置的字典表示形式。
Return type: dict[str, Any]
"""
...
@classmethod
def fully_qualified_name(cls) -> str:
"""
Return the fully qualified name for the NautilusConfig class.
返回 NautilusConfig 类的完全限定名称。
Return type: str
"""
...
def json(self) -> bytes:
"""
Return serialized JSON encoded bytes.
返回序列化 JSON 编码的字节。
Return type: bytes
"""
...
def json_primitives(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration with JSON primitive types as values.
返回配置的字典表示形式,其中值为 JSON 原始类型。
Return type: dict[str, Any]
"""
...
@classmethod
def parse(cls, raw: bytes | str):
"""
Return a decoded object of the given cls.
返回给定 cls 的解码对象。
Parameters:
参数:
cls (type) – The type to decode to.
cls (type) - 要解码到的类型。
raw (bytes or str) – The raw bytes or JSON string to decode.
raw (bytes or str) - 要解码的原始字节或 JSON 字符串。
Return type: Any
"""
...
def validate(self) -> bool:
"""
Return whether the configuration can be represented as valid JSON.
返回配置是否可以表示为有效的 JSON。
Return type: bool
"""
...
Bases: NautilusConfig
class DataCatalogConfig(NautilusConfig):
"""
Configuration for a data catalog.
数据目录的配置。
Parameters:
参数:
path (str) – The path to the data catalog.
path (str) - 数据目录的路径。
fs_protocol (str , optional) – The fsspec file system protocol for the data catalog.
fs_protocol (str,可选) - 数据目录的 fsspec 文件系统协议。
fs_storage_options (dict , optional) – The fsspec storage options for the data catalog.
fs_storage_options (dict,可选) - 数据目录的 fsspec 存储选项。
"""
def __init__(self):
...
path: str
fs_protocol: str | None
fs_storage_options: dict | None
@property
def id(self) -> str:
"""
Return the hashed identifier for the configuration.
返回配置的哈希标识符。
Return type: str
"""
...
def dict(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration.
返回配置的字典表示形式。
Return type: dict[str, Any]
"""
...
@classmethod
def fully_qualified_name(cls) -> str:
"""
Return the fully qualified name for the NautilusConfig class.
返回 NautilusConfig 类的完全限定名称。
Return type: str
"""
...
def json(self) -> bytes:
"""
Return serialized JSON encoded bytes.
返回序列化 JSON 编码的字节。
Return type: bytes
"""
...
def json_primitives(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration with JSON primitive types as values.
返回配置的字典表示形式,其中值为 JSON 原始类型。
Return type: dict[str, Any]
"""
...
@classmethod
def parse(cls, raw: bytes | str):
"""
Return a decoded object of the given cls.
返回给定 cls 的解码对象。
Parameters:
参数:
cls (type) – The type to decode to.
cls (type) - 要解码到的类型。
raw (bytes or str) – The raw bytes or JSON string to decode.
raw (bytes or str) - 要解码的原始字节或 JSON 字符串。
Return type: Any
"""
...
def validate(self) -> bool:
"""
Return whether the configuration can be represented as valid JSON.
返回配置是否可以表示为有效的 JSON。
Return type: bool
"""
...
Bases: NautilusConfig
class RiskEngineConfig(NautilusConfig):
"""
Configuration for RiskEngine instances.
RiskEngine 实例的配置。
Parameters:
参数:
bypass (bool , default False) – If True then will bypass all pre-trade risk checks and rate limits (will still check for duplicate IDs).
bypass (bool,默认 False) - 如果为 True,则将绕过所有交易前风险检查和速率限制(仍将检查重复 ID)。
max_order_submit_rate (str , default 100/00:00:01) – The maximum rate of submit order commands per timedelta.
max_order_submit_rate (str,默认 100/00:00:01) - 每个时间增量的提交订单命令的最大速率。
max_order_modify_rate (str , default 100/00:00:01) – The maximum rate of modify order commands per timedelta.
max_order_modify_rate (str,默认 100/00:00:01) - 每个时间增量的修改订单命令的最大速率。
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.
max_notional_per_order (dict *[*str,int],默认空字典) - 每个金融工具 ID 的订单的最大名义值。该值应为有效的十进制格式。
debug (bool , default False) – If debug mode is active (will provide extra debug logging).
debug (bool,默认 False) - 是否激活调试模式(将提供额外的调试日志)。
"""
def __init__(self):
...
bypass: bool
max_order_submit_rate: str
max_order_modify_rate: str
max_notional_per_order: dict[str, int]
debug: bool
@property
def id(self) -> str:
"""
Return the hashed identifier for the configuration.
返回配置的哈希标识符。
Return type: str
"""
...
def dict(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration.
返回配置的字典表示形式。
Return type: dict[str, Any]
"""
...
@classmethod
def fully_qualified_name(cls) -> str:
"""
Return the fully qualified name for the NautilusConfig class.
返回 NautilusConfig 类的完全限定名称。
Return type: str
"""
...
def json(self) -> bytes:
"""
Return serialized JSON encoded bytes.
返回序列化 JSON 编码的字节。
Return type: bytes
"""
...
def json_primitives(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration with JSON primitive types as values.
返回配置的字典表示形式,其中值为 JSON 原始类型。
Return type: dict[str, Any]
"""
...
@classmethod
def parse(cls, raw: bytes | str):
"""
Return a decoded object of the given cls.
返回给定 cls 的解码对象。
Parameters:
参数:
cls (type) – The type to decode to.
cls (type) - 要解码到的类型。
raw (bytes or str) – The raw bytes or JSON string to decode.
raw (bytes or str) - 要解码的原始字节或 JSON 字符串。
Return type: Any
"""
...
def validate(self) -> bool:
"""
Return whether the configuration can be represented as valid JSON.
返回配置是否可以表示为有效的 JSON。
Return type: bool
"""
...
Bases: NautilusConfig
class NautilusKernelConfig(NautilusConfig):
"""
Configuration for a NautilusKernel core system instance.
NautilusKernel 核心系统实例的配置。
Parameters:
参数:
environment (Environment { BACKTEST, SANDBOX, LIVE }) – The kernel environment context.
environment (Environment {BACKTEST、SANDBOX、LIVE}) - 内核环境上下文。
trader_id (TraderId) – The trader ID for the kernel (must be a name and ID tag separated by a hyphen).
trader_id (TraderId) - 内核的交易者 ID(必须是名称和 ID 标签,用连字符分隔)。
cache (CacheConfig , optional) – The cache configuration.
cache (CacheConfig,可选) - 缓存配置。
message_bus (MessageBusConfig , optional) – The message bus configuration.
message_bus (MessageBusConfig,可选) - 消息总线配置。
data_engine (DataEngineConfig , optional) – The live data engine configuration.
data_engine (DataEngineConfig,可选) - 实时数据引擎配置。
risk_engine (RiskEngineConfig , optional) – The live risk engine configuration.
risk_engine (RiskEngineConfig,可选) - 实时风险引擎配置。
exec_engine (ExecEngineConfig , optional) – The live execution engine configuration.
exec_engine (ExecEngineConfig,可选) - 实时执行引擎配置。
emulator (OrderEmulatorConfig , optional) – The order emulator configuration.
emulator (OrderEmulatorConfig,可选) - 订单模拟器配置。
streaming (StreamingConfig , optional) – The configuration for streaming to feather files.
streaming (StreamingConfig,可选) - 流式传输到 feather 文件的配置。
catalog (DataCatalogConfig , optional) – The data catalog config.
catalog (DataCatalogConfig,可选) - 数据目录配置。
actors (list [ImportableActorConfig ]) – The actor configurations for the kernel.
actors (list [ImportableActorConfig ]) - 内核的执行器配置。
strategies (list [ImportableStrategyConfig ]) – The strategy configurations for the kernel.
strategies (list [ImportableStrategyConfig ]) - 内核的策略配置。
exec_algorithms (list [ImportableExecAlgorithmConfig ]) – The execution algorithm configurations for the kernel.
exec_algorithms (list [ImportableExecAlgorithmConfig ]) - 内核的执行算法配置。
controller (ImportableControllerConfig , optional) – The trader controller for the kernel.
controller (ImportableControllerConfig,可选) - 内核的交易者控制器。
load_state (bool , default True) – If trading strategy state should be loaded from the database on start.
load_state (bool,默认 True) - 是否应在启动时从数据库加载交易策略状态。
save_state (bool , default True) – If trading strategy state should be saved to the database on stop.
save_state (bool,默认 True) - 是否应在停止时将交易策略状态保存到数据库。
loop_debug (bool , default False) – If the asyncio event loop should be in debug mode.
loop_debug (bool,默认 False) - asyncio 事件循环是否应处于调试模式。
logging (LoggingConfig , optional) – The logging config for the kernel.
logging (LoggingConfig,可选) - 内核的日志记录配置。
timeout_connection (PositiveFloat *(*seconds )) – The timeout for all clients to connect and initialize.
timeout_connection (PositiveFloat *(秒)) - 所有客户端连接和初始化的超时时间。
timeout_reconciliation (PositiveFloat *(*seconds )) – The timeout for execution state to reconcile.
timeout_reconciliation (PositiveFloat *(秒)) - 执行状态协调的超时时间。
timeout_portfolio (PositiveFloat *(*seconds )) – The timeout for portfolio to initialize margins and unrealized PnLs.
timeout_portfolio (PositiveFloat *(秒)) - 投资组合初始化保证金和未实现盈亏的超时时间。
timeout_disconnection (PositiveFloat *(*seconds )) – The timeout for all engine clients to disconnect.
timeout_disconnection (PositiveFloat *(秒)) - 所有引擎客户端断开连接的超时时间。
timeout_post_stop (PositiveFloat *(*seconds )) – The timeout after stopping the node to await residual events before final shutdown.
timeout_post_stop (PositiveFloat *(秒)) - 停止节点后等待剩余事件直到最终关闭的超时时间。
"""
def __init__(self):
...
environment: Environment
trader_id: TraderId
instance_id: UUID4 | None
cache: CacheConfig | None
message_bus: MessageBusConfig | None
data_engine: DataEngineConfig | None
risk_engine: RiskEngineConfig | None
exec_engine: ExecEngineConfig | None
emulator: OrderEmulatorConfig | None
streaming: StreamingConfig | None
catalog: DataCatalogConfig | None
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)]
@property
def id(self) -> str:
"""
Return the hashed identifier for the configuration.
返回配置的哈希标识符。
Return type: str
"""
...
def dict(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration.
返回配置的字典表示形式。
Return type: dict[str, Any]
"""
...
@classmethod
def fully_qualified_name(cls) -> str:
"""
Return the fully qualified name for the NautilusConfig class.
返回 NautilusConfig 类的完全限定名称。
Return type: str
"""
...
def json(self) -> bytes:
"""
Return serialized JSON encoded bytes.
返回序列化 JSON 编码的字节。
Return type: bytes
"""
...
def json_primitives(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration with JSON primitive types as values.
返回配置的字典表示形式,其中值为 JSON 原始类型。
Return type: dict[str, Any]
"""
...
@classmethod
def parse(cls, raw: bytes | str):
"""
Return a decoded object of the given cls.
返回给定 cls 的解码对象。
Parameters:
参数:
cls (type) – The type to decode to.
cls (type) - 要解码到的类型。
raw (bytes or str) – The raw bytes or JSON string to decode.
raw (bytes or str) - 要解码的原始字节或 JSON 字符串。
Return type: Any
"""
...
def validate(self) -> bool:
"""
Return whether the configuration can be represented as valid JSON.
返回配置是否可以表示为有效的 JSON。
Return type: bool
"""
...
Bases: NautilusConfig
class StrategyConfig(NautilusConfig):
"""
The base model for all trading strategy configurations.
所有交易策略配置的基模型。
Parameters:
参数:
strategy_id (StrategyId , optional) – The unique ID for the strategy. Will become the strategy ID if not None.
strategy_id (StrategyId,可选) - 策略的唯一 ID。如果不为 None,则将成为策略 ID。
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.
order_id_tag (str,可选) - 策略的唯一订单 ID 标签。对于特定交易者 ID 的所有正在运行的策略,它必须是唯一的。
oms_type (OmsType , optional) – The order management system type for the strategy. This will determine how the ExecutionEngine handles position IDs.
oms_type (OmsType,可选) - 策略的订单管理系统类型。这将确定 ExecutionEngine 如何处理持仓 ID。
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.
external_order_claims (list [InstrumentId],可选) - 外部订单认领金融工具 ID。匹配金融工具 ID 的外部订单将与策略相关联(由策略认领)。
manage_contingent_orders (bool , default False) – If OUO and OCO open contingent orders should be managed automatically by the strategy. Any emulated orders which are active local will be managed by the OrderEmulator instead.
manage_contingent_orders (bool,默认 False) - OUO 和 OCO 未结意外事件订单是否应由策略自动管理。任何在本地活动的模拟订单将由 OrderEmulator 管理。
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_gtd_expiry (bool,默认 False) - 所有订单 GTD 有效时间的到期时间是否应由策略管理。如果为 True,则将确保未结订单在其启动时重新激活其 GTD 计时器。
"""
def __init__(self):
...
strategy_id: StrategyId | None
order_id_tag: str | None
oms_type: str | None
external_order_claims: list[InstrumentId] | None
manage_contingent_orders: bool
manage_gtd_expiry: bool
@property
def id(self) -> str:
"""
Return the hashed identifier for the configuration.
返回配置的哈希标识符。
Return type: str
"""
...
def dict(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration.
返回配置的字典表示形式。
Return type: dict[str, Any]
"""
...
@classmethod
def fully_qualified_name(cls) -> str:
"""
Return the fully qualified name for the NautilusConfig class.
返回 NautilusConfig 类的完全限定名称。
Return type: str
"""
...
def json(self) -> bytes:
"""
Return serialized JSON encoded bytes.
返回序列化 JSON 编码的字节。
Return type: bytes
"""
...
def json_primitives(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration with JSON primitive types as values.
返回配置的字典表示形式,其中值为 JSON 原始类型。
Return type: dict[str, Any]
"""
...
@classmethod
def parse(cls, raw: bytes | str):
"""
Return a decoded object of the given cls.
返回给定 cls 的解码对象。
Parameters:
参数:
cls (type) – The type to decode to.
cls (type) - 要解码到的类型。
raw (bytes or str) – The raw bytes or JSON string to decode.
raw (bytes or str) - 要解码的原始字节或 JSON 字符串。
Return type: Any
"""
...
def validate(self) -> bool:
"""
Return whether the configuration can be represented as valid JSON.
返回配置是否可以表示为有效的 JSON。
Return type: bool
"""
...
Bases: NautilusConfig
class ImportableStrategyConfig(NautilusConfig):
"""
Configuration for a trading strategy instance.
交易策略实例的配置。
Parameters:
参数:
strategy_path (str) – The fully qualified name of the strategy class.
strategy_path (str) - 策略类的完全限定名称。
config_path (str) – The fully qualified name of the config class.
config_path (str) - 配置类的完全限定名称。
config (dict *[*str , Any ]) – The strategy configuration.
config (dict *[*str,Any]) - 策略配置。
"""
def __init__(self):
...
strategy_path: str
config_path: str
config: dict[str, Any]
@property
def id(self) -> str:
"""
Return the hashed identifier for the configuration.
返回配置的哈希标识符。
Return type: str
"""
...
def dict(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration.
返回配置的字典表示形式。
Return type: dict[str, Any]
"""
...
@classmethod
def fully_qualified_name(cls) -> str:
"""
Return the fully qualified name for the NautilusConfig class.
返回 NautilusConfig 类的完全限定名称。
Return type: str
"""
...
def json(self) -> bytes:
"""
Return serialized JSON encoded bytes.
返回序列化 JSON 编码的字节。
Return type: bytes
"""
...
def json_primitives(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration with JSON primitive types as values.
返回配置的字典表示形式,其中值为 JSON 原始类型。
Return type: dict[str, Any]
"""
...
@classmethod
def parse(cls, raw: bytes | str):
"""
Return a decoded object of the given cls.
返回给定 cls 的解码对象。
Parameters:
参数:
cls (type) – The type to decode to.
cls (type) - 要解码到的类型。
raw (bytes or str) – The raw bytes or JSON string to decode.
raw (bytes or str) - 要解码的原始字节或 JSON 字符串。
Return type: Any
"""
...
def validate(self) -> bool:
"""
Return whether the configuration can be represented as valid JSON.
返回配置是否可以表示为有效的 JSON。
Return type: bool
"""
...
Bases: object
class StrategyFactory(object):
"""
Provides strategy creation from importable configurations.
从可导入配置提供策略创建。
"""
def __init__(self):
...
@staticmethod
def create(config: ImportableStrategyConfig):
"""
Create a trading strategy from the given configuration.
从给定配置创建交易策略。
Parameters:
参数:
config (ImportableStrategyConfig) – The configuration for the building step.
config (ImportableStrategyConfig) - 构建步骤的配置。
Return type: Strategy
Raises: TypeError – If config is not of type ImportableStrategyConfig.
引发:TypeError - 如果 config 的类型不是 ImportableStrategyConfig。
"""
...
Bases: NautilusConfig
class ImportableControllerConfig(NautilusConfig):
"""
Configuration for a controller instance.
控制器实例的配置。
Parameters:
参数:
controller_path (str) – The fully qualified name of the controller class.
controller_path (str) - 控制器类的完全限定名称。
config_path (str) – The fully qualified name of the config class.
config_path (str) - 配置类的完全限定名称。
config (dict *[*str , Any ]) – The controller configuration.
config (dict *[*str,Any]) - 控制器配置。
"""
def __init__(self):
...
controller_path: str
config_path: str
config: dict
@property
def id(self) -> str:
"""
Return the hashed identifier for the configuration.
返回配置的哈希标识符。
Return type: str
"""
...
def dict(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration.
返回配置的字典表示形式。
Return type: dict[str, Any]
"""
...
@classmethod
def fully_qualified_name(cls) -> str:
"""
Return the fully qualified name for the NautilusConfig class.
返回 NautilusConfig 类的完全限定名称。
Return type: str
"""
...
def json(self) -> bytes:
"""
Return serialized JSON encoded bytes.
返回序列化 JSON 编码的字节。
Return type: bytes
"""
...
def json_primitives(self) -> dict[str, Any]:
"""
Return a dictionary representation of the configuration with JSON primitive types as values.
返回配置的字典表示形式,其中值为 JSON 原始类型。
Return type: dict[str, Any]
"""
...
@classmethod
def parse(cls, raw: bytes | str):
"""
Return a decoded object of the given cls.
返回给定 cls 的解码对象。
Parameters:
参数:
cls (type) – The type to decode to.
cls (type) - 要解码到的类型。
raw (bytes or str) – The raw bytes or JSON string to decode.
raw (bytes or str) - 要解码的原始字节或 JSON 字符串。
Return type: Any
"""
...
def validate(self) -> bool:
"""
Return whether the configuration can be represented as valid JSON.
返回配置是否可以表示为有效的 JSON。
Return type: bool
"""
...