# This file is automatically generated by pyo3_stub_gen
# ruff: noqa: E501

import collections.abc
import datetime
import decimal
import enum
import typing

from nautilus_trader import _libnautilus
from nautilus_trader import core
from nautilus_trader import model
from nautilus_trader.model import Blockchain

__all__ = [
    "BusMessage",
    "Cache",
    "CacheConfig",
    "Clock",
    "ComponentState",
    "ComponentTrigger",
    "CustomData",
    "DataActor",
    "DataActorConfig",
    "Environment",
    "FifoCache",
    "FileWriterConfig",
    "GreeksCalculator",
    "ImportableActorConfig",
    "LogColor",
    "LogFormat",
    "LogGuard",
    "LogLevel",
    "Logger",
    "LoggerConfig",
    "MessageBus",
    "MessageBusConfig",
    "MessageBusListener",
    "OrderFactory",
    "QueueCondition",
    "QueueState",
    "QueueStateChanged",
    "ReconnectSocket",
    "SerializationEncoding",
    "Signal",
    "SocketState",
    "SocketStateChanged",
    "SystemChannel",
    "TimeEvent",
    "get_exchange_rate",
    "init_logging",
    "init_tracing",
    "log_header",
    "log_sysinfo",
    "logger_flush",
    "logger_log",
    "logging_clock_set_realtime_mode",
    "logging_clock_set_static_mode",
    "logging_clock_set_static_time",
    "logging_sync_to_disk",
    "tracing_is_initialized",
]

@typing.final
class BusMessage:
    @property
    def topic(self) -> str: ...
    @property
    def payload_type(self) -> str: ...
    @property
    def payload(self) -> bytes: ...
    @property
    def encoding(self) -> SerializationEncoding: ...

@typing.final
class CacheConfig:
    def __init__(
        self,
        encoding: SerializationEncoding | None = None,
        timestamps_as_iso8601: bool | None = None,
        buffer_interval_ms: int | None = None,
        bulk_read_batch_size: int | None = None,
        use_trader_prefix: bool | None = None,
        use_instance_id: bool | None = None,
        flush_on_start: bool | None = None,
        drop_instruments_on_reset: bool | None = None,
        tick_capacity: int | None = None,
        bar_capacity: int | None = None,
        save_market_data: bool | None = None,
        persist_account_events: bool | None = None,
    ) -> None: ...
    @property
    def encoding(self) -> SerializationEncoding: ...
    @property
    def timestamps_as_iso8601(self) -> bool: ...
    @property
    def buffer_interval_ms(self) -> int | None: ...
    @property
    def bulk_read_batch_size(self) -> int | None: ...
    @property
    def use_trader_prefix(self) -> bool: ...
    @property
    def use_instance_id(self) -> bool: ...
    @property
    def flush_on_start(self) -> bool: ...
    @property
    def drop_instruments_on_reset(self) -> bool: ...
    @property
    def tick_capacity(self) -> int: ...
    @property
    def bar_capacity(self) -> int: ...
    @property
    def persist_account_events(self) -> bool: ...
    @property
    def save_market_data(self) -> bool: ...

@typing.final
class CustomData:
    def __init__(
        self, data_type: model.DataType, value: typing.Sequence[int], ts_event: int, ts_init: int
    ) -> None: ...
    @property
    def data_type(self) -> model.DataType: ...
    @property
    def value(self) -> list[int]: ...
    @property
    def ts_event(self) -> int: ...
    @property
    def ts_init(self) -> int: ...

class DataActorConfig:
    def __init__(
        self,
        actor_id: model.ActorId | None = None,
        log_events: bool = True,
        log_commands: bool = True,
        _kwargs: dict | None = ...,
    ) -> None: ...
    @property
    def actor_id(self) -> model.ActorId | None: ...
    @actor_id.setter
    def actor_id(self, actor_id: model.ActorId | None) -> None: ...
    @property
    def log_events(self) -> bool: ...
    @log_events.setter
    def log_events(self, log_events: bool) -> None: ...
    @property
    def log_commands(self) -> bool: ...
    @log_commands.setter
    def log_commands(self, log_commands: bool) -> None: ...

@typing.final
class FileWriterConfig:
    @property
    def directory(self) -> str | None: ...
    @property
    def file_name(self) -> str | None: ...
    @property
    def file_format(self) -> str | None: ...
    @property
    def file_rotate(self) -> tuple[int, int] | None: ...
    def __new__(
        cls,
        directory: str | None = None,
        file_name: str | None = None,
        file_format: str | None = None,
        file_rotate: tuple[int, int] | None = None,
    ) -> FileWriterConfig: ...

@typing.final
class ImportableActorConfig:
    def __init__(self, actor_path: str, config_path: str, config: dict) -> None: ...
    @property
    def actor_path(self) -> str: ...
    @property
    def config_path(self) -> str: ...
    @property
    def config(self) -> dict: ...

@typing.final
class LogGuard: ...

@typing.final
class LoggerConfig:
    @property
    def stdout_level(self) -> LogLevel: ...
    @property
    def fileout_level(self) -> LogLevel: ...
    @property
    def component_levels(self) -> dict[str, str]: ...
    @property
    def is_colored(self) -> bool: ...
    @property
    def print_config(self) -> bool: ...
    @property
    def bypass_logging(self) -> bool: ...
    @property
    def log_components_only(self) -> bool: ...
    @property
    def file_config(self) -> FileWriterConfig | None: ...
    @property
    def clear_log_file(self) -> bool: ...
    @property
    def fileout_sync_on_flush(self) -> bool: ...
    @property
    def buffered_stdout(self) -> bool: ...
    def __new__(
        cls,
        stdout_level: LogLevel | None = None,
        fileout_level: LogLevel | None = None,
        component_levels: typing.Mapping[str, str] | None = None,
        is_colored: bool | None = None,
        print_config: bool | None = None,
        bypass_logging: bool | None = None,
        log_components_only: bool | None = None,
        file_config: FileWriterConfig | None = None,
        clear_log_file: bool | None = None,
        fileout_sync_on_flush: bool | None = None,
        buffered_stdout: bool | None = None,
    ) -> LoggerConfig: ...
    @staticmethod
    def from_spec(spec: str) -> LoggerConfig: ...

@typing.final
class MessageBusConfig:
    def __init__(
        self,
        encoding: SerializationEncoding | None = None,
        encoding_market_data: SerializationEncoding | None = None,
        encoding_builtin: SerializationEncoding | None = None,
        timestamps_as_iso8601: bool | None = None,
        buffer_interval_ms: int | None = None,
        autotrim_mins: int | None = None,
        autotrim_maxlen: int | None = None,
        use_trader_prefix: bool | None = None,
        use_trader_id: bool | None = None,
        use_instance_id: bool | None = None,
        streams_prefix: str | None = None,
        stream_per_topic: bool | None = None,
        external_streams: typing.Sequence[str] | None = None,
        types_filter: typing.Sequence[str] | None = None,
        heartbeat_interval_secs: int | None = None,
    ) -> None: ...
    @property
    def encoding(self) -> SerializationEncoding: ...
    @property
    def encoding_market_data(self) -> SerializationEncoding | None: ...
    @property
    def encoding_builtin(self) -> SerializationEncoding | None: ...
    @property
    def timestamps_as_iso8601(self) -> bool: ...
    @property
    def buffer_interval_ms(self) -> int | None: ...
    @property
    def autotrim_mins(self) -> int | None: ...
    @property
    def autotrim_maxlen(self) -> int | None: ...
    @property
    def use_trader_prefix(self) -> bool: ...
    @property
    def use_trader_id(self) -> bool: ...
    @property
    def use_instance_id(self) -> bool: ...
    @property
    def streams_prefix(self) -> str: ...
    @property
    def stream_per_topic(self) -> bool: ...
    @property
    def external_streams(self) -> list[str] | None: ...
    @property
    def types_filter(self) -> list[str] | None: ...
    @property
    def heartbeat_interval_secs(self) -> int | None: ...

@typing.final
class MessageBusListener:
    def __init__(self) -> None: ...
    def is_active(self) -> bool: ...
    def is_closed(self) -> bool: ...
    def close(self) -> None: ...
    def publish(self, topic: str, payload: typing.Sequence[int]) -> None: ...
    def stream(self, callback: typing.Any) -> typing.Any: ...

@typing.final
class Cache:
    def __init__(self, config: CacheConfig | None = None) -> None: ...
    def reset(self) -> None: ...
    def dispose(self) -> None: ...
    def purge_closed_orders(self, ts_now: int, buffer_secs: int = 0) -> None: ...
    def purge_closed_positions(self, ts_now: int, buffer_secs: int = 0) -> None: ...
    def purge_order(self, client_order_id: model.ClientOrderId) -> None: ...
    def purge_position(self, position_id: model.PositionId) -> None: ...
    def purge_instrument(self, instrument_id: model.InstrumentId) -> None: ...
    def purge_account_events(self, ts_now: int, lookback_secs: int = 0) -> None: ...
    def get(self, key: str) -> list[int] | None: ...
    def add(self, key: str, value: typing.Sequence[int]) -> None: ...
    def add_instrument_close(self, close: model.InstrumentClose) -> None: ...
    def quote(
        self, instrument_id: model.InstrumentId, index: int = 0
    ) -> model.QuoteTick | None: ...
    def trade(
        self, instrument_id: model.InstrumentId, index: int = 0
    ) -> model.TradeTick | None: ...
    def bar(self, bar_type: model.BarType, index: int = 0) -> model.Bar | None: ...
    def quotes(self, instrument_id: model.InstrumentId) -> list[model.QuoteTick] | None: ...
    def trades(self, instrument_id: model.InstrumentId) -> list[model.TradeTick] | None: ...
    def bars(self, bar_type: model.BarType) -> list[model.Bar] | None: ...
    def bar_types(
        self,
        aggregation_source: model.AggregationSource,
        instrument_id: model.InstrumentId | None = None,
        price_type: model.PriceType | None = None,
    ) -> list[model.BarType]: ...
    def mark_price(self, instrument_id: model.InstrumentId) -> model.MarkPriceUpdate | None: ...
    def mark_prices(
        self, instrument_id: model.InstrumentId
    ) -> list[model.MarkPriceUpdate] | None: ...
    def index_price(self, instrument_id: model.InstrumentId) -> model.IndexPriceUpdate | None: ...
    def index_prices(
        self, instrument_id: model.InstrumentId
    ) -> list[model.IndexPriceUpdate] | None: ...
    def funding_rate(self, instrument_id: model.InstrumentId) -> model.FundingRateUpdate | None: ...
    def funding_rates(
        self, instrument_id: model.InstrumentId
    ) -> list[model.FundingRateUpdate] | None: ...
    def instrument_status(
        self, instrument_id: model.InstrumentId
    ) -> model.InstrumentStatus | None: ...
    def instrument_statuses(
        self, instrument_id: model.InstrumentId
    ) -> list[model.InstrumentStatus] | None: ...
    def instrument_close(
        self, instrument_id: model.InstrumentId
    ) -> model.InstrumentClose | None: ...
    def price(
        self, instrument_id: model.InstrumentId, price_type: model.PriceType
    ) -> model.Price | None: ...
    def order_book(self, instrument_id: model.InstrumentId) -> model.OrderBook | None: ...
    def has_order_book(self, instrument_id: model.InstrumentId) -> bool: ...
    def book_update_count(self, instrument_id: model.InstrumentId) -> int: ...
    def has_quote_ticks(self, instrument_id: model.InstrumentId) -> bool: ...
    def has_trade_ticks(self, instrument_id: model.InstrumentId) -> bool: ...
    def has_mark_prices(self, instrument_id: model.InstrumentId) -> bool: ...
    def has_index_prices(self, instrument_id: model.InstrumentId) -> bool: ...
    def has_funding_rates(self, instrument_id: model.InstrumentId) -> bool: ...
    def has_instrument_statuses(self, instrument_id: model.InstrumentId) -> bool: ...
    def has_instrument_close(self, instrument_id: model.InstrumentId) -> bool: ...
    def has_bars(self, bar_type: model.BarType) -> bool: ...
    def quote_count(self, instrument_id: model.InstrumentId) -> int: ...
    def trade_count(self, instrument_id: model.InstrumentId) -> int: ...
    def mark_price_count(self, instrument_id: model.InstrumentId) -> int: ...
    def index_price_count(self, instrument_id: model.InstrumentId) -> int: ...
    def funding_rate_count(self, instrument_id: model.InstrumentId) -> int: ...
    def instrument_status_count(self, instrument_id: model.InstrumentId) -> int: ...
    def bar_count(self, bar_type: model.BarType) -> int: ...
    def get_xrate(
        self,
        venue: model.Venue,
        from_currency: model.Currency,
        to_currency: model.Currency,
        price_type: model.PriceType,
    ) -> float | None: ...
    def get_mark_xrate(
        self, from_currency: model.Currency, to_currency: model.Currency
    ) -> float | None: ...
    def own_order_book(self, instrument_id: model.InstrumentId) -> model.OwnOrderBook | None: ...
    def instrument(self, instrument_id: model.InstrumentId) -> typing.Any | None: ...
    def instrument_ids(self, venue: model.Venue | None = None) -> list[model.InstrumentId]: ...
    def instruments(self, venue: model.Venue | None = None) -> list[typing.Any]: ...
    def synthetic(self, instrument_id: model.InstrumentId) -> model.SyntheticInstrument | None: ...
    def synthetic_ids(self) -> list[model.InstrumentId]: ...
    def account(self, account_id: model.AccountId) -> typing.Any | None: ...
    def account_for_venue(self, venue: model.Venue) -> typing.Any | None: ...
    def account_id(self, venue: model.Venue) -> model.AccountId | None: ...
    def client_order_ids(
        self,
        venue: model.Venue | None = None,
        instrument_id: model.InstrumentId | None = None,
        strategy_id: model.StrategyId | None = None,
        account_id: model.AccountId | None = None,
    ) -> list[model.ClientOrderId]: ...
    def client_order_ids_open(
        self,
        venue: model.Venue | None = None,
        instrument_id: model.InstrumentId | None = None,
        strategy_id: model.StrategyId | None = None,
        account_id: model.AccountId | None = None,
    ) -> list[model.ClientOrderId]: ...
    def client_order_ids_closed(
        self,
        venue: model.Venue | None = None,
        instrument_id: model.InstrumentId | None = None,
        strategy_id: model.StrategyId | None = None,
        account_id: model.AccountId | None = None,
    ) -> list[model.ClientOrderId]: ...
    def client_order_ids_emulated(
        self,
        venue: model.Venue | None = None,
        instrument_id: model.InstrumentId | None = None,
        strategy_id: model.StrategyId | None = None,
        account_id: model.AccountId | None = None,
    ) -> list[model.ClientOrderId]: ...
    def client_order_ids_inflight(
        self,
        venue: model.Venue | None = None,
        instrument_id: model.InstrumentId | None = None,
        strategy_id: model.StrategyId | None = None,
        account_id: model.AccountId | None = None,
    ) -> list[model.ClientOrderId]: ...
    def position_ids(
        self,
        venue: model.Venue | None = None,
        instrument_id: model.InstrumentId | None = None,
        strategy_id: model.StrategyId | None = None,
        account_id: model.AccountId | None = None,
    ) -> list[model.PositionId]: ...
    def position_open_ids(
        self,
        venue: model.Venue | None = None,
        instrument_id: model.InstrumentId | None = None,
        strategy_id: model.StrategyId | None = None,
        account_id: model.AccountId | None = None,
    ) -> list[model.PositionId]: ...
    def position_closed_ids(
        self,
        venue: model.Venue | None = None,
        instrument_id: model.InstrumentId | None = None,
        strategy_id: model.StrategyId | None = None,
        account_id: model.AccountId | None = None,
    ) -> list[model.PositionId]: ...
    def strategy_ids(self) -> list[model.StrategyId]: ...
    def exec_algorithm_ids(self) -> list[model.ExecAlgorithmId]: ...
    def order(self, client_order_id: model.ClientOrderId) -> typing.Any | None: ...
    def client_order_id(self, venue_order_id: model.VenueOrderId) -> model.ClientOrderId | None: ...
    def venue_order_id(self, client_order_id: model.ClientOrderId) -> model.VenueOrderId | None: ...
    def client_id(self, client_order_id: model.ClientOrderId) -> model.ClientId | None: ...
    def orders(
        self,
        venue: model.Venue | None = None,
        instrument_id: model.InstrumentId | None = None,
        strategy_id: model.StrategyId | None = None,
        account_id: model.AccountId | None = None,
        side: model.OrderSide | None = None,
    ) -> list[typing.Any]: ...
    def orders_open(
        self,
        venue: model.Venue | None = None,
        instrument_id: model.InstrumentId | None = None,
        strategy_id: model.StrategyId | None = None,
        account_id: model.AccountId | None = None,
        side: model.OrderSide | None = None,
    ) -> list[typing.Any]: ...
    def orders_closed(
        self,
        venue: model.Venue | None = None,
        instrument_id: model.InstrumentId | None = None,
        strategy_id: model.StrategyId | None = None,
        account_id: model.AccountId | None = None,
        side: model.OrderSide | None = None,
    ) -> list[typing.Any]: ...
    def orders_emulated(
        self,
        venue: model.Venue | None = None,
        instrument_id: model.InstrumentId | None = None,
        strategy_id: model.StrategyId | None = None,
        account_id: model.AccountId | None = None,
        side: model.OrderSide | None = None,
    ) -> list[typing.Any]: ...
    def orders_inflight(
        self,
        venue: model.Venue | None = None,
        instrument_id: model.InstrumentId | None = None,
        strategy_id: model.StrategyId | None = None,
        account_id: model.AccountId | None = None,
        side: model.OrderSide | None = None,
    ) -> list[typing.Any]: ...
    def orders_for_position(self, position_id: model.PositionId) -> list[typing.Any]: ...
    def order_exists(self, client_order_id: model.ClientOrderId) -> bool: ...
    def is_order_open(self, client_order_id: model.ClientOrderId) -> bool: ...
    def is_order_closed(self, client_order_id: model.ClientOrderId) -> bool: ...
    def is_order_emulated(self, client_order_id: model.ClientOrderId) -> bool: ...
    def is_order_inflight(self, client_order_id: model.ClientOrderId) -> bool: ...
    def is_order_pending_cancel_local(self, client_order_id: model.ClientOrderId) -> bool: ...
    def orders_open_count(
        self,
        venue: model.Venue | None = None,
        instrument_id: model.InstrumentId | None = None,
        strategy_id: model.StrategyId | None = None,
        account_id: model.AccountId | None = None,
        side: model.OrderSide | None = None,
    ) -> int: ...
    def orders_closed_count(
        self,
        venue: model.Venue | None = None,
        instrument_id: model.InstrumentId | None = None,
        strategy_id: model.StrategyId | None = None,
        account_id: model.AccountId | None = None,
        side: model.OrderSide | None = None,
    ) -> int: ...
    def orders_emulated_count(
        self,
        venue: model.Venue | None = None,
        instrument_id: model.InstrumentId | None = None,
        strategy_id: model.StrategyId | None = None,
        account_id: model.AccountId | None = None,
        side: model.OrderSide | None = None,
    ) -> int: ...
    def orders_inflight_count(
        self,
        venue: model.Venue | None = None,
        instrument_id: model.InstrumentId | None = None,
        strategy_id: model.StrategyId | None = None,
        account_id: model.AccountId | None = None,
        side: model.OrderSide | None = None,
    ) -> int: ...
    def orders_total_count(
        self,
        venue: model.Venue | None = None,
        instrument_id: model.InstrumentId | None = None,
        strategy_id: model.StrategyId | None = None,
        account_id: model.AccountId | None = None,
        side: model.OrderSide | None = None,
    ) -> int: ...
    def order_list(self, order_list_id: model.OrderListId) -> model.OrderList | None: ...
    def order_lists(
        self,
        venue: model.Venue | None = None,
        instrument_id: model.InstrumentId | None = None,
        strategy_id: model.StrategyId | None = None,
        account_id: model.AccountId | None = None,
    ) -> list[model.OrderList]: ...
    def order_list_exists(self, order_list_id: model.OrderListId) -> bool: ...
    def orders_for_exec_algorithm(
        self,
        exec_algorithm_id: model.ExecAlgorithmId,
        venue: model.Venue | None = None,
        instrument_id: model.InstrumentId | None = None,
        strategy_id: model.StrategyId | None = None,
        account_id: model.AccountId | None = None,
        side: model.OrderSide | None = None,
    ) -> list[typing.Any]: ...
    def orders_for_exec_spawn(self, exec_spawn_id: model.ClientOrderId) -> list[typing.Any]: ...
    def exec_spawn_total_quantity(
        self, exec_spawn_id: model.ClientOrderId, active_only: bool
    ) -> model.Quantity | None: ...
    def exec_spawn_total_filled_qty(
        self, exec_spawn_id: model.ClientOrderId, active_only: bool
    ) -> model.Quantity | None: ...
    def exec_spawn_total_leaves_qty(
        self, exec_spawn_id: model.ClientOrderId, active_only: bool
    ) -> model.Quantity | None: ...
    def position(self, position_id: model.PositionId) -> typing.Any | None: ...
    def position_for_order(self, client_order_id: model.ClientOrderId) -> typing.Any | None: ...
    def position_id(self, client_order_id: model.ClientOrderId) -> model.PositionId | None: ...
    def positions(
        self,
        venue: model.Venue | None = None,
        instrument_id: model.InstrumentId | None = None,
        strategy_id: model.StrategyId | None = None,
        account_id: model.AccountId | None = None,
        side: model.PositionSide | None = None,
    ) -> list[typing.Any]: ...
    def positions_open(
        self,
        venue: model.Venue | None = None,
        instrument_id: model.InstrumentId | None = None,
        strategy_id: model.StrategyId | None = None,
        account_id: model.AccountId | None = None,
        side: model.PositionSide | None = None,
    ) -> list[typing.Any]: ...
    def positions_closed(
        self,
        venue: model.Venue | None = None,
        instrument_id: model.InstrumentId | None = None,
        strategy_id: model.StrategyId | None = None,
        account_id: model.AccountId | None = None,
        side: model.PositionSide | None = None,
    ) -> list[typing.Any]: ...
    def position_exists(self, position_id: model.PositionId) -> bool: ...
    def is_position_open(self, position_id: model.PositionId) -> bool: ...
    def is_position_closed(self, position_id: model.PositionId) -> bool: ...
    def positions_open_count(
        self,
        venue: model.Venue | None = None,
        instrument_id: model.InstrumentId | None = None,
        strategy_id: model.StrategyId | None = None,
        account_id: model.AccountId | None = None,
        side: model.PositionSide | None = None,
    ) -> int: ...
    def positions_closed_count(
        self,
        venue: model.Venue | None = None,
        instrument_id: model.InstrumentId | None = None,
        strategy_id: model.StrategyId | None = None,
        account_id: model.AccountId | None = None,
        side: model.PositionSide | None = None,
    ) -> int: ...
    def positions_total_count(
        self,
        venue: model.Venue | None = None,
        instrument_id: model.InstrumentId | None = None,
        strategy_id: model.StrategyId | None = None,
        account_id: model.AccountId | None = None,
        side: model.PositionSide | None = None,
    ) -> int: ...
    def strategy_id_for_order(
        self, client_order_id: model.ClientOrderId
    ) -> model.StrategyId | None: ...
    def strategy_id_for_position(
        self, position_id: model.PositionId
    ) -> model.StrategyId | None: ...
    def position_snapshot_bytes(self, position_id: model.PositionId) -> list[list[int]] | None: ...
    def snapshot_position(self, position: typing.Any) -> None: ...
    def position_snapshots(
        self, position_id: model.PositionId | None = None, account_id: model.AccountId | None = None
    ) -> list[typing.Any]: ...
    def pool(self, instrument_id: model.InstrumentId) -> model.Pool | None: ...
    def pool_profiler(self, instrument_id: model.InstrumentId) -> model.PoolProfiler | None: ...

@typing.final
class Clock:
    @staticmethod
    def new_test() -> Clock: ...
    def timestamp_ns(self) -> int: ...
    def timestamp_us(self) -> int: ...
    def timestamp_ms(self) -> int: ...
    def timestamp(self) -> float: ...
    def utc_now(self) -> datetime.datetime: ...
    def set_time(self, to_time_ns: int) -> None: ...
    def timer_names(self) -> list[str]: ...
    def timer_count(self) -> int: ...
    def register_default_handler(self, callback: typing.Any) -> None: ...
    def cancel_default_handler(self) -> None: ...
    def cancel_callbacks(self) -> None: ...
    def set_time_alert(
        self,
        name: str,
        alert_time: datetime.datetime,
        callback: typing.Any | None = None,
        allow_past: bool | None = None,
    ) -> None: ...
    def set_time_alert_ns(
        self,
        name: str,
        alert_time_ns: int,
        callback: typing.Any | None = None,
        allow_past: bool | None = None,
    ) -> None: ...
    def set_timer(
        self,
        name: str,
        interval: datetime.timedelta,
        start_time: datetime.datetime | None = None,
        stop_time: datetime.datetime | None = None,
        callback: typing.Any | None = None,
        allow_past: bool | None = None,
        fire_immediately: bool | None = None,
    ) -> None: ...
    def set_timer_ns(
        self,
        name: str,
        interval_ns: int,
        start_time_ns: int | None = None,
        stop_time_ns: int | None = None,
        callback: typing.Any | None = None,
        allow_past: bool | None = None,
        fire_immediately: bool | None = None,
    ) -> None: ...
    def next_time_ns(self, name: str) -> int | None: ...
    def cancel_timer(self, name: str) -> None: ...
    def cancel_timers(self) -> None: ...

class DataActor:
    def __init__(self, config: typing.Any | None = None) -> None: ...
    @property
    def clock(self) -> Clock: ...
    @property
    def cache(self) -> Cache: ...
    @property
    def log(self) -> Logger: ...
    @property
    def actor_id(self) -> model.ActorId: ...
    @property
    def config(self) -> typing.Any | None: ...
    @property
    def trader_id(self) -> model.TraderId | None: ...
    def state(self) -> ComponentState: ...
    def is_ready(self) -> bool: ...
    def is_running(self) -> bool: ...
    def is_stopped(self) -> bool: ...
    def is_degraded(self) -> bool: ...
    def is_faulted(self) -> bool: ...
    def is_disposed(self) -> bool: ...
    def start(self) -> None: ...
    def stop(self) -> None: ...
    def save(self) -> dict: ...
    def load(self, state: dict) -> None: ...
    def resume(self) -> None: ...
    def reset(self) -> None: ...
    def dispose(self) -> None: ...
    def degrade(self) -> None: ...
    def fault(self) -> None: ...
    def shutdown_system(self, reason: str | None = None) -> None: ...
    def publish_data(self, data_type: model.DataType, data: model.CustomData) -> None: ...
    def publish_signal(self, name: str, value: typing.Any, ts_event: int = 0) -> None: ...
    def add_synthetic(self, synthetic: model.SyntheticInstrument) -> None: ...
    def update_synthetic(self, synthetic: model.SyntheticInstrument) -> None: ...
    @property
    def registered_indicators(self) -> list: ...
    def indicators_initialized(self) -> bool: ...
    def register_indicator_for_quote_ticks(
        self, instrument_id: model.InstrumentId, indicator: typing.Any
    ) -> None: ...
    def register_indicator_for_trade_ticks(
        self, instrument_id: model.InstrumentId, indicator: typing.Any
    ) -> None: ...
    def register_indicator_for_bars(
        self, bar_type: model.BarType, indicator: typing.Any
    ) -> None: ...
    def on_start(self) -> None: ...
    def on_stop(self) -> None: ...
    def on_resume(self) -> None: ...
    def on_reset(self) -> None: ...
    def on_dispose(self) -> None: ...
    def on_degrade(self) -> None: ...
    def on_fault(self) -> None: ...
    def on_save(self) -> dict: ...
    def on_load(self, state: dict) -> None: ...
    def on_time_event(self, event: TimeEvent) -> None: ...
    def on_data(self, data: typing.Any) -> None: ...
    def on_signal(self, signal: Signal) -> None: ...
    def on_queue_state(self, event: QueueStateChanged) -> None: ...
    def on_socket_state(self, event: SocketStateChanged) -> None: ...
    def on_instrument(self, instrument: typing.Any) -> None: ...
    def on_quote(self, quote: model.QuoteTick) -> None: ...
    def on_trade(self, trade: model.TradeTick) -> None: ...
    def on_bar(self, bar: model.Bar) -> None: ...
    def on_book_deltas(self, deltas: model.OrderBookDeltas) -> None: ...
    def on_book_depth(self, depth: model.OrderBookDepth10) -> None: ...
    def on_book(self, book: model.OrderBook) -> None: ...
    def on_mark_price(self, mark_price: model.MarkPriceUpdate) -> None: ...
    def on_index_price(self, index_price: model.IndexPriceUpdate) -> None: ...
    def on_funding_rate(self, funding_rate: model.FundingRateUpdate) -> None: ...
    def on_instrument_status(self, status: model.InstrumentStatus) -> None: ...
    def on_instrument_close(self, close: model.InstrumentClose) -> None: ...
    def on_option_greeks(self, greeks: model.OptionGreeks) -> None: ...
    def on_option_chain(self, slice: model.OptionChainSlice) -> None: ...
    def subscribe_data(
        self,
        data_type: model.DataType,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> None: ...
    def subscribe_signal(self, name: str = "", priority: int | None = None) -> None: ...
    def subscribe_queue_state(
        self, channel: SystemChannel | None = None, priority: int | None = None
    ) -> None: ...
    def subscribe_socket_state(
        self,
        client_id: model.ClientId | None = None,
        endpoint: str | None = None,
        priority: int | None = None,
    ) -> None: ...
    def subscribe_instruments(
        self,
        venue: model.Venue,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> None: ...
    def subscribe_instrument(
        self,
        instrument_id: model.InstrumentId,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> None: ...
    def subscribe_book_deltas(
        self,
        instrument_id: model.InstrumentId,
        book_type: model.BookType,
        depth: int | None = None,
        client_id: model.ClientId | None = None,
        managed: bool = False,
        params: dict | None = None,
    ) -> None: ...
    def subscribe_book_depth10(
        self,
        instrument_id: model.InstrumentId,
        book_type: model.BookType,
        client_id: model.ClientId | None = None,
        managed: bool = False,
        params: dict | None = None,
    ) -> None: ...
    def subscribe_book_at_interval(
        self,
        instrument_id: model.InstrumentId,
        book_type: model.BookType,
        interval_ms: int,
        depth: int | None = None,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> None: ...
    def subscribe_quotes(
        self,
        instrument_id: model.InstrumentId,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> None: ...
    def subscribe_trades(
        self,
        instrument_id: model.InstrumentId,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> None: ...
    def subscribe_bars(
        self,
        bar_type: model.BarType,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> None: ...
    def subscribe_mark_prices(
        self,
        instrument_id: model.InstrumentId,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> None: ...
    def subscribe_index_prices(
        self,
        instrument_id: model.InstrumentId,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> None: ...
    def subscribe_funding_rates(
        self,
        instrument_id: model.InstrumentId,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> None: ...
    def subscribe_option_greeks(
        self,
        instrument_id: model.InstrumentId,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> None: ...
    def subscribe_instrument_status(
        self,
        instrument_id: model.InstrumentId,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> None: ...
    def subscribe_instrument_close(
        self,
        instrument_id: model.InstrumentId,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> None: ...
    def subscribe_option_chain(
        self,
        series_id: model.OptionSeriesId,
        strike_range: model.StrikeRange,
        snapshot_interval_ms: int | None = None,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> None: ...
    def unsubscribe_data(
        self,
        data_type: model.DataType,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> None: ...
    def unsubscribe_signal(self, name: str = "") -> None: ...
    def unsubscribe_queue_state(self, channel: SystemChannel | None = None) -> None: ...
    def unsubscribe_socket_state(
        self, client_id: model.ClientId | None = None, endpoint: str | None = None
    ) -> None: ...
    def unsubscribe_instruments(
        self,
        venue: model.Venue,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> None: ...
    def unsubscribe_instrument(
        self,
        instrument_id: model.InstrumentId,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> None: ...
    def unsubscribe_book_deltas(
        self,
        instrument_id: model.InstrumentId,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> None: ...
    def unsubscribe_book_depth10(
        self,
        instrument_id: model.InstrumentId,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> None: ...
    def unsubscribe_book_at_interval(
        self,
        instrument_id: model.InstrumentId,
        interval_ms: int,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> None: ...
    def unsubscribe_quotes(
        self,
        instrument_id: model.InstrumentId,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> None: ...
    def unsubscribe_trades(
        self,
        instrument_id: model.InstrumentId,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> None: ...
    def unsubscribe_bars(
        self,
        bar_type: model.BarType,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> None: ...
    def unsubscribe_mark_prices(
        self,
        instrument_id: model.InstrumentId,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> None: ...
    def unsubscribe_index_prices(
        self,
        instrument_id: model.InstrumentId,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> None: ...
    def unsubscribe_funding_rates(
        self,
        instrument_id: model.InstrumentId,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> None: ...
    def unsubscribe_option_greeks(
        self,
        instrument_id: model.InstrumentId,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> None: ...
    def unsubscribe_instrument_status(
        self,
        instrument_id: model.InstrumentId,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> None: ...
    def unsubscribe_instrument_close(
        self,
        instrument_id: model.InstrumentId,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> None: ...
    def unsubscribe_option_chain(
        self, series_id: model.OptionSeriesId, client_id: model.ClientId | None = None
    ) -> None: ...
    def request_data(
        self,
        data_type: model.DataType,
        client_id: model.ClientId,
        start: datetime.datetime | None = None,
        end: datetime.datetime | None = None,
        limit: int | None = None,
        params: dict | None = None,
    ) -> str: ...
    def request_instrument(
        self,
        instrument_id: model.InstrumentId,
        start: datetime.datetime | None = None,
        end: datetime.datetime | None = None,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> str: ...
    def request_instruments(
        self,
        venue: model.Venue | None = None,
        start: datetime.datetime | None = None,
        end: datetime.datetime | None = None,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> str: ...
    def request_book_snapshot(
        self,
        instrument_id: model.InstrumentId,
        depth: int | None = None,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> str: ...
    def request_book_deltas(
        self,
        instrument_id: model.InstrumentId,
        start: datetime.datetime | None = None,
        end: datetime.datetime | None = None,
        limit: int | None = None,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> str: ...
    def request_book_depth(
        self,
        instrument_id: model.InstrumentId,
        start: datetime.datetime | None = None,
        end: datetime.datetime | None = None,
        limit: int | None = None,
        depth: int | None = None,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> str: ...
    def request_quotes(
        self,
        instrument_id: model.InstrumentId,
        start: datetime.datetime | None = None,
        end: datetime.datetime | None = None,
        limit: int | None = None,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> str: ...
    def request_trades(
        self,
        instrument_id: model.InstrumentId,
        start: datetime.datetime | None = None,
        end: datetime.datetime | None = None,
        limit: int | None = None,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> str: ...
    def request_funding_rates(
        self,
        instrument_id: model.InstrumentId,
        start: datetime.datetime | None = None,
        end: datetime.datetime | None = None,
        limit: int | None = None,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> str: ...
    def request_bars(
        self,
        bar_type: model.BarType,
        start: datetime.datetime | None = None,
        end: datetime.datetime | None = None,
        limit: int | None = None,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> str: ...
    def reconnect_socket(self, client_id: model.ClientId, endpoint: str) -> None: ...
    def on_historical_data(self, data: typing.Any) -> None: ...
    def on_historical_book_deltas(self, deltas: typing.Sequence[model.OrderBookDelta]) -> None: ...
    def on_historical_book_depth(self, depths: typing.Sequence[model.OrderBookDepth10]) -> None: ...
    def on_historical_quotes(self, quotes: typing.Sequence[model.QuoteTick]) -> None: ...
    def on_historical_trades(self, trades: typing.Sequence[model.TradeTick]) -> None: ...
    def on_historical_funding_rates(
        self, funding_rates: typing.Sequence[model.FundingRateUpdate]
    ) -> None: ...
    def on_historical_bars(self, bars: typing.Sequence[model.Bar]) -> None: ...
    def on_historical_mark_prices(
        self, mark_prices: typing.Sequence[model.MarkPriceUpdate]
    ) -> None: ...
    def on_historical_index_prices(
        self, index_prices: typing.Sequence[model.IndexPriceUpdate]
    ) -> None: ...
    def publish_message(self, topic: str, message: object) -> None: ...
    def subscribe_topic(
        self, topic: str, handler: collections.abc.Callable[[object], None], priority: int = 0
    ) -> None: ...
    def unsubscribe_topic(
        self, topic: str, handler: collections.abc.Callable[[object], None]
    ) -> None: ...
    def on_block(self, block: model.Block) -> None: ...
    def on_pool(self, pool: model.Pool) -> None: ...
    def on_pool_swap(self, swap: model.PoolSwap) -> None: ...
    def on_pool_liquidity_update(self, update: model.PoolLiquidityUpdate) -> None: ...
    def on_pool_fee_collect(self, update: model.PoolFeeCollect) -> None: ...
    def on_pool_flash(self, flash: model.PoolFlash) -> None: ...
    def subscribe_blocks(
        self, chain: Blockchain, client_id: model.ClientId | None = None, params: dict | None = None
    ) -> None: ...
    def subscribe_pool(
        self,
        instrument_id: model.InstrumentId,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> None: ...
    def subscribe_pool_swaps(
        self,
        instrument_id: model.InstrumentId,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> None: ...
    def subscribe_pool_liquidity_updates(
        self,
        instrument_id: model.InstrumentId,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> None: ...
    def subscribe_pool_fee_collects(
        self,
        instrument_id: model.InstrumentId,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> None: ...
    def subscribe_pool_flash_events(
        self,
        instrument_id: model.InstrumentId,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> None: ...
    def unsubscribe_blocks(
        self, chain: Blockchain, client_id: model.ClientId | None = None, params: dict | None = None
    ) -> None: ...
    def unsubscribe_pool(
        self,
        instrument_id: model.InstrumentId,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> None: ...
    def unsubscribe_pool_swaps(
        self,
        instrument_id: model.InstrumentId,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> None: ...
    def unsubscribe_pool_liquidity_updates(
        self,
        instrument_id: model.InstrumentId,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> None: ...
    def unsubscribe_pool_fee_collects(
        self,
        instrument_id: model.InstrumentId,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> None: ...
    def unsubscribe_pool_flash_events(
        self,
        instrument_id: model.InstrumentId,
        client_id: model.ClientId | None = None,
        params: dict | None = None,
    ) -> None: ...

@typing.final
class FifoCache:
    def __init__(self) -> None: ...
    @property
    def capacity(self) -> int: ...
    def __len__(self) -> int: ...
    def __contains__(self, key: str) -> bool: ...
    def add(self, key: str) -> None: ...
    def remove(self, key: str) -> None: ...
    def clear(self) -> None: ...

@typing.final
class GreeksCalculator:
    def __init__(self, cache: Cache, clock: Clock) -> None: ...
    def instrument_greeks(
        self,
        instrument_id: model.InstrumentId,
        flat_interest_rate: float = 0.0425,
        flat_dividend_yield: float | None = None,
        spot_shock: float = 0.0,
        vol_shock: float = 0.0,
        time_to_expiry_shock: float = 0.0,
        use_cached_greeks: bool = False,
        update_vol: bool = False,
        cache_greeks: bool = False,
        ts_event: int = 0,
        position: model.Position | None = None,
        percent_greeks: bool = False,
        index_instrument_id: model.InstrumentId | None = None,
        beta_weights: typing.Mapping[model.InstrumentId, float] | None = None,
        vega_time_weight_base: int | None = None,
        vol_index_instrument_id: model.InstrumentId | None = None,
        vol_beta_weights: typing.Mapping[model.InstrumentId, float] | None = None,
    ) -> model.GreeksData | None: ...
    def modify_greeks(
        self,
        delta_input: float,
        gamma_input: float,
        underlying_instrument_id: model.InstrumentId,
        underlying_price: float,
        unshocked_underlying_price: float,
        percent_greeks: bool,
        index_instrument_id: model.InstrumentId | None = None,
        beta_weights: typing.Mapping[model.InstrumentId, float] | None = None,
        vega_input: float = 0.0,
        vol: float = 0.0,
        expiry_in_days: int = 0,
        vega_time_weight_base: int | None = None,
        unshocked_vol: float = 0.0,
        vol_index_instrument_id: model.InstrumentId | None = None,
        vol_beta_weights: typing.Mapping[model.InstrumentId, float] | None = None,
        index_price: float | None = None,
        vol_index_price: float | None = None,
    ) -> tuple[float, float, float]: ...
    def portfolio_greeks(
        self,
        underlyings: typing.Sequence[str] | None = None,
        venue: model.Venue | None = None,
        instrument_id: model.InstrumentId | None = None,
        strategy_id: model.StrategyId | None = None,
        side: model.PositionSide | None = None,
        flat_interest_rate: float = 0.0425,
        flat_dividend_yield: float | None = None,
        spot_shock: float = 0.0,
        vol_shock: float = 0.0,
        time_to_expiry_shock: float = 0.0,
        use_cached_greeks: bool = False,
        update_vol: bool = False,
        cache_greeks: bool = False,
        percent_greeks: bool = False,
        index_instrument_id: model.InstrumentId | None = None,
        beta_weights: typing.Mapping[model.InstrumentId, float] | None = None,
        greeks_filter: typing.Any | None = None,
        vega_time_weight_base: int | None = None,
        vol_index_instrument_id: model.InstrumentId | None = None,
        vol_beta_weights: typing.Mapping[model.InstrumentId, float] | None = None,
    ) -> model.PortfolioGreeks: ...
    def cache_futures_spread(
        self,
        call_instrument_id: model.InstrumentId,
        put_instrument_id: model.InstrumentId,
        futures_instrument_id: model.InstrumentId,
    ) -> model.Price: ...
    def get_cached_futures_spread_price(
        self, underlying_instrument_id: model.InstrumentId
    ) -> model.Price | None: ...

@typing.final
class Logger:
    def __init__(self, name: str = "Python") -> None: ...
    @property
    def name(self) -> str: ...
    def trace(self, message: str, color: LogColor | None = None) -> None: ...
    def debug(self, message: str, color: LogColor | None = None) -> None: ...
    def info(self, message: str, color: LogColor | None = None) -> None: ...
    def warning(self, message: str, color: LogColor | None = None) -> None: ...
    def error(self, message: str, color: LogColor | None = None) -> None: ...
    def exception(self, message: str = "", color: LogColor | None = None) -> None: ...
    def flush(self) -> None: ...
    def _log(self, level: LogLevel, color: LogColor | None = None, message: str = "") -> None: ...

@typing.final
class MessageBus:
    def __init__(
        self,
        trader_id: model.TraderId,
        clock: typing.Any | None = None,
        instance_id: core.UUID4 | None = None,
        name: str | None = None,
        serializer: typing.Any | None = None,
        backing: typing.Any | None = None,
        config: typing.Any | None = None,
    ) -> None: ...
    @property
    def trader_id(self) -> model.TraderId: ...
    @property
    def instance_id(self) -> core.UUID4: ...
    @property
    def name(self) -> str: ...
    @property
    def has_backing(self) -> bool: ...
    @property
    def sent_count(self) -> int: ...
    @property
    def req_count(self) -> int: ...
    @property
    def res_count(self) -> int: ...
    @property
    def pub_count(self) -> int: ...
    def endpoints(self) -> list[str]: ...
    def topics(self) -> list[str]: ...
    def subscriptions(self, pattern: str | None = None) -> list[str]: ...
    def has_subscribers(self, pattern: str | None = None) -> bool: ...
    def is_subscribed(self, topic: str, handler: typing.Any) -> bool: ...
    def is_pending_request(self, request_id: core.UUID4) -> bool: ...
    def is_streaming_type(self, cls: typing.Any) -> bool: ...
    def streaming_types(self) -> list[typing.Any]: ...
    def register(self, endpoint: str, handler: typing.Any) -> None: ...
    def deregister(self, endpoint: str, handler: typing.Any | None = None) -> None: ...
    def send(self, endpoint: str, msg: typing.Any) -> None: ...
    def request(self, endpoint: str, request: typing.Any) -> None: ...
    def response(self, response: typing.Any) -> None: ...
    def subscribe(self, topic: str, handler: typing.Any, priority: int = 0) -> None: ...
    def unsubscribe(self, topic: str, handler: typing.Any) -> None: ...
    def publish(self, topic: str, msg: typing.Any, external_pub: bool = True) -> None: ...
    def dispose(self) -> None: ...
    def add_streaming_type(self, cls: typing.Any) -> None: ...
    def add_listener(self, listener: typing.Any) -> None: ...

@typing.final
class OrderFactory:
    def __init__(
        self,
        trader_id: model.TraderId,
        strategy_id: model.StrategyId,
        clock: Clock,
        use_uuid_client_order_ids: bool = False,
        use_hyphens_in_client_order_ids: bool = True,
    ) -> None: ...
    @property
    def trader_id(self) -> model.TraderId: ...
    @property
    def strategy_id(self) -> model.StrategyId: ...
    def get_client_order_id_count(self) -> int: ...
    def get_order_list_id_count(self) -> int: ...
    def generate_client_order_id(self) -> model.ClientOrderId: ...
    def generate_order_list_id(self) -> model.OrderListId: ...
    def reset(self) -> None: ...
    def market(
        self,
        instrument_id: model.InstrumentId,
        order_side: model.OrderSide,
        quantity: model.Quantity,
        time_in_force: model.TimeInForce | None = None,
        reduce_only: bool | None = None,
        quote_quantity: bool | None = None,
        exec_algorithm_id: model.ExecAlgorithmId | None = None,
        exec_algorithm_params: typing.Mapping[str, str] | None = None,
        tags: typing.Sequence[str] | None = None,
        client_order_id: model.ClientOrderId | None = None,
    ) -> typing.Any: ...
    def limit(
        self,
        instrument_id: model.InstrumentId,
        order_side: model.OrderSide,
        quantity: model.Quantity,
        price: model.Price,
        time_in_force: model.TimeInForce | None = None,
        expire_time: int | None = None,
        post_only: bool | None = None,
        reduce_only: bool | None = None,
        quote_quantity: bool | None = None,
        display_qty: model.Quantity | None = None,
        emulation_trigger: model.TriggerType | None = None,
        trigger_instrument_id: model.InstrumentId | None = None,
        exec_algorithm_id: model.ExecAlgorithmId | None = None,
        exec_algorithm_params: typing.Mapping[str, str] | None = None,
        tags: typing.Sequence[str] | None = None,
        client_order_id: model.ClientOrderId | None = None,
    ) -> typing.Any: ...
    def stop_market(
        self,
        instrument_id: model.InstrumentId,
        order_side: model.OrderSide,
        quantity: model.Quantity,
        trigger_price: model.Price,
        trigger_type: model.TriggerType | None = None,
        time_in_force: model.TimeInForce | None = None,
        expire_time: int | None = None,
        reduce_only: bool | None = None,
        quote_quantity: bool | None = None,
        display_qty: model.Quantity | None = None,
        emulation_trigger: model.TriggerType | None = None,
        trigger_instrument_id: model.InstrumentId | None = None,
        exec_algorithm_id: model.ExecAlgorithmId | None = None,
        exec_algorithm_params: typing.Mapping[str, str] | None = None,
        tags: typing.Sequence[str] | None = None,
        client_order_id: model.ClientOrderId | None = None,
    ) -> typing.Any: ...
    def stop_limit(
        self,
        instrument_id: model.InstrumentId,
        order_side: model.OrderSide,
        quantity: model.Quantity,
        price: model.Price,
        trigger_price: model.Price,
        trigger_type: model.TriggerType | None = None,
        time_in_force: model.TimeInForce | None = None,
        expire_time: int | None = None,
        post_only: bool | None = None,
        reduce_only: bool | None = None,
        quote_quantity: bool | None = None,
        display_qty: model.Quantity | None = None,
        emulation_trigger: model.TriggerType | None = None,
        trigger_instrument_id: model.InstrumentId | None = None,
        exec_algorithm_id: model.ExecAlgorithmId | None = None,
        exec_algorithm_params: typing.Mapping[str, str] | None = None,
        tags: typing.Sequence[str] | None = None,
        client_order_id: model.ClientOrderId | None = None,
    ) -> typing.Any: ...
    def market_to_limit(
        self,
        instrument_id: model.InstrumentId,
        order_side: model.OrderSide,
        quantity: model.Quantity,
        time_in_force: model.TimeInForce | None = None,
        expire_time: int | None = None,
        reduce_only: bool | None = None,
        quote_quantity: bool | None = None,
        display_qty: model.Quantity | None = None,
        exec_algorithm_id: model.ExecAlgorithmId | None = None,
        exec_algorithm_params: typing.Mapping[str, str] | None = None,
        tags: typing.Sequence[str] | None = None,
        client_order_id: model.ClientOrderId | None = None,
    ) -> typing.Any: ...
    def market_if_touched(
        self,
        instrument_id: model.InstrumentId,
        order_side: model.OrderSide,
        quantity: model.Quantity,
        trigger_price: model.Price,
        trigger_type: model.TriggerType | None = None,
        time_in_force: model.TimeInForce | None = None,
        expire_time: int | None = None,
        reduce_only: bool | None = None,
        quote_quantity: bool | None = None,
        emulation_trigger: model.TriggerType | None = None,
        trigger_instrument_id: model.InstrumentId | None = None,
        exec_algorithm_id: model.ExecAlgorithmId | None = None,
        exec_algorithm_params: typing.Mapping[str, str] | None = None,
        tags: typing.Sequence[str] | None = None,
        client_order_id: model.ClientOrderId | None = None,
    ) -> typing.Any: ...
    def limit_if_touched(
        self,
        instrument_id: model.InstrumentId,
        order_side: model.OrderSide,
        quantity: model.Quantity,
        price: model.Price,
        trigger_price: model.Price,
        trigger_type: model.TriggerType | None = None,
        time_in_force: model.TimeInForce | None = None,
        expire_time: int | None = None,
        post_only: bool | None = None,
        reduce_only: bool | None = None,
        quote_quantity: bool | None = None,
        display_qty: model.Quantity | None = None,
        emulation_trigger: model.TriggerType | None = None,
        trigger_instrument_id: model.InstrumentId | None = None,
        exec_algorithm_id: model.ExecAlgorithmId | None = None,
        exec_algorithm_params: typing.Mapping[str, str] | None = None,
        tags: typing.Sequence[str] | None = None,
        client_order_id: model.ClientOrderId | None = None,
    ) -> typing.Any: ...
    def trailing_stop_market(
        self,
        instrument_id: model.InstrumentId,
        order_side: model.OrderSide,
        quantity: model.Quantity,
        trailing_offset: decimal.Decimal,
        trailing_offset_type: model.TrailingOffsetType | None = None,
        activation_price: model.Price | None = None,
        trigger_price: model.Price | None = None,
        trigger_type: model.TriggerType | None = None,
        time_in_force: model.TimeInForce | None = None,
        expire_time: int | None = None,
        reduce_only: bool | None = None,
        quote_quantity: bool | None = None,
        display_qty: model.Quantity | None = None,
        emulation_trigger: model.TriggerType | None = None,
        trigger_instrument_id: model.InstrumentId | None = None,
        exec_algorithm_id: model.ExecAlgorithmId | None = None,
        exec_algorithm_params: typing.Mapping[str, str] | None = None,
        tags: typing.Sequence[str] | None = None,
        client_order_id: model.ClientOrderId | None = None,
    ) -> typing.Any: ...
    def trailing_stop_limit(
        self,
        instrument_id: model.InstrumentId,
        order_side: model.OrderSide,
        quantity: model.Quantity,
        price: model.Price | None,
        limit_offset: decimal.Decimal,
        trailing_offset: decimal.Decimal,
        trailing_offset_type: model.TrailingOffsetType | None = None,
        activation_price: model.Price | None = None,
        trigger_price: model.Price | None = None,
        trigger_type: model.TriggerType | None = None,
        time_in_force: model.TimeInForce | None = None,
        expire_time: int | None = None,
        post_only: bool | None = None,
        reduce_only: bool | None = None,
        quote_quantity: bool | None = None,
        display_qty: model.Quantity | None = None,
        emulation_trigger: model.TriggerType | None = None,
        trigger_instrument_id: model.InstrumentId | None = None,
        exec_algorithm_id: model.ExecAlgorithmId | None = None,
        exec_algorithm_params: typing.Mapping[str, str] | None = None,
        tags: typing.Sequence[str] | None = None,
        client_order_id: model.ClientOrderId | None = None,
    ) -> typing.Any: ...
    def bracket(
        self,
        instrument_id: model.InstrumentId,
        order_side: model.OrderSide,
        quantity: model.Quantity,
        quote_quantity: bool = False,
        emulation_trigger: model.TriggerType | None = None,
        trigger_instrument_id: model.InstrumentId | None = None,
        contingency_type: model.ContingencyType = model.ContingencyType.OUO,
        entry_order_type: model.OrderType = model.OrderType.MARKET,
        entry_price: model.Price | None = None,
        entry_trigger_price: model.Price | None = None,
        expire_time: int | None = None,
        time_in_force: model.TimeInForce = model.TimeInForce.GTC,
        entry_post_only: bool = False,
        entry_exec_algorithm_id: model.ExecAlgorithmId | None = None,
        entry_exec_algorithm_params: typing.Mapping[str, str] | None = None,
        entry_tags: typing.Sequence[str] | None = None,
        entry_client_order_id: model.ClientOrderId | None = None,
        tp_order_type: model.OrderType = model.OrderType.LIMIT,
        tp_price: model.Price | None = None,
        tp_trigger_price: model.Price | None = None,
        tp_trigger_type: model.TriggerType = model.TriggerType.DEFAULT,
        tp_activation_price: model.Price | None = None,
        tp_trailing_offset: decimal.Decimal | None = None,
        tp_trailing_offset_type: model.TrailingOffsetType = model.TrailingOffsetType.PRICE,
        tp_limit_offset: decimal.Decimal | None = None,
        tp_time_in_force: model.TimeInForce = model.TimeInForce.GTC,
        tp_post_only: bool = True,
        tp_exec_algorithm_id: model.ExecAlgorithmId | None = None,
        tp_exec_algorithm_params: typing.Mapping[str, str] | None = None,
        tp_tags: typing.Sequence[str] | None = None,
        tp_client_order_id: model.ClientOrderId | None = None,
        sl_order_type: model.OrderType = model.OrderType.STOP_MARKET,
        sl_trigger_price: model.Price | None = None,
        sl_trigger_type: model.TriggerType = model.TriggerType.DEFAULT,
        sl_activation_price: model.Price | None = None,
        sl_trailing_offset: decimal.Decimal | None = None,
        sl_trailing_offset_type: model.TrailingOffsetType = model.TrailingOffsetType.PRICE,
        sl_time_in_force: model.TimeInForce = model.TimeInForce.GTC,
        sl_exec_algorithm_id: model.ExecAlgorithmId | None = None,
        sl_exec_algorithm_params: typing.Mapping[str, str] | None = None,
        sl_tags: typing.Sequence[str] | None = None,
        sl_client_order_id: model.ClientOrderId | None = None,
    ) -> list: ...

@typing.final
class QueueStateChanged:
    def __init__(
        self,
        trader_id: model.TraderId,
        channel: SystemChannel,
        condition: QueueCondition,
        state: QueueState,
        queue_depth: int,
        mean_dispatch_ns: int,
        event_id: core.UUID4,
        ts_event: int,
        ts_init: int,
    ) -> None: ...
    @property
    def trader_id(self) -> model.TraderId: ...
    @property
    def channel(self) -> SystemChannel: ...
    @property
    def condition(self) -> QueueCondition: ...
    @property
    def state(self) -> QueueState: ...
    @property
    def queue_depth(self) -> int: ...
    @property
    def mean_dispatch_ns(self) -> int: ...
    @property
    def event_id(self) -> core.UUID4: ...
    @property
    def ts_event(self) -> int: ...
    @property
    def ts_init(self) -> int: ...

@typing.final
class ReconnectSocket:
    def __init__(
        self, trader_id: model.TraderId, client_id: model.ClientId, endpoint: str, ts_init: int
    ) -> None: ...
    @property
    def trader_id(self) -> model.TraderId: ...
    @property
    def client_id(self) -> model.ClientId: ...
    @property
    def endpoint(self) -> str: ...
    @property
    def ts_init(self) -> int: ...

@typing.final
class Signal:
    def __init__(self, name: str, value: str, ts_event: int, ts_init: int) -> None: ...
    @property
    def name(self) -> str: ...
    @property
    def value(self) -> str: ...
    @property
    def ts_event(self) -> int: ...
    @property
    def ts_init(self) -> int: ...

@typing.final
class SocketStateChanged:
    def __init__(
        self,
        trader_id: model.TraderId,
        client_id: model.ClientId,
        venue: model.Venue | None,
        endpoint: str,
        state: SocketState,
        event_id: core.UUID4,
        ts_event: int,
        ts_init: int,
    ) -> None: ...
    @property
    def trader_id(self) -> model.TraderId: ...
    @property
    def client_id(self) -> model.ClientId: ...
    @property
    def venue(self) -> model.Venue | None: ...
    @property
    def endpoint(self) -> str: ...
    @property
    def state(self) -> SocketState: ...
    @property
    def event_id(self) -> core.UUID4: ...
    @property
    def ts_event(self) -> int: ...
    @property
    def ts_init(self) -> int: ...

@typing.final
class TimeEvent:
    def __init__(self, name: str, event_id: core.UUID4, ts_event: int, ts_init: int) -> None: ...
    def __setstate__(self, state: typing.Any) -> None: ...
    def __getstate__(self) -> typing.Any: ...
    def __reduce__(self) -> typing.Any: ...
    @property
    def name(self) -> str: ...
    @property
    def event_id(self) -> core.UUID4: ...
    @property
    def ts_event(self) -> int: ...
    @property
    def ts_init(self) -> int: ...

@typing.final
class ComponentState(enum.Enum):
    PRE_INITIALIZED = ...
    READY = ...
    STARTING = ...
    RUNNING = ...
    STOPPING = ...
    STOPPED = ...
    RESUMING = ...
    RESETTING = ...
    DISPOSING = ...
    DISPOSED = ...
    DEGRADING = ...
    DEGRADED = ...
    FAULTING = ...
    FAULTED = ...

    def __hash__(self) -> int: ...

@typing.final
class ComponentTrigger(enum.Enum):
    INITIALIZE = ...
    START = ...
    START_COMPLETED = ...
    STOP = ...
    STOP_COMPLETED = ...
    RESUME = ...
    RESUME_COMPLETED = ...
    RESET = ...
    RESET_COMPLETED = ...
    DISPOSE = ...
    DISPOSE_COMPLETED = ...
    DEGRADE = ...
    DEGRADE_COMPLETED = ...
    FAULT = ...
    FAULT_COMPLETED = ...

    def __hash__(self) -> int: ...

@typing.final
class Environment(enum.Enum):
    BACKTEST = ...
    SANDBOX = ...
    LIVE = ...

    def __init__(self, value: typing.Any) -> None: ...
    def __hash__(self) -> int: ...
    @property
    def name(self) -> str: ...
    @property
    def value(self) -> int: ...
    @classmethod
    def variants(cls) -> model.EnumIterator: ...
    @classmethod
    def from_str(cls, data: typing.Any) -> Environment: ...

@typing.final
class LogColor(enum.Enum):
    NORMAL = ...
    GREEN = ...
    BLUE = ...
    MAGENTA = ...
    CYAN = ...
    YELLOW = ...
    RED = ...

    def __init__(self, value: typing.Any) -> None: ...
    def __hash__(self) -> int: ...
    @property
    def name(self) -> str: ...
    @property
    def value(self) -> int: ...
    @classmethod
    def variants(cls) -> model.EnumIterator: ...
    @classmethod
    def from_str(cls, data: typing.Any) -> LogColor: ...

@typing.final
class LogFormat(enum.Enum):
    HEADER = ...
    ENDC = ...
    BOLD = ...
    UNDERLINE = ...

    def __hash__(self) -> int: ...

@typing.final
class LogLevel(enum.Enum):
    OFF = ...
    TRACE = ...
    DEBUG = ...
    INFO = ...
    WARNING = ...
    ERROR = ...

    def __init__(self, value: typing.Any) -> None: ...
    def __hash__(self) -> int: ...
    @property
    def name(self) -> str: ...
    @property
    def value(self) -> int: ...
    @classmethod
    def variants(cls) -> model.EnumIterator: ...
    @classmethod
    def from_str(cls, data: typing.Any) -> LogLevel: ...

@typing.final
class QueueCondition(enum.Enum):
    SLOW = ...
    BACKLOGGED = ...

    def __hash__(self) -> int: ...

@typing.final
class QueueState(enum.Enum):
    TRIGGERED = ...
    CLEARED = ...

    def __hash__(self) -> int: ...

@typing.final
class SerializationEncoding(enum.Enum):
    JSON = ...
    MSG_PACK = ...
    CAPNP = ...
    SBE = ...

    def __hash__(self) -> int: ...

@typing.final
class SocketState(enum.Enum):
    CONNECTED = ...
    DISCONNECTED = ...

    def __hash__(self) -> int: ...

@typing.final
class SystemChannel(enum.Enum):
    TIME_EVENTS = ...
    EXEC_EVENTS = ...
    EXEC_COMMANDS = ...
    DATA_EVENTS = ...
    DATA_COMMANDS = ...

    def __hash__(self) -> int: ...

def get_exchange_rate(
    from_currency: str,
    to_currency: str,
    price_type: model.PriceType,
    quotes_bid: typing.Mapping[str, float],
    quotes_ask: typing.Mapping[str, float],
) -> decimal.Decimal | None: ...
def init_logging(
    trader_id: model.TraderId,
    instance_id: core.UUID4,
    level_stdout: LogLevel,
    level_file: LogLevel | None = None,
    component_levels: typing.Mapping[str, str] | None = None,
    directory: str | None = None,
    file_name: str | None = None,
    file_format: str | None = None,
    file_rotate: tuple[int, int] | None = None,
    is_colored: bool | None = None,
    is_bypassed: bool | None = None,
    print_config: bool | None = None,
    log_components_only: bool | None = None,
    fileout_sync_on_flush: bool | None = None,
    buffered_stdout: bool | None = None,
) -> LogGuard: ...
def init_tracing() -> None: ...
def log_header(
    trader_id: model.TraderId, machine_id: str, instance_id: core.UUID4, component: str
) -> None: ...
def log_sysinfo(component: str) -> None: ...
def logger_flush() -> None: ...
def logger_log(level: LogLevel, color: LogColor, component: str, message: str) -> None: ...
def logging_clock_set_realtime_mode() -> None: ...
def logging_clock_set_static_mode() -> None: ...
def logging_clock_set_static_time(time_ns: int) -> None: ...
def logging_sync_to_disk() -> bool: ...
def tracing_is_initialized() -> bool: ...
