Skip to content

Trading

Loren1166 edited this page Sep 26, 2024 · 3 revisions

Trading 交易

The trading subpackage groups all trading domain specific components and tooling.
交易子包将所有特定于交易领域的组件和工具分组在一起。

This is a top-level package where the majority of users will interface with the framework. Custom trading strategies can be implemented by inheriting from the Strategy base class.
这是一个顶级包,大多数用户将通过它与框架进行交互。自定义交易策略可以通过继承策略基类来实现。

class Controller 控制器

class Controller(Actor):
    """
    The base class for all trader controllers. 
    所有交易者控制器的基类。

    Parameters:
        trader (Trader) – The reference to the trader instance to control. 
        trader (Trader) - 要控制的交易者实例的引用。
        config (ActorConfig , optional) – The configuration for the controller 
        config (ActorConfig,可选) - 控制器的配置
    Raises:
        TypeError – If config is not of type ActorConfig. 
        TypeError - 如果 config 的类型不是 ActorConfig。
    """

    def create_actor(self, actor: "Actor", start: bool = True) -> None:
        """
        Add the given actor to the controlled trader. 
        将给定的 actor 添加到受控交易者。

        Parameters:
            actor (Actor) – The actor to add. 
            actor (Actor) - 要添加的 actor。
            start (bool , default True) – If the actor should be started immediately. 
            start (bool,默认 True) - 如果 actor 应立即启动。
        Raises:
            ValueError – If actor.state is RUNNING or DISPOSED. 
            ValueError - 如果 actor.state 为 RUNNING 或 DISPOSED。
            RuntimeError – If actor is already registered with the trader. 
            RuntimeError - 如果 actor 已在交易者处注册。
        """
        ...

    def create_strategy(self, strategy: "Strategy", start: bool = True) -> None:
        """
        Add the given strategy to the controlled trader. 
        将给定的策略添加到受控交易者。

        Parameters:
            strategy (Strategy) – The strategy to add. 
            strategy (Strategy) - 要添加的策略。
            start (bool , default True) – If the strategy should be started immediately. 
            start (bool,默认 True) - 如果策略应立即启动。
        Raises:
            ValueError – If strategy.state is RUNNING or DISPOSED. 
            ValueError - 如果 strategy.state 为 RUNNING 或 DISPOSED。
            RuntimeError – If strategy is already registered with the trader. 
            RuntimeError - 如果策略已在交易者处注册。
        """
        ...

    def start_actor(self, actor: "Actor") -> None:
        """
        Start the given actor. 
        启动给定的 actor。

        Will log a warning if the actor is already RUNNING. 
        如果 actor 已经在运行,将记录一条警告。

        Raises:
            ValueError – If actor is not already registered with the trader. 
            ValueError - 如果 actor 尚未在交易者处注册。
        """
        ...

    def start_strategy(self, strategy: "Strategy") -> None:
        """
        Start the given strategy. 
        启动给定的策略。

        Will log a warning if the strategy is already RUNNING. 
        如果策略已经在运行,将记录一条警告。

        Raises:
            ValueError – If strategy is not already registered with the trader. 
            ValueError - 如果策略尚未在交易者处注册。
        """
        ...

    def stop_actor(self, actor: "Actor") -> None:
        """
        Stop the given actor. 
        停止给定的 actor。

        Will log a warning if the actor is not RUNNING. 
        如果 actor 未在运行,将记录一条警告。

        Parameters:
            actor (Actor) – The actor to stop. 
            actor (Actor) - 要停止的 actor。
        Raises:
            ValueError – If actor is not already registered with the trader. 
            ValueError - 如果 actor 尚未在交易者处注册。
        """
        ...

    def stop_strategy(self, strategy: "Strategy") -> None:
        """
        Stop the given strategy. 
        停止给定的策略。

        Will log a warning if the strategy is not RUNNING. 
        如果策略未在运行,将记录一条警告。

        Parameters:
            strategy (Strategy) – The strategy to stop. 
            strategy (Strategy) - 要停止的策略。
        Raises:
            ValueError – If strategy is not already registered with the trader. 
            ValueError - 如果策略尚未在交易者处注册。
        """
        ...

    def remove_actor(self, actor: "Actor") -> None:
        """
        Remove the given actor. 
        移除给定的 actor。

        Will stop the actor first if state is RUNNING. 
        如果状态为 RUNNING,将首先停止 actor。

        Parameters:
            actor (Actor) – The actor to remove. 
            actor (Actor) - 要移除的 actor。
        Raises:
            ValueError – If actor is not already registered with the trader. 
            ValueError - 如果 actor 尚未在交易者处注册。
        """
        ...

    def remove_strategy(self, strategy: "Strategy") -> None:
        """
        Remove the given strategy. 
        移除给定的策略。

        Will stop the strategy first if state is RUNNING. 
        如果状态为 RUNNING,将首先停止策略。

        Parameters:
            strategy (Strategy) – The strategy to remove. 
            strategy (Strategy) - 要移除的策略。
        Raises:
            ValueError – If strategy is not already registered with the trader. 
            ValueError - 如果策略尚未在交易者处注册。
        """
        ...

class Strategy 策略

class Strategy(Actor):
    """
    Strategy(config: StrategyConfig | None = None)

    The base class for all trading strategies. 
    所有交易策略的基类。

    This class allows traders to implement their own customized trading strategies. A trading strategy can configure its own order management system type, which determines how positions are handled by the ExecutionEngine. 
    此类允许交易者实现自己的自定义交易策略。交易策略可以配置自己的订单管理系统类型,该类型决定了 ExecutionEngine 如何处理头寸。

    Strategy OMS (Order Management System) types: : 
    策略 OMS(订单管理系统)类型::
     - UNSPECIFIED: No specific type has been configured, will therefore default to the native OMS type for each venue. 

    HEDGING: A position ID will be assigned for each new position which is opened per instrument. 
    HEDGING:每个金融工具的每个新开仓头寸都将分配一个头寸 ID。
    NETTING: There will only be a single position for the strategy per instrument. The position ID naming convention is {instrument_id}-{strategy_id}. 
    NETTING:每个金融工具的每个策略只有一个头寸。头寸 ID 的命名约定为 {instrument_id}-{strategy_id}。
    Parameters:
        config (StrategyConfig , optional) – The trading strategy configuration. 
        config (StrategyConfig,可选) - 交易策略配置。
    Raises:
        TypeError – If config is not of type StrategyConfig. 
        TypeError - 如果 config 的类型不是 StrategyConfig。
    WARNING
        This class should not be used directly, but through a concrete subclass. 
        此类不应直接使用,而应通过具体的子类使用。
        Do not call components such as clock and logger in the __init__ prior to registration. 
        在注册之前,不要在 __init__ 中调用时钟和日志记录器等组件。
    """

    def cancel_all_orders(
        self,
        instrument_id: "InstrumentId",
        order_side: "OrderSide" = OrderSide.NO_ORDER_SIDE,
        client_id: "ClientId" = None,
    ) -> None:
        """
        Cancel all orders for this strategy for the given instrument ID. 
        取消此策略针对给定金融工具 ID 的所有订单。

        A CancelAllOrders command will be created and then sent to both the OrderEmulator and the ExecutionEngine. 
        将创建一个 CancelAllOrders 命令,然后将其发送到 OrderEmulator 和 ExecutionEngine。

        Parameters:
            instrument_id (InstrumentId) – The instrument for the orders to cancel. 
            instrument_id (InstrumentId) - 要取消订单的金融工具。
            order_side (OrderSide, default NO_ORDER_SIDE (both sides)) – The side of the orders to cancel. 
            order_side (OrderSide,默认 NO_ORDER_SIDE(双边)) - 要取消订单的方向。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID. 
            client_id (ClientId,可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
        """
        ...

    def cancel_gtd_expiry(self, order: "Order") -> None:
        """
        Cancel the managed GTD expiry for the given order. 
        取消给定订单的托管 GTD 到期。

        If there is no current GTD expiry timer, then an error will be logged. 
        如果没有当前的 GTD 到期计时器,则会记录一个错误。

        Parameters:
            order (Order) – The order to cancel the GTD expiry for. 
            order (Order) - 要取消 GTD 到期的订单。
        """
        ...

    def cancel_order(self, order: "Order", client_id: "ClientId" = None) -> None:
        """
        Cancel the given order with optional routing instructions. 
        取消给定订单,并使用可选的路由指令。

        A CancelOrder command will be created and then sent to either the OrderEmulator or the ExecutionEngine (depending on whether the order is emulated). 
        将创建一个 CancelOrder 命令,然后将其发送到 OrderEmulator 或 ExecutionEngine(取决于订单是否被模拟)。

        Parameters:
            order (Order) – The order to cancel. 
            order (Order) - 要取消的订单。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID. 
            client_id (ClientId,可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
        """
        ...

    def cancel_orders(self, orders: list, client_id: "ClientId" = None) -> None:
        """
        Batch cancel the given list of orders with optional routing instructions. 
        批量取消给定的订单列表,并使用可选的路由指令。

        For each order in the list, a CancelOrder command will be created and added to a BatchCancelOrders command. This command is then sent to the ExecutionEngine. 
        对于列表中的每个订单,将创建一个 CancelOrder 命令并将其添加到 BatchCancelOrders 命令中。然后将此命令发送到 ExecutionEngine。

        Logs an error if the orders list contains local/emulated orders. 
        如果 orders 列表包含本地/模拟订单,则会记录一个错误。

        Parameters:
            orders (list [Order ]) – The orders to cancel. 
            orders (list [Order ]) - 要取消的订单。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID. 
            client_id (ClientId,可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
        Raises:
            ValueError – If orders is empty. 
            ValueError - 如果 orders 为空。
            TypeError – If orders contains a type other than Order. 
            TypeError - 如果 orders 包含 Order 以外的类型。
        """
        ...

    def change_id(self, strategy_id: "StrategyId") -> None:
        """
        Change the strategies identifier to the given strategy_id. 
        将策略标识符更改为给定的 strategy_id。

        Parameters:
            strategy_id (StrategyId) – The new strategy ID to change to. 
            strategy_id (StrategyId) - 要更改为的新策略 ID。
        """
        ...

    def change_order_id_tag(self, order_id_tag: str) -> None:
        """
        Change the order identifier tag to the given order_id_tag. 
        将订单标识符标签更改为给定的 order_id_tag。

        Parameters:
            order_id_tag (str) – The new order ID tag to change to. 
            order_id_tag (str) - 要更改为的新订单 ID 标签。
        """
        ...

    def close_all_positions(
        self,
        instrument_id: "InstrumentId",
        position_side: "PositionSide" = PositionSide.NO_POSITION_SIDE,
        client_id: "ClientId" = None,
        tags: list = None,
    ) -> None:
        """
        Close all positions for the given instrument ID for this strategy. 
        平仓此策略针对给定金融工具 ID 的所有头寸。

        Parameters:
            instrument_id (InstrumentId) – The instrument for the positions to close. 
            instrument_id (InstrumentId) - 要平仓头寸的金融工具。
            position_side (PositionSide, default NO_POSITION_SIDE (both sides)) – The side of the positions to close. 
            position_side (PositionSide,默认 NO_POSITION_SIDE(双边)) - 要平仓头寸的方向。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID. 
            client_id (ClientId,可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
            tags (list *[*str ] , optional) – The tags for the market orders closing the positions. 
            tags (list *[*str ],可选) - 平仓头寸的市价单的标签。
        """
        ...

    def close_position(self, position: "Position", client_id: "ClientId" = None, tags: list = None) -> None:
        """
        Close the given position. 
        平仓给定的头寸。

        A closing MarketOrder for the position will be created, and then sent to the ExecutionEngine via a SubmitOrder command. 
        将为该头寸创建一个平仓市价单,然后通过 SubmitOrder 命令将其发送到 ExecutionEngine。

        Parameters:
            position (Position) – The position to close. 
            position (Position) - 要平仓的头寸。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID. 
            client_id (ClientId,可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
            tags (list *[*str ] , optional) – The tags for the market order closing the position. 
            tags (list *[*str ],可选) - 平仓头寸的市价单的标签。
        """
        ...

    @property
    def external_order_claims(self) -> list["InstrumentId"]:
        """
        The external order claims instrument IDs for the strategy. 
        策略的外部订单声明金融工具 ID。

        Returns:
            list[InstrumentId]
        """
        ...

    def handle_event(self, event: "Event") -> None:
        """
        Handle the given event. 
        处理给定的事件。

        If state is RUNNING then passes to on_event. 
        如果状态为 RUNNING,则传递给 on_event。

        Parameters:
            event (Event) – The event received. 
            event (Event) - 收到的事件。
        WARNING
            System method (not intended to be called by user code). 
            系统方法(不打算由用户代码调用)。
        """
        ...

    @property
    def manage_contingent_orders(self) -> bool:
        """
        If contingent orders should be managed automatically by the strategy. 
        如果策略应自动管理条件单。

        Returns:
            bool
        """
        ...

    @property
    def manage_gtd_expiry(self) -> bool:
        """
        If all order GTD time in force expirations should be managed automatically by the strategy. 
        如果策略应自动管理所有订单的 GTD 有效时间到期。

        Returns:
            bool
        """
        ...

    def modify_order(
        self,
        order: "Order",
        quantity: "Quantity" = None,
        price: "Price" = None,
        trigger_price: "Price" = None,
        client_id: "ClientId" = None,
    ) -> None:
        """
        Modify the given order with optional parameters and routing instructions. 
        修改给定的订单,并使用可选的参数和路由指令。

        An ModifyOrder command will be created and then sent to either the OrderEmulator or the RiskEngine (depending on whether the order is emulated). 
        将创建一个 ModifyOrder 命令,然后将其发送到 OrderEmulator 或 RiskEngine(取决于订单是否被模拟)。

        At least one value must differ from the original order for the command to be valid. 
        至少有一个值必须与原始订单不同,命令才有效。

        Will use an Order Cancel/Replace Request (a.k.a Order Modification) for FIX protocols, otherwise if order update is not available for the API, then will cancel and replace with a new order using the original ClientOrderId. 
        将对 FIX 协议使用订单取消/替换请求(也称为订单修改),否则,如果 API 不支持订单更新,则将使用原始 ClientOrderId 取消并替换为新订单。

        Parameters:
            order (Order) – The order to update. 
            order (Order) - 要更新的订单。
            quantity (Quantity , optional) – The updated quantity for the given order. 
            quantity (Quantity,可选) - 给定订单的更新数量。
            price (Price , optional) – The updated price for the given order (if applicable). 
            price (Price,可选) - 给定订单的更新价格(如果适用)。
            trigger_price (Price , optional) – The updated trigger price for the given order (if applicable). 
            trigger_price (Price,可选) - 给定订单的更新触发价格(如果适用)。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID. 
            client_id (ClientId,可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
        Raises:
            ValueError – If price is not None and order does not have a price. 
            ValueError - 如果 price 不为 None 且订单没有价格。
            ValueError – If trigger is not None and order does not have a trigger_price. 
            ValueError - 如果 trigger 不为 None 且订单没有 trigger_price。
        WARNING
            If the order is already closed or at PENDING_CANCEL status then the command will not be generated, and a warning will be logged. 
            如果订单已平仓或处于 PENDING_CANCEL 状态,则不会生成命令,并将记录一条警告。
        """
        ...

    @property
    def oms_type(self) -> "OmsType":
        """
        The order management system for the strategy. 
        策略的订单管理系统。

        Returns:
            OmsType
        """
        ...

    def on_order_accepted(self, event: "OrderAccepted") -> None:
        """
        Actions to be performed when running and receives an order accepted event. 
        运行并收到订单接受事件时要执行的操作。

        Parameters:
            event (OrderAccepted) – The event received. 
            event (OrderAccepted) - 收到的事件。
        WARNING
            System method (not intended to be called by user code). 
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_order_cancel_rejected(self, event: "OrderCancelRejected") -> None:
        """
        Actions to be performed when running and receives an order cancel rejected event. 
        运行并收到订单取消拒绝事件时要执行的操作。

        Parameters:
            event (OrderCancelRejected) – The event received. 
            event (OrderCancelRejected) - 收到的事件。
        WARNING
            System method (not intended to be called by user code). 
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_order_canceled(self, event: "OrderCanceled") -> None:
        """
        Actions to be performed when running and receives an order canceled event. 
        运行并收到订单取消事件时要执行的操作。

        Parameters:
            event (OrderCanceled) – The event received. 
            event (OrderCanceled) - 收到的事件。
        WARNING
            System method (not intended to be called by user code). 
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_order_denied(self, event: "OrderDenied") -> None:
        """
        Actions to be performed when running and receives an order denied event. 
        运行并收到订单拒绝事件时要执行的操作。

        Parameters:
            event (OrderDenied) – The event received. 
            event (OrderDenied) - 收到的事件。
        WARNING
            System method (not intended to be called by user code). 
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_order_emulated(self, event: "OrderEmulated") -> None:
        """
        Actions to be performed when running and receives an order initialized event. 
        运行并收到订单初始化事件时要执行的操作。

        Parameters:
            event (OrderEmulated) – The event received. 
            event (OrderEmulated) - 收到的事件。
        WARNING
            System method (not intended to be called by user code). 
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_order_event(self, event: "OrderEvent") -> None:
        """
        Actions to be performed when running and receives an order event. 
        运行并收到订单事件时要执行的操作。

        Parameters:
            event (OrderEvent) – The event received. 
            event (OrderEvent) - 收到的事件。
        WARNING
            System method (not intended to be called by user code). 
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_order_expired(self, event: "OrderExpired") -> None:
        """
        Actions to be performed when running and receives an order expired event. 
        运行并收到订单过期事件时要执行的操作。

        Parameters:
            event (OrderExpired) – The event received. 
            event (OrderExpired) - 收到的事件。
        WARNING
            System method (not intended to be called by user code). 
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_order_filled(self, event: "OrderFilled") -> None:
        """
        Actions to be performed when running and receives an order filled event. 
        运行并收到订单成交事件时要执行的操作。

        Parameters:
            event (OrderFilled) – The event received. 
            event (OrderFilled) - 收到的事件。
        WARNING
            System method (not intended to be called by user code). 
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_order_initialized(self, event: "OrderInitialized") -> None:
        """
        Actions to be performed when running and receives an order initialized event. 
        运行并收到订单初始化事件时要执行的操作。

        Parameters:
            event (OrderInitialized) – The event received. 
            event (OrderInitialized) - 收到的事件。
        WARNING
            System method (not intended to be called by user code). 
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_order_modify_rejected(self, event: "OrderModifyRejected") -> None:
        """
        Actions to be performed when running and receives an order modify rejected event. 
        运行并收到订单修改拒绝事件时要执行的操作。

        Parameters:
            event (OrderModifyRejected) – The event received. 
            event (OrderModifyRejected) - 收到的事件。
        WARNING
            System method (not intended to be called by user code). 
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_order_pending_cancel(self, event: "OrderPendingCancel") -> None:
        """
        Actions to be performed when running and receives an order pending cancel event. 
        运行并收到订单待取消事件时要执行的操作。

        Parameters:
            event (OrderPendingCancel) – The event received. 
            event (OrderPendingCancel) - 收到的事件。
        WARNING
            System method (not intended to be called by user code). 
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_order_pending_update(self, event: "OrderPendingUpdate") -> None:
        """
        Actions to be performed when running and receives an order pending update event. 
        运行并收到订单待更新事件时要执行的操作。

        Parameters:
            event (OrderPendingUpdate) – The event received. 
            event (OrderPendingUpdate) - 收到的事件。
        WARNING
            System method (not intended to be called by user code). 
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_order_rejected(self, event: "OrderRejected") -> None:
        """
        Actions to be performed when running and receives an order rejected event. 
        运行并收到订单拒绝事件时要执行的操作。

        Parameters:
            event (OrderRejected) – The event received. 
            event (OrderRejected) - 收到的事件。
        WARNING
            System method (not intended to be called by user code). 
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_order_released(self, event: "OrderReleased") -> None:
        """
        Actions to be performed when running and receives an order released event. 
        运行并收到订单释放事件时要执行的操作。

        Parameters:
            event (OrderReleased) – The event received. 
            event (OrderReleased) - 收到的事件。
        WARNING
            System method (not intended to be called by user code). 
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_order_submitted(self, event: "OrderSubmitted") -> None:
        """
        Actions to be performed when running and receives an order submitted event. 
        运行并收到订单提交事件时要执行的操作。

        Parameters:
            event (OrderSubmitted) – The event received. 
            event (OrderSubmitted) - 收到的事件。
        WARNING
            System method (not intended to be called by user code). 
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_order_triggered(self, event: "OrderTriggered") -> None:
        """
        Actions to be performed when running and receives an order triggered event. 
        运行并收到订单触发事件时要执行的操作。

        Parameters:
            event (OrderTriggered) – The event received. 
            event (OrderTriggered) - 收到的事件。
        WARNING
            System method (not intended to be called by user code). 
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_order_updated(self, event: "OrderUpdated") -> None:
        """
        Actions to be performed when running and receives an order updated event. 
        运行并收到订单更新事件时要执行的操作。

        Parameters:
            event (OrderUpdated) – The event received. 
            event (OrderUpdated) - 收到的事件。
        WARNING
            System method (not intended to be called by user code). 
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_position_changed(self, event: "PositionChanged") -> None:
        """
        Actions to be performed when running and receives a position changed event. 
        运行并收到头寸更改事件时要执行的操作。

        Parameters:
            event (PositionChanged) – The event received. 
            event (PositionChanged) - 收到的事件。
        WARNING
            System method (not intended to be called by user code). 
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_position_closed(self, event: "PositionClosed") -> None:
        """
        Actions to be performed when running and receives a position closed event. 
        运行并收到头寸平仓事件时要执行的操作。

        Parameters:
            event (PositionClosed) – The event received. 
            event (PositionClosed) - 收到的事件。
        WARNING
            System method (not intended to be called by user code). 
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_position_event(self, event: "PositionEvent") -> None:
        """
        Actions to be performed when running and receives a position event. 
        运行并收到头寸事件时要执行的操作。

        Parameters:
            event (PositionEvent) – The event received. 
            event (PositionEvent) - 收到的事件。
        WARNING
            System method (not intended to be called by user code). 
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_position_opened(self, event: "PositionOpened") -> None:
        """
        Actions to be performed when running and receives a position opened event. 
        运行并收到头寸开仓事件时要执行的操作。

        Parameters:
            event (PositionOpened) – The event received. 
            event (PositionOpened) - 收到的事件。
        WARNING
            System method (not intended to be called by user code). 
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_reset(self) -> None:
        ...

    def on_resume(self) -> None:
        ...

    def on_start(self) -> None:
        ...

    def on_stop(self) -> None:
        ...

    @property
    def order_factory(self) -> "OrderFactory":
        """
        The order factory for the strategy. 
        策略的订单工厂。

        Returns:
            OrderFactory
        """
        ...

    @property
    def order_id_tag(self) -> str:
        """
        The order ID tag for the strategy. 
        策略的订单 ID 标签。

        Returns:
            str
        """
        ...

    def query_order(self, order: "Order", client_id: "ClientId" = None) -> None:
        """
        Query the given order with optional routing instructions. 
        查询给定的订单,并使用可选的路由指令。

        A QueryOrder command will be created and then sent to the ExecutionEngine. 
        将创建一个 QueryOrder 命令,然后将其发送到 ExecutionEngine。

        Logs an error if no VenueOrderId has been assigned to the order. 
        如果订单没有分配 VenueOrderId,则会记录一个错误。

        Parameters:
            order (Order) – The order to query. 
            order (Order) - 要查询的订单。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID. 
            client_id (ClientId,可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
        """
        ...

    def register(
        self,
        trader_id: "TraderId",
        portfolio: "PortfolioFacade",
        msgbus: "MessageBus",
        cache: "CacheFacade",
        clock: "Clock",
    ) -> None:
        """
        Register the strategy with a trader. 
        将策略注册到交易者。

        Parameters:
            trader_id (TraderId) – The trader ID for the strategy. 
            trader_id (TraderId) - 策略的交易者 ID。
            portfolio (PortfolioFacade) – The read-only portfolio for the strategy. 
            portfolio (PortfolioFacade) - 策略的只读投资组合。
            msgbus (MessageBus) – The message bus for the strategy. 
            msgbus (MessageBus) - 策略的消息总线。
            cache (CacheFacade) – The read-only cache for the strategy. 
            cache (CacheFacade) - 策略的只读缓存。
            clock (Clock) – The clock for the strategy. 
            clock (Clock) - 策略的时钟。
        WARNING
            System method (not intended to be called by user code). 
            系统方法(不打算由用户代码调用)。
        """
        ...

    def submit_order(
        self,
        order: "Order",
        position_id: "PositionId" = None,
        client_id: "ClientId" = None,
    ) -> None:
        """
        Submit the given order with optional position ID, execution algorithm and routing instructions. 
        提交给定订单,并使用可选的头寸 ID、执行算法和路由指令。

        A SubmitOrder command will be created and sent to either an ExecAlgorithm, the OrderEmulator or the RiskEngine (depending whether the order is emulated and/or has an exec_algorithm_id specified). 
        将创建一个 SubmitOrder 命令,并将其发送到 ExecAlgorithm、OrderEmulator 或 RiskEngine(取决于订单是否被模拟和/或是否指定了 exec_algorithm_id)。

        If the client order ID is duplicate, then the order will be denied. 
        如果客户端订单 ID 重复,则订单将被拒绝。

        Parameters:
            order (Order) – The order to submit. 
            order (Order) - 要提交的订单。
            position_id (PositionId , optional) – The position ID to submit the order against. If a position does not yet exist, then any position opened will have this identifier assigned. 
            position_id (PositionId,可选) - 要提交订单的头寸 ID。如果头寸尚不存在,则任何开仓的头寸都将分配此标识符。
            client_id (ClientId , optional) – The specific execution client ID for the command. If None then will be inferred from the venue in the instrument ID. 
            client_id (ClientId,可选) - 命令的特定执行客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
        Raises:
            ValueError – If order.status is not INITIALIZED. 
            ValueError - 如果 order.status 不为 INITIALIZED。
        WARNING
            If a position_id is passed and a position does not yet exist, then any position opened by the order will have this position ID assigned. This may not be what you intended. 
                       如果传递了 position_id 并且头寸尚不存在,则该订单开仓的任何头寸都将分配此头寸 ID。这可能不是您想要的。
        """
        ...

    def submit_order_list(
        self,
        order_list: "OrderList",
        position_id: "PositionId" = None,
        client_id: "ClientId" = None,
    ) -> None:
        """
        Submit the given order list with optional position ID, execution algorithm and routing instructions. 
        提交给定的订单列表,并使用可选的头寸 ID、执行算法和路由指令。

        A SubmitOrderList command with be created and sent to either the OrderEmulator, or the RiskEngine (depending whether an order is emulated). 
        将创建一个 SubmitOrderList 命令,并将其发送到 OrderEmulator 或 RiskEngine(取决于订单是否被模拟)。

        If the order list ID is duplicate, or any client order ID is duplicate, then all orders will be denied. 
        如果订单列表 ID 重复或任何客户端订单 ID 重复,则所有订单都将被拒绝。

        Parameters:
            order_list (OrderList) – The order list to submit. 
            order_list (OrderList) - 要提交的订单列表。
            position_id (PositionId , optional) – The position ID to submit the order against. If a position does not yet exist, then any position opened will have this identifier assigned. 
            position_id (PositionId,可选) - 要提交订单的头寸 ID。如果头寸尚不存在,则任何开仓的头寸都将分配此标识符。
            client_id (ClientId , optional) – The specific execution client ID for the command. If None then will be inferred from the venue in the instrument ID. 
            client_id (ClientId,可选) - 命令的特定执行客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
        Raises:
            ValueError – If any order.status is not INITIALIZED. 
            ValueError - 如果任何 order.status 不为 INITIALIZED。
        WARNING
            If a position_id is passed and a position does not yet exist, then any position opened by an order will have this position ID assigned. This may not be what you intended. 
            如果传递了 position_id 并且头寸尚不存在,则任何订单开仓的头寸都将分配此头寸 ID。这可能不是您想要的。
        """
        ...

    def to_importable_config(self) -> "ImportableStrategyConfig":
        """
        Returns an importable configuration for this strategy. 
        返回此策略的可导入配置。

        Return type:
            ImportableStrategyConfig
        """
        ...

class Trader 交易者

Provides a trader for managing a fleet of actors, execution algorithms and trading strategies.
提供一个交易者,用于管理一组 actors、执行算法和交易策略。

Parameters: trader_id (TraderId) – The ID for the trader.
trader_id (TraderId) - 交易者的 ID。 instance_id (UUID4) – The instance ID for the trader.
instance_id (UUID4) - 交易者的实例 ID。 msgbus (MessageBus) – The message bus for the trader.
msgbus (MessageBus) - 交易者的消息总线。 cache (Cache) – The cache for the trader.
cache (Cache) - 交易者的缓存。 portfolio (Portfolio) – The portfolio for the trader.
portfolio (Portfolio) - 交易者的投资组合。 data_engine (DataEngine) – The data engine for the trader.
data_engine (DataEngine) - 交易者的数据引擎。 risk_engine (RiskEngine) – The risk engine for the trader.
risk_engine (RiskEngine) - 交易者的风险引擎。 exec_engine (ExecutionEngine) – The execution engine for the trader.
exec_engine (ExecutionEngine) - 交易者的执行引擎。 clock (Clock) – The clock for the trader.
clock (Clock) - 交易者的时钟。 has_controller (bool , default False) – If the trader has a controller.
has_controller (bool,默认 False) - 交易者是否具有控制器。 loop (asyncio.AbstractEventLoop , optional) – The event loop for the trader.
loop (asyncio.AbstractEventLoop,可选) - 交易者的事件循环。 Raises: ValueError – If portfolio is not equal to the exec_engine portfolio.
ValueError - 如果 portfolio 不等于 exec_engine 的 portfolio。 ValueError – If strategies is None.
ValueError - 如果 strategies 为 None。 ValueError – If strategies is empty.
ValueError - 如果 strategies 为空。 TypeError – If strategies contains a type other than Strategy.
TypeError - 如果 strategies 包含 Strategy 以外的类型。

class Trader(Component):
    """
    Provides a trader for managing a fleet of actors, execution algorithms and trading strategies.

    提供一个交易者,用于管理一组 actors、执行算法和交易策略。

    Parameters:
        trader_id (TraderId) – The ID for the trader.
        trader_id (TraderId) - 交易者的 ID。
        instance_id (UUID4) – The instance ID for the trader.
        instance_id (UUID4) - 交易者的实例 ID。
        msgbus (MessageBus) – The message bus for the trader.
        msgbus (MessageBus) - 交易者的消息总线。
        cache (Cache) – The cache for the trader.
        cache (Cache) - 交易者的缓存。
        portfolio (Portfolio) – The portfolio for the trader.
        portfolio (Portfolio) - 交易者的投资组合。
        data_engine (DataEngine) – The data engine for the trader.
        data_engine (DataEngine) - 交易者的数据引擎。
        risk_engine (RiskEngine) – The risk engine for the trader.
        risk_engine (RiskEngine) - 交易者的风险引擎。
        exec_engine (ExecutionEngine) – The execution engine for the trader.
        exec_engine (ExecutionEngine) - 交易者的执行引擎。
        clock (Clock) – The clock for the trader.
        clock (Clock) - 交易者的时钟。
        has_controller (bool , default False) – If the trader has a controller.
        has_controller (bool,默认 False) - 交易者是否具有控制器。
        loop (asyncio.AbstractEventLoop , optional) – The event loop for the trader.
        loop (asyncio.AbstractEventLoop,可选) - 交易者的事件循环。
    Raises:
        ValueError – If portfolio is not equal to the exec_engine portfolio.
        ValueError - 如果 portfolio 不等于 exec_engine 的 portfolio。
        ValueError – If strategies is None.
        ValueError - 如果 strategies 为 None。
        ValueError – If strategies is empty.
        ValueError - 如果 strategies 为空。
        TypeError – If strategies contains a type other than Strategy.
        TypeError - 如果 strategies 包含 Strategy 以外的类型。
    """

    @property
    def instance_id(self) -> "UUID4":
        """
        Return the traders instance ID.
        返回交易者的实例 ID。

        Return type:
            UUID4
        """
        ...

    def actors(self) -> list["Actor"]:
        """
        Return the actors loaded in the trader.
        返回加载到交易者中的 actors。

        Return type:
            list[Actor]
        """
        ...

    def strategies(self) -> list["Strategy"]:
        """
        Return the strategies loaded in the trader.
        返回加载到交易者中的策略。

        Return type:
            list[Strategy]
        """
        ...

    def exec_algorithms(self) -> list:
        """
        Return the execution algorithms loaded in the trader.
        返回加载到交易者中的执行算法。

        Return type:
            list[ExecAlgorithms]
        """
        ...

    def actor_ids(self) -> list["ComponentId"]:
        """
        Return the actor IDs loaded in the trader.
        返回加载到交易者中的 actor ID。

        Return type:
            list[ComponentId]
        """
        ...

    def strategy_ids(self) -> list["StrategyId"]:
        """
        Return the strategy IDs loaded in the trader.
        返回加载到交易者中的策略 ID。

        Return type:
            list[StrategyId]
        """
        ...

    def exec_algorithm_ids(self) -> list["ExecAlgorithmId"]:
        """
        Return the execution algorithm IDs loaded in the trader.
        返回加载到交易者中的执行算法 ID。

        Return type:
            list[ExecAlgorithmId]
        """
        ...

    def actor_states(self) -> dict["ComponentId", str]:
        """
        Return the traders actor states.
        返回交易者的 actor 状态。

        Return type:
            dict[ComponentId, str]
        """
        ...

    def strategy_states(self) -> dict["StrategyId", str]:
        """
        Return the traders strategy states.
        返回交易者的策略状态。

        Return type:
            dict[StrategyId, str]
        """
        ...

    def exec_algorithm_states(self) -> dict["ExecAlgorithmId", str]:
        """
        Return the traders execution algorithm states.
        返回交易者的执行算法状态。

        Return type:
            dict[ExecAlgorithmId, str]
        """
        ...

    def add_actor(self, actor: "Actor") -> None:
        """
        Add the given custom component to the trader.
        将给定的自定义组件添加到交易者。

        Parameters:
            actor (Actor) – The actor to add and register.
            actor (Actor) - 要添加和注册的 actor。
        Raises:
            ValueError – If actor.state is RUNNING or DISPOSED.
            ValueError - 如果 actor.state 为 RUNNING 或 DISPOSED。
            RuntimeError – If actor.id already exists in the trader.
            RuntimeError - 如果 actor.id 已经存在于交易者中。
        """
        ...

    def add_actors(self, actors: list["Actor"]) -> None:
        """
        Add the given actors to the trader.
        将给定的 actors 添加到交易者。

        Parameters:
            actors (list *[*TradingStrategies ]) – The actors to add and register.
            actors (list *[*TradingStrategies ]) - 要添加和注册的 actors。
        Raises:
            ValueError – If actors is None or empty.
            ValueError - 如果 actors 为 None 或空。
        """
        ...

    def add_strategy(self, strategy: "Strategy") -> None:
        """
        Add the given trading strategy to the trader.
        将给定的交易策略添加到交易者。

        Parameters:
            strategy (Strategy) – The trading strategy to add and register.
            strategy (Strategy) - 要添加和注册的交易策略。
        Raises:
            ValueError – If strategy.state is RUNNING or DISPOSED.
            ValueError - 如果 strategy.state 为 RUNNING 或 DISPOSED。
            RuntimeError – If strategy.id already exists in the trader.
            RuntimeError - 如果 strategy.id 已经存在于交易者中。
        """
        ...

    def add_strategies(self, strategies: list["Strategy"]) -> None:
        """
        Add the given trading strategies to the trader.
        将给定的交易策略添加到交易者。

        Parameters:
            strategies (list *[*TradingStrategies ]) – The trading strategies to add and register.
            strategies (list *[*TradingStrategies ]) - 要添加和注册的交易策略。
        Raises:
            ValueError – If strategies is None or empty.
            ValueError - 如果 strategies 为 None 或空。
        """
        ...

    def add_exec_algorithm(self, exec_algorithm) -> None:
        """
        Add the given execution algorithm to the trader.
        将给定的执行算法添加到交易者。

        Parameters:
            exec_algorithm (ExecAlgorithm) – The execution algorithm to add and register.
            exec_algorithm (ExecAlgorithm) - 要添加和注册的执行算法。
        Raises:
            KeyError – If exec_algorithm.id already exists in the trader.
            KeyError - 如果 exec_algorithm.id 已经存在于交易者中。
            ValueError – If exec_algorithm.state is RUNNING or DISPOSED.
            ValueError - 如果 exec_algorithm.state 为 RUNNING 或 DISPOSED。
        """
        ...

    def add_exec_algorithms(self, exec_algorithms: list) -> None:
        """
        Add the given execution algorithms to the trader.
        将给定的执行算法添加到交易者。

        Parameters:
            exec_algorithms (list [ExecAlgorithm ]) – The execution algorithms to add and register.
            exec_algorithms (list [ExecAlgorithm ]) - 要添加和注册的执行算法。
        Raises:
            ValueError – If exec_algorithms is None or empty.
            ValueError - 如果 exec_algorithms 为 None 或空。
        """
        ...

    def start_actor(self, actor_id: "ComponentId") -> None:
        """
        Start the actor with the given actor_id.
        启动具有给定 actor_id 的 actor。

        Parameters:
            actor_id (ComponentId) – The component ID to start.
            actor_id (ComponentId) - 要启动的组件 ID。
        Raises:
            ValueError – If an actor with the given actor_id is not found.
            ValueError - 如果未找到具有给定 actor_id 的 actor。
        """
        ...

    def start_strategy(self, strategy_id: "StrategyId") -> None:
        """
        Start the strategy with the given strategy_id.
        启动具有给定 strategy_id 的策略。

        Parameters:
            strategy_id (StrategyId) – The strategy ID to start.
            strategy_id (StrategyId) - 要启动的策略 ID。
        Raises:
            ValueError – If a strategy with the given strategy_id is not found.
            ValueError - 如果未找到具有给定 strategy_id 的策略。
        """
        ...

    def stop_actor(self, actor_id: "ComponentId") -> None:
        """
        Stop the actor with the given actor_id.
        停止具有给定 actor_id 的 actor。

        Parameters:
            actor_id (ComponentId) – The actor ID to stop.
            actor_id (ComponentId) - 要停止的 actor ID。
        Raises:
            ValueError – If an actor with the given actor_id is not found.
            ValueError - 如果未找到具有给定 actor_id 的 actor。
        """
        ...

    def stop_strategy(self, strategy_id: "StrategyId") -> None:
        """
        Stop the strategy with the given strategy_id.
        停止具有给定 strategy_id 的策略。

        Parameters:
            strategy_id (StrategyId) – The strategy ID to stop.
            strategy_id (StrategyId) - 要停止的策略 ID。
        Raises:
            ValueError – If a strategy with the given strategy_id is not found.
            ValueError - 如果未找到具有给定 strategy_id 的策略。
        """
        ...

    def remove_actor(self, actor_id: "ComponentId") -> None:
        """
        Remove the actor with the given actor_id.
        移除具有给定 actor_id 的 actor。

        Will stop the actor first if state is RUNNING.
        如果状态为 RUNNING,将首先停止 actor。

        Parameters:
            actor_id (ComponentId) – The actor ID to remove.
            actor_id (ComponentId) - 要移除的 actor ID。
        Raises:
            ValueError – If an actor with the given actor_id is not found.
            ValueError - 如果未找到具有给定 actor_id 的 actor。
        """
        ...

    def remove_strategy(self, strategy_id: "StrategyId") -> None:
        """
        Remove the strategy with the given strategy_id.
        移除具有给定 strategy_id 的策略。

        Will stop the strategy first if state is RUNNING.
        如果状态为 RUNNING,将首先停止策略。

        Parameters:
            strategy_id (StrategyId) – The strategy ID to remove.
            strategy_id (StrategyId) - 要移除的策略 ID。
        Raises:
            ValueError – If a strategy with the given strategy_id is not found.
            ValueError - 如果未找到具有给定 strategy_id 的策略。
        """
        ...

    def clear_actors(self) -> None:
        """
        Dispose and clear all actors held by the trader.
        处置并清除交易者持有的所有 actors。

        Raises:
            ValueError – If state is RUNNING.
            ValueError - 如果状态为 RUNNING。
        """
        ...

    def clear_strategies(self) -> None:
        """
        Dispose and clear all strategies held by the trader.
        处置并清除交易者持有的所有策略。

        Raises:
            ValueError – If state is RUNNING.
            ValueError - 如果状态为 RUNNING。
        """
        ...

    def clear_exec_algorithms(self) -> None:
        """
        Dispose and clear all execution algorithms held by the trader.
        处置并清除交易者持有的所有执行算法。

        Raises:
            ValueError – If state is RUNNING.
            ValueError - 如果状态为 RUNNING。
        """
        ...

    def subscribe(self, topic: str, handler: "Callable[[Any], None]") -> None:
        """
        Subscribe to the given message topic with the given callback handler.
        使用给定的回调处理程序订阅给定的消息主题。

        Parameters:
            topic (str) – The topic for the subscription. May include wildcard glob patterns.
            topic (str) - 订阅的主题。可以包含通配符 glob 模式。
            handler (Callable [ *[*Any ] , None ]) – The handler for the subscription.
            handler (Callable [ *[*Any ] , None ]) - 订阅的处理程序。
        """
        ...

    def unsubscribe(self, topic: str, handler: "Callable[[Any], None]") -> None:
        """
        Unsubscribe the given handler from the given message topic.
        取消给定处理程序对给定消息主题的订阅。

        Parameters:
            topic (str , optional) – The topic to unsubscribe from. May include wildcard glob patterns.
            topic (str,可选) - 要取消订阅的主题。可以包含通配符 glob 模式。
            handler (Callable [ *[*Any ] , None ]) – The handler for the subscription.
            handler (Callable [ *[*Any ] , None ]) - 订阅的处理程序。
        """
        ...

    def save(self) -> None:
        """
        Save all actor and strategy states to the cache.
        将所有 actor 和策略状态保存到缓存中。
        """
        ...

    def load(self) -> None:
        """
        Load all actor and strategy states from the cache.
        从缓存中加载所有 actor 和策略状态。
        """
        ...

    def check_residuals(self) -> None:
        """
        Check for residual open state such as open orders or open positions.
        检查剩余的未平仓状态,例如未结订单或未平仓头寸。
        """
        ...

    def generate_orders_report(self) -> "DataFrame":
        """
        Generate an orders report.
        生成订单报告。

        Return type:
            pd.DataFrame
        """
        ...

    def generate_order_fills_report(self) -> "DataFrame":
        """
        Generate an order fills report.
        生成订单成交报告。

        Return type:
            pd.DataFrame
        """
        ...

    def generate_fills_report(self) -> "DataFrame":
        """
        Generate a fills report.
        生成成交报告。

        Return type:
            pd.DataFrame
        """
        ...

    def generate_positions_report(self) -> "DataFrame":
        """
        Generate a positions report.
        生成头寸报告。

        Return type:
            pd.DataFrame
        """
        ...

    def generate_account_report(self, venue: "Venue") -> "DataFrame":
        """
        Generate an account report.
        生成账户报告。

        Return type:
            pd.DataFrame
        """
        ...

class Controller 控制器

class Controller(Actor):
    """
    The base class for all trader controllers.
    所有交易者控制器的基类。

    Parameters:
        trader (Trader) – The reference to the trader instance to control.
        trader (Trader) - 要控制的交易者实例的引用。
        config (ActorConfig , optional) – The configuration for the controller
        config (ActorConfig, 可选) - 控制器的配置
    Raises:
        TypeError – If config is not of type ActorConfig.
        TypeError - 如果 config 的类型不是 ActorConfig。
    """

    def create_actor(self, actor: "Actor", start: bool = True) -> None:
        """
        Add the given actor to the controlled trader.
        将给定的 actor 添加到受控交易者。

        Parameters:
            actor (Actor) – The actor to add.
            actor (Actor) - 要添加的 actor。
            start (bool , default True) – If the actor should be started immediately.
            start (bool, 默认 True) - 如果 actor 应立即启动。
        Raises:
            ValueError – If actor.state is RUNNING or DISPOSED.
            ValueError - 如果 actor.state 为 RUNNING 或 DISPOSED。
            RuntimeError – If actor is already registered with the trader.
            RuntimeError - 如果 actor 已在交易者处注册。
        """
        ...

    def create_strategy(self, strategy: "Strategy", start: bool = True) -> None:
        """
        Add the given strategy to the controlled trader.
        将给定的策略添加到受控交易者。

        Parameters:
            strategy (Strategy) – The strategy to add.
            strategy (Strategy) - 要添加的策略。
            start (bool , default True) – If the strategy should be started immediately.
            start (bool, 默认 True) - 如果策略应立即启动。
        Raises:
            ValueError – If strategy.state is RUNNING or DISPOSED.
            ValueError - 如果 strategy.state 为 RUNNING 或 DISPOSED。
            RuntimeError – If strategy is already registered with the trader.
            RuntimeError - 如果策略已在交易者处注册。
        """
        ...

    def start_actor(self, actor: "Actor") -> None:
        """
        Start the given actor.
        启动给定的 actor。

        Will log a warning if the actor is already RUNNING.
        如果 actor 已经在运行,将记录一条警告。

        Raises:
            ValueError – If actor is not already registered with the trader.
            ValueError - 如果 actor 尚未在交易者处注册。
        """
        ...

    def start_strategy(self, strategy: "Strategy") -> None:
        """
        Start the given strategy.
        启动给定的策略。

        Will log a warning if the strategy is already RUNNING.
        如果策略已经在运行,将记录一条警告。

        Raises:
            ValueError – If strategy is not already registered with the trader.
            ValueError - 如果策略尚未在交易者处注册。
        """
        ...

    def stop_actor(self, actor: "Actor") -> None:
        """
        Stop the given actor.
        停止给定的 actor。

        Will log a warning if the actor is not RUNNING.
        如果 actor 未在运行,将记录一条警告。

        Parameters:
            actor (Actor) – The actor to stop.
            actor (Actor) - 要停止的 actor。
        Raises:
            ValueError – If actor is not already registered with the trader.
            ValueError - 如果 actor 尚未在交易者处注册。
        """
        ...

    def stop_strategy(self, strategy: "Strategy") -> None:
        """
        Stop the given strategy.
        停止给定的策略。

        Will log a warning if the strategy is not RUNNING.
        如果策略未在运行,将记录一条警告。

        Parameters:
            strategy (Strategy) – The strategy to stop.
            strategy (Strategy) - 要停止的策略。
        Raises:
            ValueError – If strategy is not already registered with the trader.
            ValueError - 如果策略尚未在交易者处注册。
        """
        ...

    def remove_actor(self, actor: "Actor") -> None:
        """
        Remove the given actor.
        移除给定的 actor。

        Will stop the actor first if state is RUNNING.
        如果状态为 RUNNING,将首先停止 actor。

        Parameters:
            actor (Actor) – The actor to remove.
            actor (Actor) - 要移除的 actor。
        Raises:
            ValueError – If actor is not already registered with the trader.
            ValueError - 如果 actor 尚未在交易者处注册。
        """
        ...

    def remove_strategy(self, strategy: "Strategy") -> None:
        """
        Remove the given strategy.
        移除给定的策略。

        Will stop the strategy first if state is RUNNING.
        如果状态为 RUNNING,将首先停止策略。

        Parameters:
            strategy (Strategy) – The strategy to remove.
            strategy (Strategy) - 要移除的策略。
        Raises:
            ValueError – If strategy is not already registered with the trader.
            ValueError - 如果策略尚未在交易者处注册。
        """
        ...

    def active_task_ids(self) -> list:
        """
        Return the active task identifiers.
        返回活动任务标识符。

        Return type:
            list[TaskId]
        """
        ...

    def add_synthetic(self, synthetic: "SyntheticInstrument") -> None:
        """
        Add the created synthetic instrument to the cache.
        将创建的合成金融工具添加到缓存。

        Parameters:
            synthetic (SyntheticInstrument) – The synthetic instrument to add to the cache.
            synthetic (SyntheticInstrument) - 要添加到缓存的合成金融工具。
        Raises:
            KeyError – If synthetic is already in the cache.
            KeyError - 如果合成金融工具已在缓存中。
        """
        ...

    @property
    def cache(self) -> "CacheFacade":
        """
        The read-only cache for the actor.
        actor 的只读缓存。

        Returns:
            CacheFacade
        """
        ...

    def cancel_all_tasks(self) -> None:
        """
        Cancel all queued and active tasks.
        取消所有排队的和活动的 task。
        """
        ...

    def cancel_task(self, task_id: "TaskId") -> None:
        """
        Cancel the task with the given task_id (if queued or active).
        取消具有给定 task_id 的任务(如果已排队或活动)。

        If the task is not found then a warning is logged.
        如果未找到任务,则记录警告。

        Parameters:
            task_id (TaskId) – The task identifier.
            task_id (TaskId) - 任务标识符。
        """
        ...

    @property
    def clock(self) -> "Clock":
        """
        The actors clock.
        actor 的时钟。

        Returns:
            Clock
        """
        ...

    @property
    def config(self) -> "NautilusConfig":
        """
        The actors configuration.
        actor 的配置。

        Returns:
            NautilusConfig
        """
        ...

    def degrade(self) -> None:
        """
        Degrade the component.
        降级组件。

        While executing on_degrade() any exception will be logged and reraised, then the component will remain in a DEGRADING state.
        在执行 on_degrade() 时,任何异常都将被记录并重新引发,然后组件将保持在 DEGRADING 状态。

        WARNING
            Do not override.
            不要覆盖。

        If the component is not in a valid state from which to execute this method, then the component state will not change, and an error will be logged.
        如果组件处于无效状态,无法执行此方法,则组件状态将不会更改,并且会记录错误。
        """
        ...

    def deregister_warning_event(self, event: type) -> None:
        """
        Deregister the given event type from warning log levels.
        从警告日志级别取消注册给定的事件类型。

        Parameters:
            event (type) – The event class to deregister.
            event (type) - 要取消注册的事件类。
        """
        ...

    def dispose(self) -> None:
        """
        Dispose of the component.
        处理组件。

        While executing on_dispose() any exception will be logged and reraised, then the component will remain in a DISPOSING state.
        在执行 on_dispose() 时,任何异常都将被记录并重新引发,然后组件将保持在 DISPOSING 状态。

        WARNING
            Do not override.
            不要覆盖。

        If the component is not in a valid state from which to execute this method, then the component state will not change, and an error will be logged.
        如果组件处于无效状态,无法执行此方法,则组件状态将不会更改,并且会记录错误。
        """
        ...

    def fault(self) -> None:
        """
        Fault the component.
        使组件出错。

        Calling this method multiple times has the same effect as calling it once (it is idempotent). Once called, it cannot be reversed, and no other methods should be called on this instance.
        多次调用此方法与调用一次具有相同的效果(它是幂等的)。一旦调用,它就无法撤消,并且不应在此实例上调用任何其他方法。

        While executing on_fault() any exception will be logged and reraised, then the component will remain in a FAULTING state.
        在执行 on_fault() 时,任何异常都将被记录并重新引发,然后组件将保持在 FAULTING 状态。

        WARNING
            Do not override.
            不要覆盖。

        If the component is not in a valid state from which to execute this method, then the component state will not change, and an error will be logged.
        如果组件处于无效状态,无法执行此方法,则组件状态将不会更改,并且会记录错误。
        """
        ...

    @classmethod
    def fully_qualified_name(cls) -> str:
        """
        Return the fully qualified name for the components class.
        返回组件类的完全限定名称。

        Return type:
            str
        """
        ...

    def handle_bar(self, bar: "Bar") -> None:
        """
        Handle the given bar data.
        处理给定的K线数据。

        If state is RUNNING then passes to on_bar.
        如果状态为 RUNNING,则传递给 on_bar。

        Parameters:
            bar (Bar) – The bar received.
            bar (Bar) - 收到的K线。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def handle_bars(self, bars: list) -> None:
        """
        Handle the given historical bar data by handling each bar individually.
        通过分别处理每个K线来处理给定的历史K线数据。

        Parameters:
            bars (list [Bar ]) – The bars to handle.
            bars (list [Bar ]) - 要处理的K线。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def handle_data(self, data: "Data") -> None:
        """
        Handle the given data.
        处理给定的数据。

        If state is RUNNING then passes to on_data.
        如果状态为 RUNNING,则传递给 on_data。

        Parameters:
            data (Data) – The data received.
            data (Data) - 收到的数据。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def handle_event(self, event: "Event") -> None:
        """
        Handle the given event.
        处理给定的事件。

        If state is RUNNING then passes to on_event.
        如果状态为 RUNNING,则传递给 on_event。

        Parameters:
            event (Event) – The event received.
            event (Event) - 收到的事件。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def handle_historical_data(self, data) -> None:
        """
        Handle the given historical data.
        处理给定的历史数据。

        Parameters:
            data (Data) – The historical data received.
            data (Data) - 收到的历史数据。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def handle_instrument(self, instrument: "Instrument") -> None:
        """
        Handle the given instrument.
        处理给定的金融工具。

        Passes to on_instrument if state is RUNNING.
        如果状态为 RUNNING,则传递给 on_instrument。

        Parameters:
            instrument (Instrument) – The instrument received.
            instrument (Instrument) - 收到的金融工具。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def handle_instrument_close(self, update: "InstrumentClose") -> None:
        """
        Handle the given instrument close update.
        处理给定的金融工具收盘价更新。

        If state is RUNNING then passes to on_instrument_close.
        如果状态为 RUNNING,则传递给 on_instrument_close。

        Parameters:
            update (InstrumentClose) – The update received.
            update (InstrumentClose) - 收到的更新。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def handle_instrument_status(self, data: "InstrumentStatus") -> None:
        """
        Handle the given instrument status update.
        处理给定的金融工具状态更新。

        If state is RUNNING then passes to on_instrument_status.
        如果状态为 RUNNING,则传递给 on_instrument_status。

        Parameters:
            data (InstrumentStatus) – The status update received.
            data (InstrumentStatus) - 收到的状态更新。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def handle_instruments(self, instruments: list) -> None:
        """
        Handle the given instruments data by handling each instrument individually.
        通过单独处理每个金融工具来处理给定的金融工具数据。

        Parameters:
            instruments (list [Instrument ]) – The instruments received.
            instruments (list [Instrument ]) - 收到的金融工具。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def handle_order_book(self, order_book: "OrderBook") -> None:
        """
        Handle the given order book.
        处理给定的订单簿。

        Passes to on_order_book if state is RUNNING.
        如果状态为 RUNNING,则传递给 on_order_book。

        Parameters:
            order_book (OrderBook) – The order book received.
            order_book (OrderBook) - 收到的订单簿。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def handle_order_book_deltas(self, deltas) -> None:
        """
        Handle the given order book deltas.
        处理给定的订单簿增量。

        Passes to on_order_book_deltas if state is RUNNING. The deltas will be nautilus_pyo3.OrderBookDeltas if the pyo3_conversion flag was set for the subscription.
        如果状态为 RUNNING,则传递给 on_order_book_deltas。如果订阅设置了 pyo3_conversion 标志,则增量将为 nautilus_pyo3.OrderBookDeltas。

        Parameters:
            deltas (OrderBookDeltas or nautilus_pyo3.OrderBookDeltas) – The order book deltas received.
            deltas (OrderBookDeltas 或 nautilus_pyo3.OrderBookDeltas) - 收到的订单簿增量。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def handle_quote_tick(self, tick: "QuoteTick") -> None:
        """
        Handle the given quote tick.
        处理给定的报价 tick。

        If state is RUNNING then passes to on_quote_tick.
        如果状态为 RUNNING,则传递给 on_quote_tick。

        Parameters:
            tick (QuoteTick) – The tick received.
            tick (QuoteTick) - 收到的 tick。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def handle_quote_ticks(self, ticks: list) -> None:
        """
        Handle the given historical quote tick data by handling each tick individually.
        通过单独处理每个 tick 来处理给定的历史报价 tick 数据。

        Parameters:
            ticks (list [QuoteTick ]) – The ticks received.
            ticks (list [QuoteTick ]) - 收到的 tick。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def handle_trade_tick(self, tick: "TradeTick") -> None:
        """
        Handle the given trade tick.
        处理给定的交易 tick。

        If state is RUNNING then passes to on_trade_tick.
        如果状态为 RUNNING,则传递给 on_trade_tick。

        Parameters:
            tick (TradeTick) – The tick received.
            tick (TradeTick) - 收到的 tick。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def handle_trade_ticks(self, ticks: list) -> None:
        """
        Handle the given historical trade tick data by handling each tick individually.
        通过单独处理每个 tick 来处理给定的历史交易 tick 数据。

        Parameters:
            ticks (list [TradeTick ]) – The ticks received.
            ticks (list [TradeTick ]) - 收到的 tick。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def has_active_tasks(self) -> bool:
        """
        Return a value indicating whether there are any active tasks.
        返回值指示是否有任何活动 task。

        Return type:
            bool
        """
        ...

    def has_any_tasks(self) -> bool:
        """
        Return a value indicating whether there are any queued or active tasks.
        返回值指示是否有任何排队或活动的 task。

        Return type:
            bool
        """
        ...

    def has_pending_requests(self) -> bool:
        """
        Return whether the actor is pending processing for any requests.
        返回 actor 是否正在等待处理任何请求。

        Returns:
            True if any requests are pending, else False.
            如果有任何待处理的请求,则返回 True,否则返回 False。
        Return type:
            bool
        """
        ...

    def has_queued_tasks(self) -> bool:
        """
        Return a value indicating whether there are any queued tasks.
        返回值指示是否有任何排队 task。

        Return type:
            bool
        """
        ...

    @property
    def id(self) -> "ComponentId":
        """
        The components ID.
        组件 ID。

        Returns:
            ComponentId
        """
        ...

    def indicators_initialized(self) -> bool:
        """
        Return a value indicating whether all indicators are initialized.
        返回值指示是否所有指标都已初始化。

        Returns:
            True if all initialized, else False
            如果所有指标都已初始化,则返回 True,否则返回 False
        Return type:
            bool
        """
        ...

    @property
    def is_degraded(self) -> bool:
        """
        bool

        Return whether the current component state is DEGRADED.
        返回当前组件状态是否为 DEGRADED。

        Return type:
            bool
        Type:
            Component.is_degraded
        """
        ...

    @property
    def is_disposed(self) -> bool:
        """
        bool

        Return whether the current component state is DISPOSED.
        返回当前组件状态是否为 DISPOSED。

        Return type:
            bool
        Type:
            Component.is_disposed
        """
        ...

    @property
    def is_faulted(self) -> bool:
        """
        bool

        Return whether the current component state is FAULTED.
        返回当前组件状态是否为 FAULTED。

        Return type:
            bool
        Type:
            Component.is_faulted
        """
        ...

    @property
    def is_initialized(self) -> bool:
        """
        bool

        Return whether the component has been initialized (component.state >= INITIALIZED).
        返回组件是否已初始化 (component.state >= INITIALIZED)。

        Return type:
            bool
        Type:
            Component.is_initialized
        """
        ...

    def is_pending_request(self, request_id: "UUID4") -> bool:
        """
        Return whether the request for the given identifier is pending processing.
        返回给定标识符的请求是否正在等待处理。

        Parameters:
            request_id (UUID4) – The request ID to check.
            request_id (UUID4) - 要检查的请求 ID。
        Returns:
            True if request is pending, else False.
            如果请求正在等待,则返回 True,否则返回 False。
        Return type:
            bool
        """
        ...

    @property
    def is_running(self) -> bool:
        """
        bool

        Return whether the current component state is RUNNING.
        返回当前组件状态是否为 RUNNING。

        Return type:
            bool
        Type:
            Component.is_running
        """
        ...

    @property
    def is_stopped(self) -> bool:
        """
        bool

        Return whether the current component state is STOPPED.
        返回当前组件状态是否为 STOPPED。

        Return type:
            bool
        Type:
            Component.is_stopped
        """
        ...

    def load(self, state: dict) -> None:
        """
        Load the actor/strategy state from the give state dictionary.
        从给定的状态字典加载 actor/策略状态。

        Calls on_load and passes the state.
        调用 on_load 并传递状态。

        Parameters:
            state (dict *[*str , object ]) – The state dictionary.
            state (dict *[*str , object ]) - 状态字典。
        Raises:
            RuntimeError – If actor/strategy is not registered with a trader.
            RuntimeError - 如果 actor/策略未注册到交易者。
        WARNING
            Exceptions raised will be caught, logged, and reraised.
            引发的异常将被捕获、记录并重新引发。
        """
        ...

    @property
    def log(self) -> "Logger":
        """
        The actors logger.
        actor 的日志记录器。

        Returns:
            Logger
        """
        ...

    @property
    def msgbus(self) -> "MessageBus" or None:
        """
        The message bus for the actor (if registered).
        actor 的消息总线(如果已注册)。

        Returns:
            MessageBus or None
        """
        ...

    def on_bar(self, bar: "Bar") -> None:
        """
        Actions to be performed when running and receives a bar.
        运行并接收K线时要执行的操作。

        Parameters:
            bar (Bar) – The bar received.
            bar (Bar) - 收到的K线。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_data(self, data) -> None:
        """
        Actions to be performed when running and receives data.
        运行并接收数据时要执行的操作。

        Parameters:
            data (Data) – The data received.
            data (Data) - 收到的数据。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_degrade(self) -> None:
        """
        Actions to be performed on degrade.
        降级时要执行的操作。

        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。

        Should be overridden in the actor implementation.
        应该在 actor 实现中覆盖。
        """
        ...

    def on_dispose(self) -> None:
        """
        Actions to be performed on dispose.
        处置时要执行的操作。

        Cleanup/release any resources used here.
        在此处清理/释放任何使用的资源。

        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_event(self, event: "Event") -> None:
        """
        Actions to be performed running and receives an event.
        运行并接收事件时要执行的操作。

        Parameters:
            event (Event) – The event received.
            event (Event) - 收到的事件。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_fault(self) -> None:
        """
        Actions to be performed on fault.
        故障时要执行的操作。

        Cleanup any resources used by the actor here.
        在此处清理 actor 使用的任何资源。

        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。

        Should be overridden in the actor implementation.
        应该在 actor 实现中覆盖。
        """
        ...

    def on_historical_data(self, data) -> None:
        """
        Actions to be performed when running and receives historical data.
        运行并接收历史数据时要执行的操作。

        Parameters:
            data (Data) – The historical data received.
            data (Data) - 收到的历史数据。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_instrument(self, instrument: "Instrument") -> None:
        """
        Actions to be performed when running and receives an instrument.
        运行并接收金融工具时要执行的操作。

        Parameters:
            instrument (Instrument) – The instrument received.
            instrument (Instrument) - 收到的金融工具。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_instrument_close(self, update: "InstrumentClose") -> None:
        """
        Actions to be performed when running and receives an instrument close update.
        运行并接收金融工具收盘价更新时要执行的操作。

        Parameters:
            update (InstrumentClose) – The instrument close received.
            update (InstrumentClose) - 收到的金融工具收盘价。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_instrument_status(self, data: "InstrumentStatus") -> None:
        """
        Actions to be performed when running and receives an instrument status update.
        运行并接收金融工具状态更新时要执行的操作。

        Parameters:
            data (InstrumentStatus) – The instrument status update received.
            data (InstrumentStatus) - 收到的金融工具状态更新。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_load(self, state: dict) -> None:
        """
        Actions to be performed when the actor state is loaded.
        加载 actor 状态时要执行的操作。

        Saved state values will be contained in the give state dictionary.
        保存的状态值将包含在给定的状态字典中。

        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_order_book(self, order_book: "OrderBook") -> None:
        """
        Actions to be performed when running and receives an order book.
        运行并接收订单簿时要执行的操作。

        Parameters:
            order_book (OrderBook) – The order book received.
            order_book (OrderBook) - 收到的订单簿。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_order_book_deltas(self, deltas) -> None:
        """
        Actions to be performed when running and receives order book deltas.
        运行并接收订单簿增量时要执行的操作。

        Parameters:
            deltas (OrderBookDeltas or nautilus_pyo3.OrderBookDeltas) – The order book deltas received.
            deltas (OrderBookDeltas 或 nautilus_pyo3.OrderBookDeltas) - 收到的订单簿增量。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_quote_tick(self, tick: "QuoteTick") -> None:
        """
        Actions to be performed when running and receives a quote tick.
        运行并接收报价 tick 时要执行的操作。

        Parameters:
            tick (QuoteTick) – The tick received.
            tick (QuoteTick) - 收到的 tick。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_reset(self) -> None:
        """
        Actions to be performed on reset.
        重置时要执行的操作。

        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。

        Should be overridden in a user implementation.
        应该在用户实现中覆盖。
        """
        ...

    def on_resume(self) -> None:
        """
        Actions to be performed on resume.
        恢复时要执行的操作。

        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_save(self) -> dict:
        """
        Actions to be performed when the actor state is saved.
        保存 actor 状态时要执行的操作。

        Create and return a state dictionary of values to be saved.
        创建并返回要保存的值的状态字典。

        Returns:
            The strategy state dictionary.
            策略状态字典。
        Return type:
            dict[str, bytes]
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_start(self) -> None:
        """
        Actions to be performed on start.
        启动时要执行的操作。

        The intent is that this method is called once per trading ‘run’, when initially starting.
        此方法的目的是在每次交易“运行”时调用一次,即在初始启动时调用。

        It is recommended to subscribe/request for data here.
        建议在此处订阅/请求数据。

        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。

        Should be overridden in a user implementation.
        应该在用户实现中覆盖。
        """
        ...

    def on_stop(self) -> None:
        """
        Actions to be performed on stop.
        停止时要执行的操作。

        The intent is that this method is called to pause, or when done for day.
        此方法的目的是在暂停时调用,或在当天完成时调用。

        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。

        Should be overridden in a user implementation.
        应该在用户实现中覆盖。
        """
        ...

    def on_trade_tick(self, tick: "TradeTick") -> None:
        """
        Actions to be performed when running and receives a trade tick.
        运行并接收交易 tick 时要执行的操作。

        Parameters:
            tick (TradeTick) – The tick received.
            tick (TradeTick) - 收到的 tick。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def pending_requests(self) -> set:
        """
        Return the request IDs which are currently pending processing.
        返回当前正在等待处理的请求 ID。

        Return type:
            set[UUID4]
        """
        ...

    @property
    def portfolio(self) -> "PortfolioFacade":
        """
        The read-only portfolio for the actor.
        actor 的只读投资组合。

        Returns:
            PortfolioFacade
        """
        ...

    def publish_data(self, data_type: "DataType", data: "Data") -> None:
        """
        Publish the given data to the message bus.
        将给定的数据发布到消息总线。

        Parameters:
            data_type (DataType) – The data type being published.
            data_type (DataType) - 正在发布的数据类型。
            data (Data) – The data to publish.
            data (Data) - 要发布的数据。
        """
        ...

    def publish_signal(self, name: str, value, ts_event: int = 0) -> None:
        """
        Publish the given value as a signal to the message bus.
        将给定的值作为信号发布到消息总线。

        Parameters:
            name (str) – The name of the signal being published. The signal name is case-insensitive and will be capitalized (e.g., ‘example’ becomes ‘SignalExample’).
            name (str) - 正在发布的信号的名称。信号名称不区分大小写,并将大写(例如,“example”将变为“SignalExample”)。
            value (object) – The signal data to publish.
            value (object) - 要发布的信号数据。
            ts_event (uint64_t , optional) – UNIX timestamp (nanoseconds) when the signal event occurred. If None then will timestamp current time.


           ts_event (uint64_t, 可选) - 信号事件发生时的 UNIX 时间戳(纳秒)。如果为 None,则将使用当前时间进行时间戳记。
        """
        ...

    def queue_for_executor(
        self, func: "Callable[..., Any]", args: tuple = None, kwargs: dict = None
    ):
        """
        Queues the callable func to be executed as fn(*args, **kwargs) sequentially.
        将可调用函数 func 排队,以按顺序执行为 fn(*args, **kwargs)。

        Parameters:
            func (Callable) – The function to be executed.
            func (Callable) - 要执行的函数。
            args (positional arguments) – The positional arguments for the call to func.
            args (位置参数) - 对 func 的调用的位置参数。
            kwargs (arbitrary keyword arguments) – The keyword arguments for the call to func.
            kwargs (任意关键字参数) - 对 func 的调用的关键字参数。
        Raises:
            TypeError – If func is not of type Callable.
            TypeError - 如果 func 的类型不是 Callable。
        """
        ...

    def queued_task_ids(self) -> list:
        """
        Return the queued task identifiers.
        返回排队的 task 标识符。

        Return type:
            list[TaskId]
        """
        ...

    def register_base(
        self,
        portfolio: "PortfolioFacade",
        msgbus: "MessageBus",
        cache: "CacheFacade",
        clock: "Clock",
    ) -> None:
        """
        Register with a trader.
        注册到交易者。

        Parameters:
            portfolio (PortfolioFacade) – The read-only portfolio for the actor.
            portfolio (PortfolioFacade) - actor 的只读投资组合。
            msgbus (MessageBus) – The message bus for the actor.
            msgbus (MessageBus) - actor 的消息总线。
            cache (CacheFacade) – The read-only cache for the actor.
            cache (CacheFacade) - actor 的只读缓存。
            clock (Clock) – The clock for the actor.
            clock (Clock) - actor 的时钟。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def register_executor(self, loop: "asyncio.AbstractEventLoop", executor: "Executor") -> None:
        """
        Register the given Executor for the actor.
        为 actor 注册给定的 Executor。

        Parameters:
            loop (asyncio.AsbtractEventLoop) – The event loop of the application.
            loop (asyncio.AsbtractEventLoop) - 应用程序的事件循环。
            executor (concurrent.futures.Executor) – The executor to register.
            executor (concurrent.futures.Executor) - 要注册的执行程序。
        Raises:
            TypeError – If executor is not of type concurrent.futures.Executor
            TypeError - 如果 executor 的类型不是 concurrent.futures.Executor
        """
        ...

    def register_indicator_for_bars(
        self, bar_type: "BarType", indicator: "Indicator"
    ) -> None:
        """
        Register the given indicator with the actor/strategy to receive bar data for the given bar type.
        将给定的指标注册到 actor/策略,以接收给定K线类型的数据。

        Parameters:
            bar_type (BarType) – The bar type for bar updates.
            bar_type (BarType) - K线更新的K线类型。
            indicator (Indicator) – The indicator to register.
            indicator (Indicator) - 要注册的指标。
        """
        ...

    def register_indicator_for_quote_ticks(
        self, instrument_id: "InstrumentId", indicator: "Indicator"
    ) -> None:
        """
        Register the given indicator with the actor/strategy to receive quote tick data for the given instrument ID.
        将给定的指标注册到 actor/策略,以接收给定金融工具 ID 的报价 tick 数据。

        Parameters:
            instrument_id (InstrumentId) – The instrument ID for tick updates.
            instrument_id (InstrumentId) - 用于 tick 更新的金融工具 ID。
            indicator (Indicator) – The indicator to register.
            indicator (Indicator) - 要注册的指标。
        """
        ...

    def register_indicator_for_trade_ticks(
        self, instrument_id: "InstrumentId", indicator: "Indicator"
    ) -> None:
        """
        Register the given indicator with the actor/strategy to receive trade tick data for the given instrument ID.
        将给定的指标注册到 actor/策略,以接收给定金融工具 ID 的交易 tick 数据。

        Parameters:
            instrument_id (InstrumentId) – The instrument ID for tick updates.
            instrument_id (InstrumentId) - 用于 tick 更新的金融工具 ID。
            indicator (indicator) – The indicator to register.
            indicator (indicator) - 要注册的指标。
        """
        ...

    def register_warning_event(self, event: type) -> None:
        """
        Register the given event type for warning log levels.
        为警告日志级别注册给定的事件类型。

        Parameters:
            event (type) – The event class to register.
            event (type) - 要注册的事件类。
        """
        ...

    @property
    def registered_indicators(self) -> list["Indicator"]:
        """
        Return the registered indicators for the strategy.
        返回策略的已注册指标。

        Return type:
            list[Indicator]
        """
        ...

    def request_bars(
        self,
        bar_type: "BarType",
        start: "datetime" = None,
        end: "datetime" = None,
        client_id: "ClientId" = None,
        callback: "Callable[[UUID4], None]" | None = None,
    ) -> "UUID4":
        """
        Request historical Bar data.
        请求历史K线数据。

        If end is None then will request up to the most recent data.
        如果 end 为 None,则将请求最新的数据。

        Parameters:
            bar_type (BarType) – The bar type for the request.
            bar_type (BarType) - 请求的K线类型。
            start (datetime , optional) – The start datetime (UTC) of request time range (inclusive).
            start (datetime, 可选) - 请求时间范围的开始日期时间(UTC)(包含)。
            end (datetime , optional) – The end datetime (UTC) of request time range. The inclusiveness depends on individual data client implementation.
            end (datetime, 可选) - 请求时间范围的结束日期时间(UTC)。包含性取决于各个数据客户端的实现。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
            callback (Callable [ [UUID4 ] , None ] , optional) – The registered callback, to be called with the request ID when the response has completed processing.
            callback (Callable [ [UUID4 ] , None ], 可选) - 注册的回调,当响应完成处理时,将使用请求 ID 调用该回调。
        Returns:
            The request_id for the request.
            请求的 request_id。
        Return type:
            UUID4
        Raises:
            ValueError – If start and end are not None and start is >= end.
            ValueError - 如果 start 和 end 不为 None 并且 start >= end。
            TypeError – If callback is not None and not of type Callable.
            TypeError - 如果 callback 不为 None 并且类型不是 Callable。
        """
        ...

    def request_data(
        self,
        data_type: "DataType",
        client_id: "ClientId",
        callback: "Callable[[UUID4], None]" | None = None,
    ) -> "UUID4":
        """
        Request custom data for the given data type from the given data client.
        从给定的数据客户端请求给定数据类型的自定义数据。

        Parameters:
            data_type (DataType) – The data type for the request.
            data_type (DataType) - 请求的数据类型。
            client_id (ClientId) – The data client ID.
            client_id (ClientId) - 数据客户端 ID。
            callback (Callable [ [UUID4 ] , None ] , optional) – The registered callback, to be called with the request ID when the response has completed processing.
            callback (Callable [ [UUID4 ] , None ], 可选) - 注册的回调,当响应完成处理时,将使用请求 ID 调用该回调。
        Returns:
            The request_id for the request.
            请求的 request_id。
        Return type:
            UUID4
        Raises:
            TypeError – If callback is not None and not of type Callable.
            TypeError - 如果 callback 不为 None 并且类型不是 Callable。
        """
        ...

    def request_instrument(
        self,
        instrument_id: "InstrumentId",
        start: "datetime" = None,
        end: "datetime" = None,
        client_id: "ClientId" = None,
        callback: "Callable[[UUID4], None]" | None = None,
    ) -> "UUID4":
        """
        Request Instrument data for the given instrument ID.
        请求给定金融工具 ID 的金融工具数据。

        If end is None then will request up to the most recent data.
        如果 end 为 None,则将请求最新的数据。

        Parameters:
            instrument_id (InstrumentId) – The instrument ID for the request.
            instrument_id (InstrumentId) - 请求的金融工具 ID。
            start (datetime , optional) – The start datetime (UTC) of request time range (inclusive).
            start (datetime, 可选) - 请求时间范围的开始日期时间(UTC)(包含)。
            end (datetime , optional) – The end datetime (UTC) of request time range. The inclusiveness depends on individual data client implementation.
            end (datetime, 可选) - 请求时间范围的结束日期时间(UTC)。包含性取决于各个数据客户端的实现。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
            callback (Callable [ [UUID4 ] , None ] , optional) – The registered callback, to be called with the request ID when the response has completed processing.
            callback (Callable [ [UUID4 ] , None ], 可选) - 注册的回调,当响应完成处理时,将使用请求 ID 调用该回调。
        Returns:
            The request_id for the request.
            请求的 request_id。
        Return type:
            UUID4
        Raises:
            ValueError – If start and end are not None and start is >= end.
            ValueError - 如果 start 和 end 不为 None 并且 start >= end。
            TypeError – If callback is not None and not of type Callable.
            TypeError - 如果 callback 不为 None 并且类型不是 Callable。
        """
        ...

    def request_instruments(
        self,
        venue: "Venue",
        start: "datetime" = None,
        end: "datetime" = None,
        client_id: "ClientId" = None,
        callback: "Callable[[UUID4], None]" | None = None,
    ) -> "UUID4":
        """
        Request all Instrument data for the given venue.
        请求给定交易场所的所有金融工具数据。

        If end is None then will request up to the most recent data.
        如果 end 为 None,则将请求最新的数据。

        Parameters:
            venue (Venue) – The venue for the request.
            venue (Venue) - 请求的交易场所。
            start (datetime , optional) – The start datetime (UTC) of request time range (inclusive).
            start (datetime, 可选) - 请求时间范围的开始日期时间(UTC)(包含)。
            end (datetime , optional) – The end datetime (UTC) of request time range. The inclusiveness depends on individual data client implementation.
            end (datetime, 可选) - 请求时间范围的结束日期时间(UTC)。包含性取决于各个数据客户端的实现。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
            callback (Callable [ [UUID4 ] , None ] , optional) – The registered callback, to be called with the request ID when the response has completed processing.
            callback (Callable [ [UUID4 ] , None ], 可选) - 注册的回调,当响应完成处理时,将使用请求 ID 调用该回调。
        Returns:
            The request_id for the request.
            请求的 request_id。
        Return type:
            UUID4
        Raises:
            ValueError – If start and end are not None and start is >= end.
            ValueError - 如果 start 和 end 不为 None 并且 start >= end。
            TypeError – If callback is not None and not of type Callable.
            TypeError - 如果 callback 不为 None 并且类型不是 Callable。
        """
        ...

    def request_order_book_snapshot(
        self,
        instrument_id: "InstrumentId",
        limit: int,
        client_id: "ClientId" = None,
        callback: "Callable[[UUID4], None]" | None = None,
    ) -> "UUID4":
        """
        Request an order book snapshot.
        请求订单簿快照。

        Parameters:
            instrument_id (InstrumentId) – The instrument ID for the order book snapshot request.
            instrument_id (InstrumentId) - 订单簿快照请求的金融工具 ID。
            limit (int , optional) – The limit on the depth of the order book snapshot (default is None).
            limit (int, 可选) - 订单簿快照深度的限制(默认为 None)。
            client_id (ClientId , optional) – The specific client ID for the command. If None, it will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
            callback (Callable [ [UUID4 ] , None ] , optional) – The registered callback, to be called with the request ID when the response has completed processing.
            callback (Callable [ [UUID4 ] , None ], 可选) - 注册的回调,当响应完成处理时,将使用请求 ID 调用该回调。
        Returns:
            The request_id for the request.
            请求的 request_id。
        Return type:
            UUID4
        Raises:
            ValueError – If the instrument_id is None.
            ValueError - 如果 instrument_id 为 None。
            TypeError – If callback is not None and not of type Callable.
            TypeError - 如果 callback 不为 None 并且类型不是 Callable。
        """
        ...

    def request_quote_ticks(
        self,
        instrument_id: "InstrumentId",
        start: "datetime" = None,
        end: "datetime" = None,
        client_id: "ClientId" = None,
        callback: "Callable[[UUID4], None]" | None = None,
    ) -> "UUID4":
        """
        Request historical QuoteTick data.
        请求历史报价 tick 数据。

        If end is None then will request up to the most recent data.
        如果 end 为 None,则将请求最新的数据。

        Parameters:
            instrument_id (InstrumentId) – The tick instrument ID for the request.
            instrument_id (InstrumentId) - 请求的 tick 金融工具 ID。
            start (datetime , optional) – The start datetime (UTC) of request time range (inclusive).
            start (datetime, 可选) - 请求时间范围的开始日期时间(UTC)(包含)。
            end (datetime , optional) – The end datetime (UTC) of request time range. The inclusiveness depends on individual data client implementation.
            end (datetime, 可选) - 请求时间范围的结束日期时间(UTC)。包含性取决于各个数据客户端的实现。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
            callback (Callable [ [UUID4 ] , None ] , optional) – The registered callback, to be called with the request ID when the response has completed processing.
            callback (Callable [ [UUID4 ] , None ], 可选) - 注册的回调,当响应完成处理时,将使用请求 ID 调用该回调。
        Returns:
            The request_id for the request.
            请求的 request_id。
        Return type:
            UUID4
        Raises:
            ValueError – If start and end are not None and start is >= end.
            ValueError - 如果 start 和 end 不为 None 并且 start >= end。
            TypeError – If callback is not None and not of type Callable.
            TypeError - 如果 callback 不为 None 并且类型不是 Callable。
        """
        ...

    def request_trade_ticks(
        self,
        instrument_id: "InstrumentId",
        start: "datetime" = None,
        end: "datetime" = None,
        client_id: "ClientId" = None,
        callback: "Callable[[UUID4], None]" | None = None,
    ) -> "UUID4":
        """
        Request historical TradeTick data.
        请求历史交易 tick 数据。

        If end is None then will request up to the most recent data.
        如果 end 为 None,则将请求最新的数据。

        Parameters:
            instrument_id (InstrumentId) – The tick instrument ID for the request.
            instrument_id (InstrumentId) - 请求的 tick 金融工具 ID。
            start (datetime , optional) – The start datetime (UTC) of request time range (inclusive).
            start (datetime, 可选) - 请求时间范围的开始日期时间(UTC)(包含)。
            end (datetime , optional) – The end datetime (UTC) of request time range. The inclusiveness depends on individual data client implementation.
            end (datetime, 可选) - 请求时间范围的结束日期时间(UTC)。包含性取决于各个数据客户端的实现。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
            callback (Callable [ [UUID4 ] , None ] , optional) – The registered callback, to be called with the request ID when the response has completed processing.
            callback (Callable [ [UUID4 ] , None ], 可选) - 注册的回调,当响应完成处理时,将使用请求 ID 调用该回调。
        Returns:
            The request_id for the request.
            请求的 request_id。
        Return type:
            UUID4
        Raises:
            ValueError – If start and end are not None and start is >= end.
            ValueError - 如果 start 和 end 不为 None 并且 start >= end。
            TypeError – If callback is not None and not of type Callable.
            TypeError - 如果 callback 不为 None 并且类型不是 Callable。
        """
        ...

    def reset(self) -> None:
        """
        Reset the component.
        重置组件。

        All stateful fields are reset to their initial value.
        所有有状态字段都重置为其初始值。

        While executing on_reset() any exception will be logged and reraised, then the component will remain in a RESETTING state.
        在执行 on_reset() 时,任何异常都将被记录并重新引发,然后组件将保持在 RESETTING 状态。

        WARNING
            Do not override.
            不要覆盖。

        If the component is not in a valid state from which to execute this method, then the component state will not change, and an error will be logged.
        如果组件处于无效状态,无法执行此方法,则组件状态将不会更改,并且会记录错误。
        """
        ...

    def resume(self) -> None:
        """
        Resume the component.
        恢复组件。

        While executing on_resume() any exception will be logged and reraised, then the component will remain in a RESUMING state.
        在执行 on_resume() 时,任何异常都将被记录并重新引发,然后组件将保持在 RESUMING 状态。

        WARNING
            Do not override.
            不要覆盖。

        If the component is not in a valid state from which to execute this method, then the component state will not change, and an error will be logged.
        如果组件处于无效状态,无法执行此方法,则组件状态将不会更改,并且会记录错误。
        """
        ...

    def run_in_executor(
        self, func: "Callable[..., Any]", args: tuple = None, kwargs: dict = None
    ):
        """
        Schedules the callable func to be executed as fn(*args, **kwargs).
        安排可调用函数 func 作为 fn(*args, **kwargs) 执行。

        Parameters:
            func (Callable) – The function to be executed.
            func (Callable) - 要执行的函数。
            args (positional arguments) – The positional arguments for the call to func.
            args (位置参数) - 对 func 的调用的位置参数。
            kwargs (arbitrary keyword arguments) – The keyword arguments for the call to func.
            kwargs (任意关键字参数) - 对 func 的调用的关键字参数。
        Returns:
            The unique task identifier for the execution. This also corresponds to any future objects memory address.
            执行的唯一任务标识符。这也对应于任何 future 对象的内存地址。
        Return type:
            TaskId
        Raises:
            TypeError – If func is not of type Callable.
            TypeError - 如果 func 的类型不是 Callable。
        """
        ...

    def save(self) -> dict:
        """
        Return the actor/strategy state dictionary to be saved.
        返回要保存的 actor/策略状态字典。

        Calls on_save.
        调用 on_save。

        Raises:
            RuntimeError – If actor/strategy is not registered with a trader.
            RuntimeError - 如果 actor/策略未注册到交易者。
        WARNING
            Exceptions raised will be caught, logged, and reraised.
            引发的异常将被捕获、记录并重新引发。
        """
        ...

    def start(self) -> None:
        """
        Start the component.
        启动组件。

        While executing on_start() any exception will be logged and reraised, then the component will remain in a STARTING state.
        在执行 on_start() 时,任何异常都将被记录并重新引发,然后组件将保持在 STARTING 状态。

        WARNING
            Do not override.
            不要覆盖。

        If the component is not in a valid state from which to execute this method, then the component state will not change, and an error will be logged.
        如果组件处于无效状态,无法执行此方法,则组件状态将不会更改,并且会记录错误。
        """
        ...

    @property
    def state(self) -> "ComponentState":
        """
        ComponentState

        Return the components current state.
        返回组件的当前状态。

        Return type:
            ComponentState
        Type:
            Component.state
        """
        ...

    def stop(self) -> None:
        """
        Stop the component.
        停止组件。

        While executing on_stop() any exception will be logged and reraised, then the component will remain in a STOPPING state.
        在执行 on_stop() 时,任何异常都将被记录并重新引发,然后组件将保持在 STOPPING 状态。

        WARNING
            Do not override.
            不要覆盖。

        If the component is not in a valid state from which to execute this method, then the component state will not change, and an error will be logged.
        如果组件处于无效状态,无法执行此方法,则组件状态将不会更改,并且会记录错误。
        """
        ...

    def subscribe_bars(
        self,
        bar_type: "BarType",
        client_id: "ClientId" = None,
        await_partial: bool = False,
    ) -> None:
        """
        Subscribe to streaming Bar data for the given bar type.
        订阅给定K线类型的流式K线数据。

        Parameters:
            bar_type (BarType) – The bar type to subscribe to.
            bar_type (BarType) - 要订阅的K线类型。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
            await_partial (bool , default False) – If the bar aggregator should await the arrival of a historical partial bar prior to actively aggregating new bars.
            await_partial (bool, 默认 False) - 如果K线聚合器应在主动聚合新K线之前等待历史部分K线的到来。
        """
        ...

    def subscribe_data(self, data_type: "DataType", client_id: "ClientId" = None) -> None:
        """
        Subscribe to data of the given data type.
        订阅给定数据类型的数据。

        Parameters:
            data_type (DataType) – The data type to subscribe to.
            data_type (DataType) - 要订阅的数据类型。
            client_id (ClientId , optional) – The data client ID. If supplied then a Subscribe command will be sent to the corresponding data client.
            client_id (ClientId, 可选) - 数据客户端 ID。如果提供,则将向相应的数据客户端发送 Subscribe 命令。
        """
        ...

    def subscribe_instrument(
        self, instrument_id: "InstrumentId", client_id: "ClientId" = None
    ) -> None:
        """
        Subscribe to update Instrument data for the given instrument ID.
        订阅给定金融工具 ID 的更新金融工具数据。

        Parameters:
            instrument_id (InstrumentId) – The instrument ID for the subscription.
            instrument_id (InstrumentId) - 订阅的金融工具 ID。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
        """
        ...

    def subscribe_instrument_close(
        self, instrument_id: "InstrumentId", client_id: "ClientId" = None
    ) -> None:
        """
        Subscribe to close updates for the given instrument ID.
        订阅给定金融工具 ID 的收盘价更新。

        Parameters:
            instrument_id (InstrumentId) – The instrument to subscribe to status updates for.
            instrument_id (InstrumentId) - 要订阅状态更新的金融工具。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
        """
        ...

    def subscribe_instrument_status(
        self, instrument_id: "InstrumentId", client_id: "ClientId" = None
    ) -> None:
        """
        Subscribe to status updates for the given instrument ID.
        订阅给定金融工具 ID 的状态更新。

        Parameters:
            instrument_id (InstrumentId) – The instrument to subscribe to status updates for.
            instrument_id (InstrumentId) - 要订阅状态更新的金融工具。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
        """
        ...

    def subscribe_instruments(self, venue: "Venue", client_id: "ClientId" = None) -> None:
        """
        Subscribe to update Instrument data for the given venue.
        订阅给定交易场所的更新金融工具数据。

        Parameters:
            venue (Venue) – The venue for the subscription.
            venue (Venue) - 订阅的交易场所。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从交易场所推断出来。
        """
        ...

    def subscribe_order_book_at_interval(
        self,
        instrument_id: "InstrumentId",
        book_type: "BookType" = BookType.L2_MBP,
        depth: int = 0,
        interval_ms: int = 1000,
        kwargs: dict = None,
        client_id: "ClientId" = None,
        managed: bool = True,
    ) -> None:
        """
        Subscribe to an OrderBook at a specified interval for the given instrument ID.
        以指定的间隔订阅给定金融工具 ID 的订单簿。

        The DataEngine will only maintain one order book for each instrument. Because of this - the level, depth and kwargs for the stream will be set as per the last subscription request (this will also affect all subscribers).
        DataEngine 将只为每个金融工具维护一个订单簿。因此,流的级别、深度和 kwargs 将根据最后一个订阅请求进行设置(这也会影响所有订阅者)。

        Parameters:
            instrument_id (InstrumentId) – The order book instrument ID to subscribe to.
            instrument_id (InstrumentId) - 要订阅的订单簿金融工具 ID。
            book_type (BookType {L1_MBP, L2_MBP, L3_MBO}) – The order book type.
            book_type (BookType {L1_MBP, L2_MBP, L3_MBO}) - 订单簿类型。
            depth (int , optional) – The maximum depth for the order book. A depth of 0 is maximum depth.
            depth (int, 可选) - 订单簿的最大深度。深度为 0 表示最大深度。
            interval_ms (int) – The order book snapshot interval in milliseconds (must be positive).
            interval_ms (int) - 订单簿快照间隔(以毫秒为单位)(必须为正数)。
            kwargs (dict , optional) – The keyword arguments for exchange specific parameters.
            kwargs (dict, 可选) - 特定于交易所的参数的关键字参数。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
            managed (bool , default True) – If an order book should be managed by the data engine based on the subscribed feed.
            managed (bool, 默认 True) - 是否应根据订阅的 feed 由数据引擎管理订单簿。
        Raises:
            ValueError – If depth is negative (< 0).
            ValueError - 如果 depth 为负数 (< 0)。
            ValueError – If interval_ms is not positive (> 0).
            ValueError - 如果 interval_ms 不为正数 (> 0)。
        WARNING
            Consider subscribing to order book deltas if you need intervals less than 100 milliseconds.
            如果您需要小于 100 毫秒的间隔,请考虑订阅订单簿增量。
        """
        ...

    def subscribe_order_book_deltas(
        self,
        instrument_id: "InstrumentId",
        book_type: "BookType" = BookType.L2_MBP,
        depth: int = 0,
        kwargs: dict = None,
        client_id: "ClientId" = None,
        managed: bool = True,
        pyo3_conversion: bool = False,
    ) -> None:
        """
        Subscribe to the order book data stream, being a snapshot then deltas for the given instrument ID.
        订阅订单簿数据流,即给定金融工具 ID 的快照,然后是增量。

        Parameters:
            instrument_id (InstrumentId) – The order book instrument ID to subscribe to.
            instrument_id (InstrumentId) - 要订阅的订单簿金融工具 ID。
            book_type (BookType {L1_MBP, L2_MBP, L3_MBO}) – The order book type.
            book_type (BookType {L1_MBP, L2_MBP, L3_MBO}) - 订单簿类型。
            depth (int , optional) – The maximum depth for the order book. A depth of 0 is maximum depth.
            depth (int, 可选) - 订单簿的最大深度。深度为 0 表示最大深度。
            kwargs (dict , optional) – The keyword arguments for exchange specific parameters.
            kwargs (dict, 可选) - 特定于交易所的参数的关键字参数。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
            managed (bool , default True) – If an order book should be managed by the data engine based on the subscribed feed.
            managed (bool, 默认 True) - 是否应根据订阅的 feed 由数据引擎管理订单簿。
            pyo3_conversion (bool , default False) – If received deltas should be converted to nautilus_pyo3.OrderBookDeltas prior to being passed to the on_order_book_deltas handler.
            pyo3_conversion (bool, 默认 False) - 是否应在将接收到的增量传递给 on_order_book_deltas 处理程序之前将其转换为 nautilus_pyo3.OrderBookDeltas。
        """
        ...

    def subscribe_quote_ticks(
        self, instrument_id: "InstrumentId", client_id: "ClientId" = None
    ) -> None:
        """
        Subscribe to streaming QuoteTick data for the given instrument ID.
        订阅给定金融工具 ID 的流式报价 tick 数据。

        Parameters:
            instrument_id (InstrumentId) – The tick instrument to subscribe to.
            instrument_id (InstrumentId) - 要订阅的 tick 金融工具。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID.
                       client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
        """
        ...

    def subscribe_signal(self, name: str = "") -> None:
        """
        Subscribe to a specific signal by name, or to all signals if no name is provided.
        按名称订阅特定信号,如果未提供名称,则订阅所有信号。

        Parameters:
            name (str , optional) – The name of the signal to subscribe to. If not provided or an empty string is passed, the subscription will include all signals. The signal name is case-insensitive and will be capitalized (e.g., ‘example’ becomes ‘SignalExample*’).
            name (str,可选) - 要订阅的信号的名称。如果没有提供名称或传递了空字符串,则订阅将包含所有信号。信号名称不区分大小写,并将大写(例如,“example”将变为“SignalExample*”)。
        """
        ...

    def subscribe_trade_ticks(
        self, instrument_id: "InstrumentId", client_id: "ClientId" = None
    ) -> None:
        """
        Subscribe to streaming TradeTick data for the given instrument ID.
        订阅给定金融工具 ID 的流式交易 tick 数据。

        Parameters:
            instrument_id (InstrumentId) – The tick instrument to subscribe to.
            instrument_id (InstrumentId) - 要订阅的 tick 金融工具。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
        """
        ...

    def to_importable_config(self) -> "ImportableActorConfig":
        """
        Returns an importable configuration for this actor.
        返回此 actor 的可导入配置。

        Return type:
            ImportableActorConfig
        """
        ...

    @property
    def trader_id(self) -> "TraderId":
        """
        The trader ID associated with the component.
        与组件关联的交易者 ID。

        Returns:
            TraderId
        """
        ...

    @property
    def type(self):
        """
        The components type.
        组件类型。

        Returns:
            type
        """
        ...

    def unsubscribe_bars(self, bar_type: "BarType", client_id: "ClientId" = None) -> None:
        """
        Unsubscribe from streaming Bar data for the given bar type.
        取消订阅给定K线类型的流式K线数据。

        Parameters:
            bar_type (BarType) – The bar type to unsubscribe from.
            bar_type (BarType) - 要取消订阅的K线类型。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
        """
        ...

    def unsubscribe_data(self, data_type: "DataType", client_id: "ClientId" = None) -> None:
        """
        Unsubscribe from data of the given data type.
        取消订阅给定数据类型的数据。

        Parameters:
            data_type (DataType) – The data type to unsubscribe from.
            data_type (DataType) - 要取消订阅的数据类型。
            client_id (ClientId , optional) – The data client ID. If supplied then an Unsubscribe command will be sent to the data client.
            client_id (ClientId, 可选) - 数据客户端 ID。如果提供,则将向数据客户端发送 Unsubscribe 命令。
        """
        ...

    def unsubscribe_instrument(
        self, instrument_id: "InstrumentId", client_id: "ClientId" = None
    ) -> None:
        """
        Unsubscribe from update Instrument data for the given instrument ID.
        取消订阅给定金融工具 ID 的更新金融工具数据。

        Parameters:
            instrument_id (InstrumentId) – The instrument to unsubscribe from.
            instrument_id (InstrumentId) - 要取消订阅的金融工具。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
        """
        ...

    def unsubscribe_instrument_status(
        self, instrument_id: "InstrumentId", client_id: "ClientId" = None
    ) -> None:
        """
        Unsubscribe to status updates of the given venue.
        取消订阅给定交易场所的状态更新。

        Parameters:
            instrument_id (InstrumentId) – The instrument to unsubscribe to status updates for.
            instrument_id (InstrumentId) - 要取消订阅状态更新的金融工具。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从交易场所推断出来。
        """
        ...

    def unsubscribe_instruments(self, venue: "Venue", client_id: "ClientId" = None) -> None:
        """
        Unsubscribe from update Instrument data for the given venue.
        取消订阅给定交易场所的更新金融工具数据。

        Parameters:
            venue (Venue) – The venue for the subscription.
            venue (Venue) - 订阅的交易场所。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从交易场所推断出来。
        """
        ...

    def unsubscribe_order_book_at_interval(
        self,
        instrument_id: "InstrumentId",
        interval_ms: int = 1000,
        client_id: "ClientId" = None,
    ) -> None:
        """
        Unsubscribe from an OrderBook at a specified interval for the given instrument ID.
        取消订阅以指定间隔获取给定金融工具 ID 的订单簿。

        The interval must match the previously subscribed interval.
        间隔必须与之前订阅的间隔匹配。

        Parameters:
            instrument_id (InstrumentId) – The order book instrument to subscribe to.
            instrument_id (InstrumentId) - 要订阅的订单簿金融工具。
            interval_ms (int) – The order book snapshot interval in milliseconds.
            interval_ms (int) - 订单簿快照间隔(以毫秒为单位)。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
        """
        ...

    def unsubscribe_order_book_deltas(
        self, instrument_id: "InstrumentId", client_id: "ClientId" = None
    ) -> None:
        """
        Unsubscribe the order book deltas stream for the given instrument ID.
        取消订阅给定金融工具 ID 的订单簿增量流。

        Parameters:
            instrument_id (InstrumentId) – The order book instrument to subscribe to.
            instrument_id (InstrumentId) - 要订阅的订单簿金融工具。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
        """
        ...

    def unsubscribe_quote_ticks(
        self, instrument_id: "InstrumentId", client_id: "ClientId" = None
    ) -> None:
        """
        Unsubscribe from streaming QuoteTick data for the given instrument ID.
        取消订阅给定金融工具 ID 的流式报价 tick 数据。

        Parameters:
            instrument_id (InstrumentId) – The tick instrument to unsubscribe from.
            instrument_id (InstrumentId) - 要取消订阅的 tick 金融工具。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
        """
        ...

    def unsubscribe_trade_ticks(
        self, instrument_id: "InstrumentId", client_id: "ClientId" = None
    ) -> None:
        """
        Unsubscribe from streaming TradeTick data for the given instrument ID.
        取消订阅给定金融工具 ID 的流式交易 tick 数据。

        Parameters:
            instrument_id (InstrumentId) – The tick instrument ID to unsubscribe from.
            instrument_id (InstrumentId) - 要取消订阅的 tick 金融工具 ID。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
        """
        ...

    def update_synthetic(self, synthetic: "SyntheticInstrument") -> None:
        """
        Update the synthetic instrument in the cache.
        更新缓存中的合成金融工具。

        Parameters:
            synthetic (SyntheticInstrument) – The synthetic instrument to update in the cache.
            synthetic (SyntheticInstrument) - 要在缓存中更新的合成金融工具。
        Raises:
            KeyError – If synthetic does not already exist in the cache.
            KeyError - 如果合成金融工具在缓存中不存在。
        """
        ...

class ForexSession 外汇交易时段

class ForexSession(Enum):
    """
    外汇交易时段
    """

    SYDNEY = 1
    TOKYO = 2
    LONDON = 3
    NEW_YORK = 4

class ForexSessionFilter 外汇交易时段过滤器

Provides methods to help filter trading strategy rules dependent on Forex session times.
提供方法来帮助过滤依赖于外汇交易时段的交易策略规则。

class ForexSessionFilter(object):
    """
    Provides methods to help filter trading strategy rules dependent on Forex session times.
    提供方法来帮助过滤依赖于外汇交易时段的交易策略规则。
    """

    @staticmethod
    def local_from_utc(session: "ForexSession", time_now: "datetime") -> "datetime":
        """
        Return the local datetime from the given session and time_now (UTC).
        从给定的交易时段和 time_now (UTC) 返回本地日期时间。

        Parameters:
            session (ForexSession) – The session for the local timezone conversion.
            session (ForexSession) - 用于本地时区转换的交易时段。
            time_now (datetime) – The time now (UTC).
            time_now (datetime) - 当前时间(UTC)。
        Returns:
            The converted local datetime.
            转换后的本地日期时间。
        Return type:
            datetime
        Raises:
            ValueError – If time_now is not tz aware UTC.
            ValueError - 如果 time_now 不是时区感知的 UTC。
        """
        ...

    @staticmethod
    def next_start(session: "ForexSession", time_now: "datetime") -> "datetime":
        """
        Return the next session start.
        返回下一个交易时段的开始时间。

        All FX sessions run Monday to Friday local time.
        所有外汇交易时段都在当地时间周一至周五运行。

        Sydney Session 0700-1600 ‘Australia/Sydney’

        Tokyo Session 0900-1800 ‘Asia/Tokyo’

        London Session 0800-1600 ‘Europe/London’

        New York Session 0800-1700 ‘America/New_York’

        Parameters:
            session (ForexSession) – The session for the start datetime.
            session (ForexSession) - 开始日期时间的交易时段。
            time_now (datetime) – The datetime now.
            time_now (datetime) - 当前日期时间。
        Return type:
            datetime
        Raises:
            ValueError – If time_now is not tz aware UTC.
            ValueError - 如果 time_now 不是时区感知的 UTC。
        """
        ...

    @staticmethod
    def prev_start(session: "ForexSession", time_now: "datetime") -> "datetime":
        """
        Return the previous session start.
        返回上一个交易时段的开始时间。

        All FX sessions run Monday to Friday local time.
        所有外汇交易时段都在当地时间周一至周五运行。

        Sydney Session 0700-1600 ‘Australia/Sydney’

        Tokyo Session 0900-1800 ‘Asia/Tokyo’

        London Session 0800-1600 ‘Europe/London’

        New York Session 0800-1700 ‘America/New_York’

        Parameters:
            session (ForexSession) – The session for the start datetime.
            session (ForexSession) - 开始日期时间的交易时段。
            time_now (datetime) – The datetime now.
            time_now (datetime) - 当前日期时间。
        Return type:
            datetime
        Raises:
            ValueError – If time_now is not tz aware UTC.
            ValueError - 如果 time_now 不是时区感知的 UTC。
        """
        ...

    @staticmethod
    def next_end(session: "ForexSession", time_now: "datetime") -> "datetime":
        """
        Return the next session end.
        返回下一个交易时段的结束时间。

        All FX sessions run Monday to Friday local time.
        所有外汇交易时段都在当地时间周一至周五运行。

        Sydney Session 0700-1600 ‘Australia/Sydney’

        Tokyo Session 0900-1800 ‘Asia/Tokyo’

        London Session 0800-1600 ‘Europe/London’

        New York Session 0800-1700 ‘America/New_York’

        Parameters:
            session (ForexSession) – The session for the end datetime.
            session (ForexSession) - 结束日期时间的交易时段。
            time_now (datetime) – The datetime now (UTC).
            time_now (datetime) - 当前日期时间(UTC)。
        Return type:
            datetime
        Raises:
            ValueError – If time_now is not tz aware UTC.
            ValueError - 如果 time_now 不是时区感知的 UTC。
        """
        ...

    @staticmethod
    def prev_end(session: "ForexSession", time_now: "datetime") -> "datetime":
        """
        Return the previous sessions end.
        返回上一个交易时段的结束时间。

        All FX sessions run Monday to Friday local time.
        所有外汇交易时段都在当地时间周一至周五运行。

        Sydney Session 0700-1600 ‘Australia/Sydney’

        Tokyo Session 0900-1800 ‘Asia/Tokyo’

        London Session 0800-1600 ‘Europe/London’

        New York Session 0800-1700 ‘America/New_York’

        Parameters:
            session (ForexSession) – The session for end datetime.
            session (ForexSession) - 结束日期时间的交易时段。
            time_now (datetime) – The datetime now.
            time_now (datetime) - 当前日期时间。
        Return type:
            datetime
        Raises:
            ValueError – If time_now is not tz aware UTC.
            ValueError - 如果 time_now 不是时区感知的 UTC。
        """
        ...

class NewsImpact 新闻影响

class NewsImpact(Enum):
    """
    新闻影响
    """

    NONE = 1
    LOW = 2
    MEDIUM = 3
    HIGH = 4

class NewsEvent 新闻事件

class NewsEvent(Data):
    """
    Represents an economic news event. 
    表示一个经济新闻事件。

    Parameters:
        impact (NewsImpact) – The expected impact for the economic news event. 
        impact (NewsImpact) - 经济新闻事件的预期影响。
        name (str) – The name of the economic news event. 
        name (str) - 经济新闻事件的名称。
        currency (Currency) – The currency the economic news event is expected to affect. 
        currency (Currency) - 预计经济新闻事件将影响的货币。
        ts_event (int) – UNIX timestamp (nanoseconds) when the news event occurred. 
        ts_event (int) - 新闻事件发生时的 UNIX 时间戳(纳秒)。
        ts_init (int) – UNIX timestamp (nanoseconds) when the data object was initialized. 
        ts_init (int) - 数据对象初始化时的 UNIX 时间戳(纳秒)。
    """

    @property
    def impact(self) -> "NewsImpact":
        ...

    @property
    def name(self) -> str:
        ...

    @property
    def currency(self) -> "Currency":
        ...

    @property
    def ts_event(self) -> int:
        """
        int

        UNIX timestamp (nanoseconds) when the data event occurred. 
        数据事件发生时的 UNIX 时间戳(纳秒)。

        Return type:
            int
        Type:
            Data.ts_event
        """
        ...

    @property
    def ts_init(self) -> int:
        """
        int

        UNIX timestamp (nanoseconds) when the object was initialized. 
        对象初始化时的 UNIX 时间戳(纳秒)。

        Return type:
            int
        Type:
            Data.ts_init
        """
        ...

    @classmethod
    def fully_qualified_name(cls) -> str:
        """
        Return the fully qualified name for the Data class. 
        返回数据类的完全限定名称。

        Return type:
            str
        """
        ...

    @classmethod
    def is_signal(cls, name: str = "") -> bool:
        """
        Determine if the current class is a signal type, optionally checking for a specific signal name. 
        确定当前类是否为信号类型,可以选择检查特定的信号名称。

        Parameters:
            name (str , optional) – The specific signal name to check. If name not provided or if an empty string is passed, the method checks whether the class name indicates a general signal type. If name is provided, the method checks if the class name corresponds to that specific signal. 
            name (str,可选) - 要检查的特定信号名称。如果没有提供名称或传递空字符串,则该方法会检查类名是否指示通用信号类型。如果提供了名称,则该方法会检查类名是否对应于该特定信号。
        Returns:
            True if the class name matches the signal type or the specific signal name, otherwise False. 
            如果类名与信号类型或特定信号名称匹配,则返回 True,否则返回 False。
        Return type:
            bool
        """
        ...

class EconomicNewsEventFilter 经济新闻事件过滤器

Provides methods to help filter trading strategy rules based on economic news events.
提供方法来帮助根据经济新闻事件过滤交易策略规则。

Parameters: currencies (list *[*str ]) – The list of three letter currency codes to filter.
currencies (list *[*str ]) - 要过滤的三字母货币代码列表。 impacts (list *[*str ]) – The list of impact levels to filter (‘LOW’, ‘MEDIUM’, ‘HIGH’).
impacts (list *[*str ]) - 要过滤的影响级别列表(“LOW”、“MEDIUM”、“HIGH”)。 news_data (pd.DataFrame) – The economic news data.
news_data (pd.DataFrame) - 经济新闻数据。

class EconomicNewsEventFilter(object):
    """
    Provides methods to help filter trading strategy rules based on economic news events.
    提供方法来帮助根据经济新闻事件过滤交易策略规则。

    Parameters:
        currencies (list *[*str ]) – The list of three letter currency codes to filter.
        currencies (list *[*str ]) - 要过滤的三字母货币代码列表。
        impacts (list *[*str ]) – The list of impact levels to filter (‘LOW’, ‘MEDIUM’, ‘HIGH’).
        impacts (list *[*str ]) - 要过滤的影响级别列表(“LOW”、“MEDIUM”、“HIGH”)。
        news_data (pd.DataFrame) – The economic news data.
        news_data (pd.DataFrame) - 经济新闻数据。
    """

    @property
    def unfiltered_data_start(self):
        """
        Return the start of the raw data.
        返回原始数据的开始时间。

        Return type:
            datetime
        """
        ...

    @property
    def unfiltered_data_end(self):
        """
        Return the end of the raw data.
        返回原始数据的结束时间。

        Return type:
            datetime
        """
        ...

    @property
    def currencies(self) -> list[str]:
        """
        Return the currencies the data is filtered on.
        返回数据过滤的货币。

        Return type:
            list[str]
        """
        ...

    @property
    def impacts(self) -> list[str]:
        """
        Return the news impacts the data is filtered on.
        返回数据过滤的新闻影响。

        Return type:
            list[str]
        """
        ...

    def next_event(self, time_now: "datetime") -> "NewsEvent" | None:
        """
        Return the next news event matching the filter conditions. Will return None if no news events match the filter conditions.
        返回与过滤器条件匹配的下一个新闻事件。如果没有任何新闻事件与过滤器条件匹配,则返回 None。

        Parameters:
            time_now (datetime) – The current time.
            time_now (datetime) - 当前时间。
        Returns:
            The next news event in the filtered data if any.
            如果存在,则返回过滤数据中的下一个新闻事件。
        Return type:
            NewsEvent or None
        Raises:
            ValueError – The time_now < self.unfiltered_data_start.
            ValueError - time_now < self.unfiltered_data_start。
            ValueError – The time_now > self.unfiltered_data_end.
            ValueError - time_now > self.unfiltered_data_end。
            ValueError – If time_now is not tz aware UTC.
            ValueError - 如果 time_now 不是时区感知的 UTC。
        """
        ...

    def prev_event(self, time_now: "datetime") -> "NewsEvent" | None:
        """
        Return the previous news event matching the initial filter conditions. Will return None if no news events match the filter conditions.
        返回与初始过滤器条件匹配的上一个新闻事件。如果没有任何新闻事件与过滤器条件匹配,则返回 None。

        Parameters:
            time_now (datetime) – The current time.
            time_now (datetime) - 当前时间。
        Returns:
            The previous news event in the filtered data if any.
            如果存在,则返回过滤数据中的上一个新闻事件。
        Return type:
            NewsEvent or None
        Raises:
            ValueError – The time_now < self.unfiltered_data_start.
            ValueError - time_now < self.unfiltered_data_start。
            ValueError – The time_now > self.unfiltered_data_end.
            ValueError - time_now > self.unfiltered_data_end。
            ValueError – If time_now is not tz aware UTC.
            ValueError - 如果 time_now 不是时区感知的 UTC。
        """
        ...

This module defines a trading strategy class which allows users to implement their own customized trading strategies
此模块定义了一个交易策略类,允许用户实现自己的自定义交易策略

A user can inherit from Strategy and optionally override any of the “on” named event methods. The class is not entirely initialized in a stand-alone way, the intended usage is to pass strategies to a Trader so that they can be fully “wired” into the platform. Exceptions will be raised if a Strategy attempts to operate without a managing Trader instance.
用户可以继承 Strategy 并选择性地覆盖任何以“on”命名的事件方法。该类并非完全以独立的方式初始化,其预期用法是将策略传递给 Trader,以便它们可以完全“连接”到平台中。如果 Strategy 尝试在没有管理 Trader 实例的情况下运行,则会引发异常。

class Strategy 策略

class Strategy(Actor):
    """
    Strategy(config: StrategyConfig | None = None)

    The base class for all trading strategies.
    所有交易策略的基类。

    This class allows traders to implement their own customized trading strategies. A trading strategy can configure its own order management system type, which determines how positions are handled by the ExecutionEngine.
    此类允许交易者实现他们自己的自定义交易策略。交易策略可以配置自己的订单管理系统类型,该类型决定了执行引擎如何处理头寸。

    Strategy OMS (Order Management System) types: :
    策略OMS(订单管理系统)类型::
     - UNSPECIFIED: No specific type has been configured, will therefore default to the native OMS type for each venue.

    HEDGING: A position ID will be assigned for each new position which is opened per instrument.
    HEDGING:每个金融工具开仓的每个新头寸都将分配一个头寸 ID。
    NETTING: There will only be a single position for the strategy per instrument. The position ID naming convention is {instrument_id}-{strategy_id}.
    NETTING:每个金融工具的每个策略只有一个头寸。头寸 ID 的命名约定是 {instrument_id}-{strategy_id}。
    Parameters:
        config (StrategyConfig , optional) – The trading strategy configuration.
        config (StrategyConfig,可选) - 交易策略配置。
    Raises:
        TypeError – If config is not of type StrategyConfig.
        TypeError - 如果 config 的类型不是 StrategyConfig。
    WARNING
        This class should not be used directly, but through a concrete subclass.
        此类不应直接使用,而应通过具体的子类使用。
        Do not call components such as clock and logger in the __init__ prior to registration.
        在注册之前,不要在 __init__ 中调用时钟和记录器等组件。
    """

    def active_task_ids(self) -> list:
        """
        Return the active task identifiers.
        返回活动任务标识符。

        Return type:
            list[TaskId]
        """
        ...

    def add_synthetic(self, synthetic: "SyntheticInstrument") -> None:
        """
        Add the created synthetic instrument to the cache.
        将创建的合成金融工具添加到缓存。

        Parameters:
            synthetic (SyntheticInstrument) – The synthetic instrument to add to the cache.
            synthetic (SyntheticInstrument) - 要添加到缓存的合成金融工具。
        Raises:
            KeyError – If synthetic is already in the cache.
            KeyError - 如果合成金融工具已在缓存中。
        """
        ...

    @property
    def cache(self) -> "CacheFacade":
        """
        The read-only cache for the actor.
        actor 的只读缓存。

        Returns:
            CacheFacade
        """
        ...

    def cancel_all_orders(
        self,
        instrument_id: "InstrumentId",
        order_side: "OrderSide" = OrderSide.NO_ORDER_SIDE,
        client_id: "ClientId" = None,
    ) -> None:
        """
        Cancel all orders for this strategy for the given instrument ID.
        取消此策略针对给定金融工具 ID 的所有订单。

        A CancelAllOrders command will be created and then sent to both the OrderEmulator and the ExecutionEngine.
        将创建一个 CancelAllOrders 命令,然后将其发送到订单模拟器和执行引擎。

        Parameters:
            instrument_id (InstrumentId) – The instrument for the orders to cancel.
            instrument_id (InstrumentId) - 要取消订单的金融工具。
            order_side (OrderSide, default NO_ORDER_SIDE (both sides)) – The side of the orders to cancel.
            order_side (OrderSide, 默认 NO_ORDER_SIDE(双边)) - 要取消订单的方向。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
        """
        ...

    def cancel_all_tasks(self) -> None:
        """
        Cancel all queued and active tasks.
        取消所有排队的和活动的 task。
        """
        ...

    def cancel_gtd_expiry(self, order: "Order") -> None:
        """
        Cancel the managed GTD expiry for the given order.
        取消给定订单的托管 GTD 到期。

        If there is no current GTD expiry timer, then an error will be logged.
        如果没有当前的 GTD 到期计时器,则会记录一个错误。

        Parameters:
            order (Order) – The order to cancel the GTD expiry for.
            order (Order) - 要取消 GTD 到期的订单。
        """
        ...

    def cancel_order(self, order: "Order", client_id: "ClientId" = None) -> None:
        """
        Cancel the given order with optional routing instructions.
        取消给定订单,并使用可选的路由指令。

        A CancelOrder command will be created and then sent to either the OrderEmulator or the ExecutionEngine (depending on whether the order is emulated).
        将创建一个 CancelOrder 命令,然后将其发送到订单模拟器或执行引擎(取决于订单是否被模拟)。

        Parameters:
            order (Order) – The order to cancel.
            order (Order) - 要取消的订单。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
        """
        ...

    def cancel_orders(self, orders: list, client_id: "ClientId" = None) -> None:
        """
        Batch cancel the given list of orders with optional routing instructions.
        批量取消给定的订单列表,并使用可选的路由指令。

        For each order in the list, a CancelOrder command will be created and added to a BatchCancelOrders command. This command is then sent to the ExecutionEngine.
        对于列表中的每个订单,将创建一个 CancelOrder 命令并将其添加到 BatchCancelOrders 命令中。然后将此命令发送到执行引擎。

        Logs an error if the orders list contains local/emulated orders.
        如果订单列表包含本地/模拟订单,则会记录一个错误。

        Parameters:
            orders (list [Order ]) – The orders to cancel.
            orders (list [Order ]) - 要取消的订单。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
        Raises:
            ValueError – If orders is empty.
            ValueError - 如果 orders 为空。
            TypeError – If orders contains a type other than Order.
            TypeError - 如果 orders 包含 Order 以外的类型。
        """
        ...

    def cancel_task(self, task_id: "TaskId") -> None:
        """
        Cancel the task with the given task_id (if queued or active).
        取消具有给定 task_id 的任务(如果已排队或活动)。

        If the task is not found then a warning is logged.
        如果未找到任务,则记录警告。

        Parameters:
            task_id (TaskId) – The task identifier.
            task_id (TaskId) - 任务标识符。
        """
        ...

    def change_id(self, strategy_id: "StrategyId") -> None:
        """
        Change the strategies identifier to the given strategy_id.
        将策略标识符更改为给定的 strategy_id。

        Parameters:
            strategy_id (StrategyId) – The new strategy ID to change to.
            strategy_id (StrategyId) - 要更改为的新策略 ID。
        """
        ...

    def change_order_id_tag(self, order_id_tag: str) -> None:
        """
        Change the order identifier tag to the given order_id_tag.
        将订单标识符标签更改为给定的 order_id_tag。

        Parameters:
            order_id_tag (str) – The new order ID tag to change to.
            order_id_tag (str) - 要更改为的新订单 ID 标签。
        """
        ...

    @property
    def clock(self) -> "Clock":
        """
        The actors clock.
        actor 的时钟。

        Returns:
            Clock
        """
        ...

    def close_all_positions(
        self,
        instrument_id: "InstrumentId",
        position_side: "PositionSide" = PositionSide.NO_POSITION_SIDE,
        client_id: "ClientId" = None,
        tags: list = None,
    ) -> None:
        """
        Close all positions for the given instrument ID for this strategy.
        平仓此策略针对给定金融工具 ID 的所有头寸。

        Parameters:
            instrument_id (InstrumentId) – The instrument for the positions to close.
            instrument_id (InstrumentId) - 要平仓头寸的金融工具。
            position_side (PositionSide, default NO_POSITION_SIDE (both sides)) – The side of the positions to close.
            position_side (PositionSide, 默认 NO_POSITION_SIDE(双边)) - 要平仓头寸的方向。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
            tags (list *[*str ] , optional) – The tags for the market orders closing the positions.
            tags (list *[*str ], 可选) - 平仓头寸的市价单的标签。
        """
        ...

    def close_position(
        self, position: "Position", client_id: "ClientId" = None, tags: list = None
    ) -> None:
        """
        Close the given position.
        平仓给定的头寸。

        A closing MarketOrder for the position will be created, and then sent to the ExecutionEngine via a SubmitOrder command.
        将为该头寸创建一个平仓市价单,然后通过 SubmitOrder 命令将其发送到执行引擎。

        Parameters:
            position (Position) – The position to close.
            position (Position) - 要平仓的头寸。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
            tags (list *[*str ] , optional) – The tags for the market order closing the position.
            tags (list *[*str ], 可选) - 平仓头寸的市价单的标签。
        """
        ...

    @property
    def config(self) -> "NautilusConfig":
        """
        The actors configuration.
        actor 的配置。

        Returns:
            NautilusConfig
        """
        ...

    def degrade(self) -> None:
        """
        Degrade the component.
        降级组件。

        While executing on_degrade() any exception will be logged and reraised, then the component will remain in a DEGRADING state.
        在执行 on_degrade() 时,任何异常都将被记录并重新引发,然后组件将保持在 DEGRADING 状态。

        WARNING
            Do not override.
            不要覆盖。

        If the component is not in a valid state from which to execute this method, then the component state will not change, and an error will be logged.
        如果组件处于无效状态,无法执行此方法,则组件状态将不会更改,并且会记录错误。
        """
        ...

    def deregister_warning_event(self, event: type) -> None:
        """
        Deregister the given event type from warning log levels.
        从警告日志级别取消注册给定的事件类型。

        Parameters:
            event (type) – The event class to deregister.
            event (type) - 要取消注册的事件类。
        """
        ...

    def dispose(self) -> None:
        """
        Dispose of the component.
        处理组件。

        While executing on_dispose() any exception will be logged and reraised, then the component will remain in a DISPOSING state.
        在执行 on_dispose() 时,任何异常都将被记录并重新引发,然后组件将保持在 DISPOSING 状态。

        WARNING
            Do not override.
            不要覆盖。

        If the component is not in a valid state from which to execute this method, then the component state will not change, and an error will be logged.
        如果组件处于无效状态,无法执行此方法,则组件状态将不会更改,并且会记录错误。
        """
        ...

    @property
    def external_order_claims(self) -> list["InstrumentId"]:
        """
        The external order claims instrument IDs for the strategy.
        策略的外部订单声明金融工具 ID。

        Returns:
            list[InstrumentId]
        """
        ...

    def fault(self) -> None:
        """
        Fault the component.
        使组件出错。

        Calling this method multiple times has the same effect as calling it once (it is idempotent). Once called, it cannot be reversed, and no other methods should be called on this instance.
        多次调用此方法与调用一次具有相同的效果(它是幂等的)。一旦调用,它就无法撤消,并且不应在此实例上调用任何其他方法。

        While executing on_fault() any exception will be logged and reraised, then the component will remain in a FAULTING state.
        在执行 on_fault() 时,任何异常都将被记录并重新引发,然后组件将保持在 FAULTING 状态。

        WARNING
            Do not override.
            不要覆盖。

        If the component is not in a valid state from which to execute this method, then the component state will not change, and an error will be logged.
        如果组件处于无效状态,无法执行此方法,则组件状态将不会更改,并且会记录错误。
        """
        ...

    @classmethod
    def fully_qualified_name(cls) -> str:
        """
        Return the fully qualified name for the components class.
        返回组件类的完全限定名称。

        Return type:
            str
        """
        ...

    def handle_bar(self, bar: "Bar") -> None:
        """
        Handle the given bar data.
        处理给定的K线数据。

        If state is RUNNING then passes to on_bar.
        如果状态为 RUNNING,则传递给 on_bar。

        Parameters:
            bar (Bar) – The bar received.
            bar (Bar) - 收到的K线。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def handle_bars(self, bars: list) -> None:
        """
        Handle the given historical bar data by handling each bar individually.
        通过分别处理每个K线来处理给定的历史K线数据。

        Parameters:
            bars (list [Bar ]) – The bars to handle.
            bars (list [Bar ]) - 要处理的K线。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def handle_data(self, data: "Data") -> None:
        """
        Handle the given data.
        处理给定的数据。

        If state is RUNNING then passes to on_data.
        如果状态为 RUNNING,则传递给 on_data。

        Parameters:
            data (Data) – The data received.
            data (Data) - 收到的数据。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def handle_event(self, event: "Event") -> None:
        """
        Handle the given event.
        处理给定的事件。

        If state is RUNNING then passes to on_event.
        如果状态为 RUNNING,则传递给 on_event。

        Parameters:
            event (Event) – The event received.
            event (Event) - 收到的事件。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def handle_historical_data(self, data) -> None:
        """
        Handle the given historical data.
        处理给定的历史数据。

        Parameters:
            data (Data) – The historical data received.
            data (Data) - 收到的历史数据。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def handle_instrument(self, instrument: "Instrument") -> None:
        """
        Handle the given instrument.
        处理给定的金融工具。

        Passes to on_instrument if state is RUNNING.
        如果状态为 RUNNING,则传递给 on_instrument。

        Parameters:
            instrument (Instrument) – The instrument received.
            instrument (Instrument) - 收到的金融工具。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def handle_instrument_close(self, update: "InstrumentClose") -> None:
        """
        Handle the given instrument close update.
        处理给定的金融工具收盘价更新。

        If state is RUNNING then passes to on_instrument_close.
        如果状态为 RUNNING,则传递给 on_instrument_close。

        Parameters:
            update (InstrumentClose) – The update received.
            update (InstrumentClose) - 收到的更新。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def handle_instrument_status(self, data: "InstrumentStatus") -> None:
        """
        Handle the given instrument status update.
        处理给定的金融工具状态更新。

        If state is RUNNING then passes to on_instrument_status.
        如果状态为 RUNNING,则传递给 on_instrument_status。

        Parameters:
            data (InstrumentStatus) – The status update received.
            data (InstrumentStatus) - 收到的状态更新。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def handle_instruments(self, instruments: list) -> None:
        """
        Handle the given instruments data by handling each instrument individually.
        通过单独处理每个金融工具来处理给定的金融工具数据。

        Parameters:
            instruments (list [Instrument ]) – The instruments received.
            instruments (list [Instrument ]) - 收到的金融工具。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def handle_order_book(self, order_book: "OrderBook") -> None:
        """
        Handle the given order book.
        处理给定的订单簿。

        Passes to on_order_book if state is RUNNING.
        如果状态为 RUNNING,则传递给 on_order_book。

        Parameters:
            order_book (OrderBook) – The order book received.
            order_book (OrderBook) - 收到的订单簿。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def handle_order_book_deltas(self, deltas) -> None:
        """
        Handle the given order book deltas.
        处理给定的订单簿增量。

        Passes to on_order_book_deltas if state is RUNNING. The deltas will be nautilus_pyo3.OrderBookDeltas if the pyo3_conversion flag was set for the subscription.
        如果状态为 RUNNING,则传递给 on_order_book_deltas。如果订阅设置了 pyo3_conversion 标志,则增量将为 nautilus_pyo3.OrderBookDeltas。

        Parameters:
            deltas (OrderBookDeltas or nautilus_pyo3.OrderBookDeltas) – The order book deltas received.
            deltas (OrderBookDeltas 或 nautilus_pyo3.OrderBookDeltas) - 收到的订单簿增量。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def handle_quote_tick(self, tick: "QuoteTick") -> None:
        """
        Handle the given quote tick.
        处理给定的报价 tick。

        If state is RUNNING then passes to on_quote_tick.
        如果状态为 RUNNING,则传递给 on_quote_tick。

        Parameters:
            tick (QuoteTick) – The tick received.
            tick (QuoteTick) - 收到的 tick。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def handle_quote_ticks(self, ticks: list) -> None:
        """
        Handle the given historical quote tick data by handling each tick individually.
        通过单独处理每个 tick 来处理给定的历史报价 tick 数据。

        Parameters:
            ticks (list [QuoteTick ]) – The ticks received.
            ticks (list [QuoteTick ]) - 收到的 tick。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def handle_trade_tick(self, tick: "TradeTick") -> None:
        """
        Handle the given trade tick.
        处理给定的交易 tick。

        If state is RUNNING then passes to on_trade_tick.
        如果状态为 RUNNING,则传递给 on_trade_tick。

        Parameters:
            tick (TradeTick) – The tick received.
            tick (TradeTick) - 收到的 tick。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def handle_trade_ticks(self, ticks: list) -> None:
        """
        Handle the given historical trade tick data by handling each tick individually.
        通过单独处理每个 tick 来处理给定的历史交易 tick 数据。

        Parameters:
            ticks (list [TradeTick ]) – The ticks received.
            ticks (list [TradeTick ]) - 收到的 tick。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def has_active_tasks(self) -> bool:
        """
        Return a value indicating whether there are any active tasks.
        返回值指示是否有任何活动 task。

        Return type:
            bool
        """
        ...

    def has_any_tasks(self) -> bool:
        """
        Return a value indicating whether there are any queued or active tasks.
        返回值指示是否有任何排队或活动的 task。

        Return type:
            bool
        """
        ...

    def has_pending_requests(self) -> bool:
        """
        Return whether the actor is pending processing for any requests.
        返回 actor 是否正在等待处理任何请求。

        Returns:
            True if any requests are pending, else False.
            如果有任何待处理的请求,则返回 True,否则返回 False。
        Return type:
            bool
        """
        ...

    def has_queued_tasks(self) -> bool:
        """
        Return a value indicating whether there are any queued tasks.
        返回值指示是否有任何排队 task。

        Return type:
            bool
        """
        ...

    @property
    def id(self) -> "ComponentId":
        """
        The components ID.
        组件 ID。

        Returns:
            ComponentId
        """
        ...

    def indicators_initialized(self) -> bool:
        """
        Return a value indicating whether all indicators are initialized.
        返回值指示是否所有指标都已初始化。

        Returns:
            True if all initialized, else False
            如果所有指标都已初始化,则返回 True,否则返回 False
        Return type:
            bool
        """
        ...

    @property
    def is_degraded(self) -> bool:
        """
        bool

        Return whether the current component state is DEGRADED.
        返回当前组件状态是否为 DEGRADED。

        Return type:
            bool
        Type:
            Component.is_degraded
        """
        ...

    @property
    def is_disposed(self) -> bool:
        """
        bool

        Return whether the current component state is DISPOSED.
        返回当前组件状态是否为 DISPOSED。

        Return type:
            bool
        Type:
            Component.is_disposed
        """
        ...

    @property
    def is_faulted(self) -> bool:
        """
        bool

        Return whether the current component state is FAULTED.
        返回当前组件状态是否为 FAULTED。

        Return type:
            bool
        Type:
            Component.is_faulted
        """
        ...

    @property
    def is_initialized(self) -> bool:
        """
        bool

        Return whether the component has been initialized (component.state >= INITIALIZED).
        返回组件是否已初始化 (component.state >= INITIALIZED)。

        Return type:
            bool
        Type:
            Component.is_initialized
        """
        ...

    def is_pending_request(self, request_id: "UUID4") -> bool:
        """
        Return whether the request for the given identifier is pending processing.
        返回给定标识符的请求是否正在等待处理。

        Parameters:
            request_id (UUID4) – The request ID to check.
            request_id (UUID4) - 要检查的请求 ID。
        Returns:
            True if request is pending, else False.
            如果请求正在等待,则返回 True,否则返回 False。
        Return type:
            bool
        """
        ...

    @property
    def is_running(self) -> bool:
        """
        bool

        Return whether the current component state is RUNNING.
        返回当前组件状态是否为 RUNNING。

        Return type:
            bool
        Type:
            Component.is_running
        """
        ...

    @property
    def is_stopped(self) -> bool:
        """
        bool

        Return whether the current component state is STOPPED.
        返回当前组件状态是否为 STOPPED。

        Return type:
            bool
        Type:
            Component.is_stopped
        """
        ...

    def load(self, state: dict) -> None:
        """
        Load the actor/strategy state from the give state dictionary.
        从给定的状态字典加载 actor/策略状态。

        Calls on_load and passes the state.
        调用 on_load 并传递状态。

        Parameters:
            state (dict *[*str , object ]) – The state dictionary.
            state (dict *[*str , object ]) - 状态字典。
        Raises:
            RuntimeError – If actor/strategy is not registered with a trader.
            RuntimeError - 如果 actor/策略未注册到交易者。
        WARNING
            Exceptions raised will be caught, logged, and reraised.
            引发的异常将被捕获、记录并重新引发。
        """
        ...

    @property
    def log(self) -> "Logger":
        """
        The actors logger.
        actor 的日志记录器。

        Returns:
            Logger
        """
        ...

    @property
    def manage_contingent_orders(self) -> bool:
        """
        If contingent orders should be managed automatically by the strategy.
        如果策略应自动管理条件订单。

        Returns:
            bool
        """
        ...

    @property
    def manage_gtd_expiry(self) -> bool:
        """
        If all order GTD time in force expirations should be managed automatically by the strategy.
        如果策略应自动管理所有订单的 GTD 有效时间到期。

        Returns:
            bool
        """
        ...

    def modify_order(
        self,
        order: "Order",
        quantity: "Quantity" = None,
        price: "Price" = None,
        trigger_price: "Price" = None,
        client_id: "ClientId" = None,
    ) -> None:
        """
        Modify the given order with optional parameters and routing instructions.
        修改给定的订单,并使用可选的参数和路由指令。

        An ModifyOrder command will be created and then sent to either the OrderEmulator or the RiskEngine (depending on whether the order is emulated).
        将创建一个 ModifyOrder 命令,然后将其发送到订单模拟器或风险引擎(取决于订单是否被模拟)。

        At least one value must differ from the original order for the command to be valid.
        至少有一个值必须与原始订单不同,命令才有效。

        Will use an Order Cancel/Replace Request (a.k.a Order Modification) for FIX protocols, otherwise if order update is not available for the API, then will cancel and replace with a new order using the original ClientOrderId.
        将对 FIX 协议使用订单取消/替换请求(也称为订单修改),否则,如果 API 不支持订单更新,则将使用原始 ClientOrderId 取消并替换为新订单。

        Parameters:
            order (Order) – The order to update.
            order (Order) - 要更新的订单。
            quantity (Quantity , optional) – The updated quantity for the given order.
            quantity (Quantity, 可选) - 给定订单的更新数量。
            price (Price , optional) – The updated price for the given order (if applicable).
            price (Price, 可选) - 给定订单的更新价格(如果适用)。
            trigger_price (Price , optional) – The updated trigger price for the given order (if applicable).
            trigger_price (Price, 可选) - 给定订单的更新触发价格(如果适用)。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
        Raises:
            ValueError – If price is not None and order does not have a price.
            ValueError - 如果 price 不为 None 且订单没有价格。
            ValueError – If trigger is not None and order does not have a trigger_price.
            ValueError - 如果 trigger 不为 None 且订单没有 trigger_price。
        WARNING
            If the order is already closed or at PENDING_CANCEL status then the command will not be generated, and a warning will be logged.
            如果订单已平仓或处于 PENDING_CANCEL 状态,则不会生成命令,并将记录一条警告。
        """
        ...

    @property
    def msgbus(self) -> "MessageBus" or None:
        """
        The message bus for the actor (if registered).
        actor 的消息总线(如果已注册)。

        Returns:
            MessageBus or None
        """
        ...

    @property
    def oms_type(self) -> "OmsType":
        """
        The order management system for the strategy.
        策略的订单管理系统。

        Returns:
            OmsType
        """
        ...

    def on_bar(self, bar: "Bar") -> None:
        """
        Actions to be performed when running and receives a bar.
        运行并接收K线时要执行的操作。

        Parameters:
            bar (Bar) – The bar received.
            bar (Bar) - 收到的K线。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_data(self, data) -> None:
        """
        Actions to be performed when running and receives data.
        运行并接收数据时要执行的操作。

        Parameters:
            data (Data) – The data received.
            data (Data) - 收到的数据。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_degrade(self) -> None:
        """
        Actions to be performed on degrade.
        降级时要执行的操作。

        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。

        Should be overridden in the actor implementation.
        应该在 actor 实现中覆盖。
        """
        ...

    def on_dispose(self) -> None:
        """
        Actions to be performed on dispose.
        处置时要执行的操作。

        Cleanup/release any resources used here.
        在此处清理/释放任何使用的资源。

        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_event(self, event: "Event") -> None:
        """
        Actions to be performed running and receives an event.
        运行并接收事件时要执行的操作。

        Parameters:
            event (Event) – The event received.
            event (Event) - 收到的事件。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_fault(self) -> None:
        """
        Actions to be performed on fault.
        故障时要执行的操作。

        Cleanup any resources used by the actor here.
        在此处清理 actor 使用的任何资源。

        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。

        Should be overridden in the actor implementation.
        应该在 actor 实现中覆盖。
        """
        ...

    def on_historical_data(self, data) -> None:
        """
        Actions to be performed when running and receives historical data.
        运行并接收历史数据时要执行的操作。

        Parameters:
            data (Data) – The historical data received.
            data (Data) - 收到的历史数据。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_instrument(self, instrument: "Instrument") -> None:
        """
        Actions to be performed when running and receives an instrument.
               运行并接收金融工具时要执行的操作。

        Parameters:
            instrument (Instrument) – The instrument received.
            instrument (Instrument) - 收到的金融工具。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_instrument_close(self, update: "InstrumentClose") -> None:
        """
        Actions to be performed when running and receives an instrument close update.
        运行并接收金融工具收盘价更新时要执行的操作。

        Parameters:
            update (InstrumentClose) – The instrument close received.
            update (InstrumentClose) - 收到的金融工具收盘价。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_instrument_status(self, data: "InstrumentStatus") -> None:
        """
        Actions to be performed when running and receives an instrument status update.
        运行并接收金融工具状态更新时要执行的操作。

        Parameters:
            data (InstrumentStatus) – The instrument status update received.
            data (InstrumentStatus) - 收到的金融工具状态更新。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_load(self, state: dict) -> None:
        """
        Actions to be performed when the actor state is loaded.
        加载 actor 状态时要执行的操作。

        Saved state values will be contained in the give state dictionary.
        保存的状态值将包含在给定的状态字典中。

        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_order_accepted(self, event: "OrderAccepted") -> None:
        """
        Actions to be performed when running and receives an order accepted event.
        运行并收到订单接受事件时要执行的操作。

        Parameters:
            event (OrderAccepted) – The event received.
            event (OrderAccepted) - 收到的事件。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_order_book(self, order_book: "OrderBook") -> None:
        """
        Actions to be performed when running and receives an order book.
        运行并接收订单簿时要执行的操作。

        Parameters:
            order_book (OrderBook) – The order book received.
            order_book (OrderBook) - 收到的订单簿。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_order_book_deltas(self, deltas) -> None:
        """
        Actions to be performed when running and receives order book deltas.
        运行并接收订单簿增量时要执行的操作。

        Parameters:
            deltas (OrderBookDeltas or nautilus_pyo3.OrderBookDeltas) – The order book deltas received.
            deltas (OrderBookDeltas 或 nautilus_pyo3.OrderBookDeltas) - 收到的订单簿增量。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_order_cancel_rejected(self, event: "OrderCancelRejected") -> None:
        """
        Actions to be performed when running and receives an order cancel rejected event.
        运行并收到订单取消拒绝事件时要执行的操作。

        Parameters:
            event (OrderCancelRejected) – The event received.
            event (OrderCancelRejected) - 收到的事件。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_order_canceled(self, event: "OrderCanceled") -> None:
        """
        Actions to be performed when running and receives an order canceled event.
        运行并收到订单取消事件时要执行的操作。

        Parameters:
            event (OrderCanceled) – The event received.
            event (OrderCanceled) - 收到的事件。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_order_denied(self, event: "OrderDenied") -> None:
        """
        Actions to be performed when running and receives an order denied event.
        运行并收到订单拒绝事件时要执行的操作。

        Parameters:
            event (OrderDenied) – The event received.
            event (OrderDenied) - 收到的事件。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_order_emulated(self, event: "OrderEmulated") -> None:
        """
        Actions to be performed when running and receives an order initialized event.
        运行并收到订单初始化事件时要执行的操作。

        Parameters:
            event (OrderEmulated) – The event received.
            event (OrderEmulated) - 收到的事件。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_order_event(self, event: "OrderEvent") -> None:
        """
        Actions to be performed when running and receives an order event.
        运行并收到订单事件时要执行的操作。

        Parameters:
            event (OrderEvent) – The event received.
            event (OrderEvent) - 收到的事件。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_order_expired(self, event: "OrderExpired") -> None:
        """
        Actions to be performed when running and receives an order expired event.
        运行并收到订单过期事件时要执行的操作。

        Parameters:
            event (OrderExpired) – The event received.
            event (OrderExpired) - 收到的事件。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_order_filled(self, event: "OrderFilled") -> None:
        """
        Actions to be performed when running and receives an order filled event.
        运行并收到订单成交事件时要执行的操作。

        Parameters:
            event (OrderFilled) – The event received.
            event (OrderFilled) - 收到的事件。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_order_initialized(self, event: "OrderInitialized") -> None:
        """
        Actions to be performed when running and receives an order initialized event.
        运行并收到订单初始化事件时要执行的操作。

        Parameters:
            event (OrderInitialized) – The event received.
            event (OrderInitialized) - 收到的事件。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_order_modify_rejected(self, event: "OrderModifyRejected") -> None:
        """
        Actions to be performed when running and receives an order modify rejected event.
        运行并收到订单修改拒绝事件时要执行的操作。

        Parameters:
            event (OrderModifyRejected) – The event received.
            event (OrderModifyRejected) - 收到的事件。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_order_pending_cancel(self, event: "OrderPendingCancel") -> None:
        """
        Actions to be performed when running and receives an order pending cancel event.
        运行并收到订单待取消事件时要执行的操作。

        Parameters:
            event (OrderPendingCancel) – The event received.
            event (OrderPendingCancel) - 收到的事件。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_order_pending_update(self, event: "OrderPendingUpdate") -> None:
        """
        Actions to be performed when running and receives an order pending update event.
        运行并收到订单待更新事件时要执行的操作。

        Parameters:
            event (OrderPendingUpdate) – The event received.
            event (OrderPendingUpdate) - 收到的事件。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_order_rejected(self, event: "OrderRejected") -> None:
        """
        Actions to be performed when running and receives an order rejected event.
        运行并收到订单拒绝事件时要执行的操作。

        Parameters:
            event (OrderRejected) – The event received.
            event (OrderRejected) - 收到的事件。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_order_released(self, event: "OrderReleased") -> None:
        """
        Actions to be performed when running and receives an order released event.
        运行并收到订单释放事件时要执行的操作。

        Parameters:
            event (OrderReleased) – The event received.
            event (OrderReleased) - 收到的事件。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_order_submitted(self, event: "OrderSubmitted") -> None:
        """
        Actions to be performed when running and receives an order submitted event.
        运行并收到订单提交事件时要执行的操作。

        Parameters:
            event (OrderSubmitted) – The event received.
            event (OrderSubmitted) - 收到的事件。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_order_triggered(self, event: "OrderTriggered") -> None:
        """
        Actions to be performed when running and receives an order triggered event.
        运行并收到订单触发事件时要执行的操作。

        Parameters:
            event (OrderTriggered) – The event received.
            event (OrderTriggered) - 收到的事件。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_order_updated(self, event: "OrderUpdated") -> None:
        """
        Actions to be performed when running and receives an order updated event.
        运行并收到订单更新事件时要执行的操作。

        Parameters:
            event (OrderUpdated) – The event received.
            event (OrderUpdated) - 收到的事件。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_position_changed(self, event: "PositionChanged") -> None:
        """
        Actions to be performed when running and receives a position changed event.
        运行并收到头寸更改事件时要执行的操作。

        Parameters:
            event (PositionChanged) – The event received.
            event (PositionChanged) - 收到的事件。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_position_closed(self, event: "PositionClosed") -> None:
        """
        Actions to be performed when running and receives a position closed event.
        运行并收到头寸平仓事件时要执行的操作。

        Parameters:
            event (PositionClosed) – The event received.
            event (PositionClosed) - 收到的事件。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_position_event(self, event: "PositionEvent") -> None:
        """
        Actions to be performed when running and receives a position event.
        运行并收到头寸事件时要执行的操作。

        Parameters:
            event (PositionEvent) – The event received.
            event (PositionEvent) - 收到的事件。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_position_opened(self, event: "PositionOpened") -> None:
        """
        Actions to be performed when running and receives a position opened event.
        运行并收到头寸开仓事件时要执行的操作。

        Parameters:
            event (PositionOpened) – The event received.
            event (PositionOpened) - 收到的事件。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_quote_tick(self, tick: "QuoteTick") -> None:
        """
        Actions to be performed when running and receives a quote tick.
        运行并接收报价 tick 时要执行的操作。

        Parameters:
            tick (QuoteTick) – The tick received.
            tick (QuoteTick) - 收到的 tick。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_reset(self) -> None:
        ...

    def on_resume(self) -> None:
        ...

    def on_save(self) -> dict:
        """
        Actions to be performed when the actor state is saved.
        保存 actor 状态时要执行的操作。

        Create and return a state dictionary of values to be saved.
        创建并返回要保存的值的状态字典。

        Returns:
            The strategy state dictionary.
            策略状态字典。
        Return type:
            dict[str, bytes]
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def on_start(self) -> None:
        ...

    def on_stop(self) -> None:
        ...

    def on_trade_tick(self, tick: "TradeTick") -> None:
        """
        Actions to be performed when running and receives a trade tick.
        运行并接收交易 tick 时要执行的操作。

        Parameters:
            tick (TradeTick) – The tick received.
            tick (TradeTick) - 收到的 tick。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    @property
    def order_factory(self) -> "OrderFactory":
        """
        The order factory for the strategy.
        策略的订单工厂。

        Returns:
            OrderFactory
        """
        ...

    @property
    def order_id_tag(self) -> str:
        """
        The order ID tag for the strategy.
        策略的订单 ID 标签。

        Returns:
            str
        """
        ...

    def pending_requests(self) -> set:
        """
        Return the request IDs which are currently pending processing.
        返回当前正在等待处理的请求 ID。

        Return type:
            set[UUID4]
        """
        ...

    @property
    def portfolio(self) -> "PortfolioFacade":
        """
        The read-only portfolio for the actor.
        actor 的只读投资组合。

        Returns:
            PortfolioFacade
        """
        ...

    def publish_data(self, data_type: "DataType", data: "Data") -> None:
        """
        Publish the given data to the message bus.
        将给定的数据发布到消息总线。

        Parameters:
            data_type (DataType) – The data type being published.
            data_type (DataType) - 正在发布的数据类型。
            data (Data) – The data to publish.
            data (Data) - 要发布的数据。
        """
        ...

    def publish_signal(self, name: str, value, ts_event: int = 0) -> None:
        """
        Publish the given value as a signal to the message bus.
        将给定的值作为信号发布到消息总线。

        Parameters:
            name (str) – The name of the signal being published. The signal name is case-insensitive and will be capitalized (e.g., ‘example’ becomes ‘SignalExample’).
            name (str) - 正在发布的信号的名称。信号名称不区分大小写,并将大写(例如,“example”将变为“SignalExample”)。
            value (object) – The signal data to publish.
            value (object) - 要发布的信号数据。
            ts_event (uint64_t , optional) – UNIX timestamp (nanoseconds) when the signal event occurred. If None then will timestamp current time.
            ts_event (uint64_t, 可选) - 信号事件发生时的 UNIX 时间戳(纳秒)。如果为 None,则将使用当前时间进行时间戳记。
        """
        ...

    def query_order(self, order: "Order", client_id: "ClientId" = None) -> None:
        """
        Query the given order with optional routing instructions.
        查询给定的订单,并使用可选的路由指令。

        A QueryOrder command will be created and then sent to the ExecutionEngine.
        将创建一个 QueryOrder 命令,然后将其发送到执行引擎。

        Logs an error if no VenueOrderId has been assigned to the order.
        如果订单没有分配 VenueOrderId,则会记录一个错误。

        Parameters:
            order (Order) – The order to query.
            order (Order) - 要查询的订单。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
        """
        ...

    def queue_for_executor(
        self, func: "Callable[..., Any]", args: tuple = None, kwargs: dict = None
    ):
        """
        Queues the callable func to be executed as fn(*args, **kwargs) sequentially.
        将可调用函数 func 排队,以按顺序执行为 fn(*args, **kwargs)。

        Parameters:
            func (Callable) – The function to be executed.
            func (Callable) - 要执行的函数。
            args (positional arguments) – The positional arguments for the call to func.
            args (位置参数) - 对 func 的调用的位置参数。
            kwargs (arbitrary keyword arguments) – The keyword arguments for the call to func.
            kwargs (任意关键字参数) - 对 func 的调用的关键字参数。
        Raises:
            TypeError – If func is not of type Callable.
            TypeError - 如果 func 的类型不是 Callable。
        """
        ...

    def queued_task_ids(self) -> list:
        """
        Return the queued task identifiers.
        返回排队的 task 标识符。

        Return type:
            list[TaskId]
        """
        ...

    def register(
        self,
        trader_id: "TraderId",
        portfolio: "PortfolioFacade",
        msgbus: "MessageBus",
        cache: "CacheFacade",
        clock: "Clock",
    ) -> None:
        """
        Register the strategy with a trader.
        将策略注册到交易者。

        Parameters:
            trader_id (TraderId) – The trader ID for the strategy.
            trader_id (TraderId) - 策略的交易者 ID。
            portfolio (PortfolioFacade) – The read-only portfolio for the strategy.
            portfolio (PortfolioFacade) - 策略的只读投资组合。
            msgbus (MessageBus) – The message bus for the strategy.
            msgbus (MessageBus) - 策略的消息总线。
            cache (CacheFacade) – The read-only cache for the strategy.
            cache (CacheFacade) - 策略的只读缓存。
            clock (Clock) – The clock for the strategy.
            clock (Clock) - 策略的时钟。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def register_base(
        self,
        portfolio: "PortfolioFacade",
        msgbus: "MessageBus",
        cache: "CacheFacade",
        clock: "Clock",
    ) -> None:
        """
        Register with a trader.
        注册到交易者。

        Parameters:
            portfolio (PortfolioFacade) – The read-only portfolio for the actor.
            portfolio (PortfolioFacade) - actor 的只读投资组合。
            msgbus (MessageBus) – The message bus for the actor.
            msgbus (MessageBus) - actor 的消息总线。
            cache (CacheFacade) – The read-only cache for the actor.
            cache (CacheFacade) - actor 的只读缓存。
            clock (Clock) – The clock for the actor.
            clock (Clock) - actor 的时钟。
        WARNING
            System method (not intended to be called by user code).
            系统方法(不打算由用户代码调用)。
        """
        ...

    def register_executor(self, loop: "asyncio.AbstractEventLoop", executor: "Executor") -> None:
        """
        Register the given Executor for the actor.
        为 actor 注册给定的 Executor。

        Parameters:
            loop (asyncio.AsbtractEventLoop) – The event loop of the application.
            loop (asyncio.AsbtractEventLoop) - 应用程序的事件循环。
            executor (concurrent.futures.Executor) – The executor to register.
            executor (concurrent.futures.Executor) - 要注册的执行程序。
        Raises:
            TypeError – If executor is not of type concurrent.futures.Executor
            TypeError - 如果 executor 的类型不是 concurrent.futures.Executor
        """
        ...

    def register_indicator_for_bars(
        self, bar_type: "BarType", indicator: "Indicator"
    ) -> None:
        """
        Register the given indicator with the actor/strategy to receive bar data for the given bar type.
        将给定的指标注册到 actor/策略,以接收给定K线类型的数据。

        Parameters:
            bar_type (BarType) – The bar type for bar updates.
            bar_type (BarType) - K线更新的K线类型。
            indicator (Indicator) – The indicator to register.
            indicator (Indicator) - 要注册的指标。
        """
        ...

    def register_indicator_for_quote_ticks(
        self, instrument_id: "InstrumentId", indicator: "Indicator"
    ) -> None:
        """
        Register the given indicator with the actor/strategy to receive quote tick data for the given instrument ID.
        将给定的指标注册到 actor/策略,以接收给定金融工具 ID 的报价 tick 数据。

        Parameters:
            instrument_id (InstrumentId) – The instrument ID for tick updates.
            instrument_id (InstrumentId) - 用于 tick 更新的金融工具 ID。
            indicator (Indicator) – The indicator to register.
            indicator (Indicator) - 要注册的指标。
        """
        ...

    def register_indicator_for_trade_ticks(
        self, instrument_id: "InstrumentId", indicator: "Indicator"
    ) -> None:
        """
        Register the given indicator with the actor/strategy to receive trade tick data for the given instrument ID.
        将给定的指标注册到 actor/策略,以接收给定金融工具 ID 的交易 tick 数据。

        Parameters:
            instrument_id (InstrumentId) – The instrument ID for tick updates.
            instrument_id (InstrumentId) - 用于 tick 更新的金融工具 ID。
            indicator (indicator) – The indicator to register.
            indicator (indicator) - 要注册的指标。
        """
        ...

    def register_warning_event(self, event: type) -> None:
        """
        Register the given event type for warning log levels.
        为警告日志级别注册给定的事件类型。

        Parameters:
            event (type) – The event class to register.
            event (type) - 要注册的事件类。
        """
        ...

    @property
    def registered_indicators(self) -> list["Indicator"]:
        """
        Return the registered indicators for the strategy.
        返回策略的已注册指标。

        Return type:
            list[Indicator]
        """
        ...

    def request_bars(
        self,
        bar_type: "BarType",
        start: "datetime" = None,
        end: "datetime" = None,
        client_id: "ClientId" = None,
        callback: "Callable[[UUID4], None]" | None = None,
    ) -> "UUID4":
        """
        Request historical Bar data.
        请求历史K线数据。

        If end is None then will request up to the most recent data.
        如果 end 为 None,则将请求最新的数据。

        Parameters:
            bar_type (BarType) – The bar type for the request.
            bar_type (BarType) - 请求的K线类型。
            start (datetime , optional) – The start datetime (UTC) of request time range (inclusive).
            start (datetime, 可选) - 请求时间范围的开始日期时间(UTC)(包含)。
            end (datetime , optional) – The end datetime (UTC) of request time range. The inclusiveness depends on individual data client implementation.
            end (datetime, 可选) - 请求时间范围的结束日期时间(UTC)。包含性取决于各个数据客户端的实现。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
            callback (Callable [ [UUID4 ] , None ] , optional) – The registered callback, to be called with the request ID when the response has completed processing.
            callback (Callable [ [UUID4 ] , None ], 可选) - 注册的回调,当响应完成处理时,将使用请求 ID 调用该回调。
        Returns:
            The request_id for the request.
            请求的 request_id。
        Return type:
            UUID4
        Raises:
            ValueError – If start and end are not None and start is >= end.
            ValueError - 如果 start 和 end 不为 None 并且 start >= end。
            TypeError – If callback is not None and not of type Callable.
            TypeError - 如果 callback 不为 None 并且类型不是 Callable。
        """
        ...

    def request_data(
        self,
        data_type: "DataType",
        client_id: "ClientId",
        callback: "Callable[[UUID4], None]" | None = None,
    ) -> "UUID4":
        """
        Request custom data for the given data type from the given data client.
        从给定的数据客户端请求给定数据类型的自定义数据。

        Parameters:
            data_type (DataType) – The data type for the request.
            data_type (DataType) - 请求的数据类型。
            client_id (ClientId) – The data client ID.
            client_id (ClientId) - 数据客户端 ID。
            callback (Callable [ [UUID4 ] , None ] , optional) – The registered callback, to be called with the request ID when the response has completed processing.
            callback (Callable [ [UUID4 ] , None ], 可选) - 注册的回调,当响应完成处理时,将使用请求 ID 调用该回调。
        Returns:
            The request_id for the request.
            请求的 request_id。
        Return type:
            UUID4
        Raises:
            TypeError – If callback is not None and not of type Callable.
            TypeError - 如果 callback 不为 None 并且类型不是 Callable。
        """
        ...

    def request_instrument(
        self,
        instrument_id: "InstrumentId",
        start: "datetime" = None,
        end: "datetime" = None,
        client_id: "ClientId" = None,
        callback: "Callable[[UUID4], None]" | None = None,
    ) -> "UUID4":
        """
        Request Instrument data for the given instrument ID.
        请求给定金融工具 ID 的金融工具数据。

        If end is None then will request up to the most recent data.
        如果 end 为 None,则将请求最新的数据。

        Parameters:
            instrument_id (InstrumentId) – The instrument ID for the request.
            instrument_id (InstrumentId) - 请求的金融工具 ID。
            start (datetime , optional) – The start datetime (UTC) of request time range (inclusive).
            start (datetime, 可选) - 请求时间范围的开始日期时间(UTC)(包含)。
            end (datetime , optional) – The end datetime (UTC) of request time range. The inclusiveness depends on individual data client implementation.
            end (datetime, 可选) - 请求时间范围的结束日期时间(UTC)。包含性取决于各个数据客户端的实现。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
            callback (Callable [ [UUID4 ] , None ] , optional) – The registered callback, to be called with the request ID when the response has completed processing.
            callback (Callable [ [UUID4 ] , None ], 可选) - 注册的回调,当响应完成处理时,将使用请求 ID 调用该回调。
        Returns:
            The request_id for the request.
            请求的 request_id。
        Return type:
            UUID4
        Raises:
            ValueError – If start and end are not None and start is >= end.
            ValueError - 如果 start 和 end 不为 None 并且 start >= end。
            TypeError – If callback is not None and not of type Callable.
            TypeError - 如果 callback 不为 None 并且类型不是 Callable。
        """
        ...

    def request_instruments(
        self,
        venue: "Venue",
        start: "datetime" = None,
        end: "datetime" = None,
        client_id: "ClientId" = None,
        callback: "Callable[[UUID4], None]" | None = None,
    ) -> "UUID4":
        """
        Request all Instrument data for the given venue.
        请求给定交易场所的所有金融工具数据。

        If end is None then will request up to the most recent data.
        如果 end 为 None,则将请求最新的数据。

        Parameters:
            venue (Venue) – The venue for the request.
            venue (Venue) - 请求的交易场所。
            start (datetime , optional) – The start datetime (UTC) of request time range (inclusive).
            start (datetime, 可选) - 请求时间范围的开始日期时间(UTC)(包含)。
            end (datetime , optional) – The end datetime (UTC) of request time range. The inclusiveness depends on individual data client implementation.
            end (datetime, 可选) - 请求时间范围的结束日期时间(UTC)。包含性取决于各个数据客户端的实现。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
            callback (Callable [ [UUID4 ] , None ] , optional) – The registered callback, to be called with the request ID when the response has completed processing.
            callback (Callable [ [UUID4 ] , None ], 可选) - 注册的回调,当响应完成处理时,将使用请求 ID 调用该回调。
        Returns:
            The request_id for the request.
            请求的 request_id。
        Return type:
            UUID4
        Raises:
            ValueError – If start and end are not None and start is >= end.
            ValueError - 如果 start 和 end 不为 None 并且 start >= end。
            TypeError – If callback is not None and not of type Callable.
            TypeError - 如果 callback 不为 None 并且类型不是 Callable。
        """
        ...

    def request_order_book_snapshot(
        self,
        instrument_id: "InstrumentId",
        limit: int,
        client_id: "ClientId" = None,
        callback: "Callable[[UUID4], None]" | None = None,
    ) -> "UUID4":
        """
        Request an order book snapshot.
        请求订单簿快照。

        Parameters:
            instrument_id (InstrumentId) – The instrument ID for the order book snapshot request.
            instrument_id (InstrumentId) - 订单簿快照请求的金融工具 ID。
            limit (int , optional) – The limit on the depth of the order book snapshot (default is None).
            limit (int, 可选) - 订单簿快照深度的限制(默认为 None)。
            client_id (ClientId , optional) – The specific client ID for the command. If None, it will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
            callback (Callable [ [UUID4 ] , None ] , optional) – The registered callback, to be called with the request ID when the response has completed processing.
            callback (Callable [ [UUID4 ] , None ], 可选) - 注册的回调,当响应完成处理时,将使用请求 ID 调用该回调。
        Returns:
            The request_id for the request.
            请求的 request_id。
        Return type:
            UUID4
        Raises:
            ValueError – If the instrument_id is None.
            ValueError - 如果 instrument_id 为 None。
            TypeError – If callback is not None and not of type Callable.
            TypeError - 如果 callback 不为 None 并且类型不是 Callable。
        """
        ...

    def request_quote_ticks(
        self,
        instrument_id: "InstrumentId",
        start: "datetime" = None,
        end: "datetime" = None,
        client_id: "ClientId" = None,
        callback: "Callable[[UUID4], None]" | None = None,
    ) -> "UUID4":
        """
        Request historical QuoteTick data.
        请求历史报价 tick 数据。

        If end is None then will request up to the most recent data.
               如果 end 为 None,则将请求最新的数据。

        Parameters:
            instrument_id (InstrumentId) – The tick instrument ID for the request.
            instrument_id (InstrumentId) - 请求的 tick 金融工具 ID。
            start (datetime , optional) – The start datetime (UTC) of request time range (inclusive).
            start (datetime, 可选) - 请求时间范围的开始日期时间(UTC)(包含)。
            end (datetime , optional) – The end datetime (UTC) of request time range. The inclusiveness depends on individual data client implementation.
            end (datetime, 可选) - 请求时间范围的结束日期时间(UTC)。包含性取决于各个数据客户端的实现。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
            callback (Callable [ [UUID4 ] , None ] , optional) – The registered callback, to be called with the request ID when the response has completed processing.
            callback (Callable [ [UUID4 ] , None ], 可选) - 注册的回调,当响应完成处理时,将使用请求 ID 调用该回调。
        Returns:
            The request_id for the request.
            请求的 request_id。
        Return type:
            UUID4
        Raises:
            ValueError – If start and end are not None and start is >= end.
            ValueError - 如果 start 和 end 不为 None 并且 start >= end。
            TypeError – If callback is not None and not of type Callable.
            TypeError - 如果 callback 不为 None 并且类型不是 Callable。
        """
        ...

    def request_trade_ticks(
        self,
        instrument_id: "InstrumentId",
        start: "datetime" = None,
        end: "datetime" = None,
        client_id: "ClientId" = None,
        callback: "Callable[[UUID4], None]" | None = None,
    ) -> "UUID4":
        """
        Request historical TradeTick data.
        请求历史交易 tick 数据。

        If end is None then will request up to the most recent data.
        如果 end 为 None,则将请求最新的数据。

        Parameters:
            instrument_id (InstrumentId) – The tick instrument ID for the request.
            instrument_id (InstrumentId) - 请求的 tick 金融工具 ID。
            start (datetime , optional) – The start datetime (UTC) of request time range (inclusive).
            start (datetime, 可选) - 请求时间范围的开始日期时间(UTC)(包含)。
            end (datetime , optional) – The end datetime (UTC) of request time range. The inclusiveness depends on individual data client implementation.
            end (datetime, 可选) - 请求时间范围的结束日期时间(UTC)。包含性取决于各个数据客户端的实现。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
            callback (Callable [ [UUID4 ] , None ] , optional) – The registered callback, to be called with the request ID when the response has completed processing.
            callback (Callable [ [UUID4 ] , None ], 可选) - 注册的回调,当响应完成处理时,将使用请求 ID 调用该回调。
        Returns:
            The request_id for the request.
            请求的 request_id。
        Return type:
            UUID4
        Raises:
            ValueError – If start and end are not None and start is >= end.
            ValueError - 如果 start 和 end 不为 None 并且 start >= end。
            TypeError – If callback is not None and not of type Callable.
            TypeError - 如果 callback 不为 None 并且类型不是 Callable。
        """
        ...

    def reset(self) -> None:
        """
        Reset the component.
        重置组件。

        All stateful fields are reset to their initial value.
        所有有状态字段都重置为其初始值。

        While executing on_reset() any exception will be logged and reraised, then the component will remain in a RESETTING state.
        在执行 on_reset() 时,任何异常都将被记录并重新引发,然后组件将保持在 RESETTING 状态。

        WARNING
            Do not override.
            不要覆盖。

        If the component is not in a valid state from which to execute this method, then the component state will not change, and an error will be logged.
        如果组件处于无效状态,无法执行此方法,则组件状态将不会更改,并且会记录错误。
        """
        ...

    def resume(self) -> None:
        """
        Resume the component.
        恢复组件。

        While executing on_resume() any exception will be logged and reraised, then the component will remain in a RESUMING state.
        在执行 on_resume() 时,任何异常都将被记录并重新引发,然后组件将保持在 RESUMING 状态。

        WARNING
            Do not override.
            不要覆盖。

        If the component is not in a valid state from which to execute this method, then the component state will not change, and an error will be logged.
        如果组件处于无效状态,无法执行此方法,则组件状态将不会更改,并且会记录错误。
        """
        ...

    def run_in_executor(
        self, func: "Callable[..., Any]", args: tuple = None, kwargs: dict = None
    ):
        """
        Schedules the callable func to be executed as fn(*args, **kwargs).
        安排可调用函数 func 作为 fn(*args, **kwargs) 执行。

        Parameters:
            func (Callable) – The function to be executed.
            func (Callable) - 要执行的函数。
            args (positional arguments) – The positional arguments for the call to func.
            args (位置参数) - 对 func 的调用的位置参数。
            kwargs (arbitrary keyword arguments) – The keyword arguments for the call to func.
            kwargs (任意关键字参数) - 对 func 的调用的关键字参数。
        Returns:
            The unique task identifier for the execution. This also corresponds to any future objects memory address.
            执行的唯一任务标识符。这也对应于任何 future 对象的内存地址。
        Return type:
            TaskId
        Raises:
            TypeError – If func is not of type Callable.
            TypeError - 如果 func 的类型不是 Callable。
        """
        ...

    def save(self) -> dict:
        """
        Return the actor/strategy state dictionary to be saved.
        返回要保存的 actor/策略状态字典。

        Calls on_save.
        调用 on_save。

        Raises:
            RuntimeError – If actor/strategy is not registered with a trader.
            RuntimeError - 如果 actor/策略未注册到交易者。
        WARNING
            Exceptions raised will be caught, logged, and reraised.
            引发的异常将被捕获、记录并重新引发。
        """
        ...

    def start(self) -> None:
        """
        Start the component.
        启动组件。

        While executing on_start() any exception will be logged and reraised, then the component will remain in a STARTING state.
        在执行 on_start() 时,任何异常都将被记录并重新引发,然后组件将保持在 STARTING 状态。

        WARNING
            Do not override.
            不要覆盖。

        If the component is not in a valid state from which to execute this method, then the component state will not change, and an error will be logged.
        如果组件处于无效状态,无法执行此方法,则组件状态将不会更改,并且会记录错误。
        """
        ...

    @property
    def state(self) -> "ComponentState":
        """
        ComponentState

        Return the components current state.
        返回组件的当前状态。

        Return type:
            ComponentState
        Type:
            Component.state
        """
        ...

    def stop(self) -> None:
        """
        Stop the component.
        停止组件。

        While executing on_stop() any exception will be logged and reraised, then the component will remain in a STOPPING state.
        在执行 on_stop() 时,任何异常都将被记录并重新引发,然后组件将保持在 STOPPING 状态。

        WARNING
            Do not override.
            不要覆盖。

        If the component is not in a valid state from which to execute this method, then the component state will not change, and an error will be logged.
        如果组件处于无效状态,无法执行此方法,则组件状态将不会更改,并且会记录错误。
        """
        ...

    def submit_order(
        self,
        order: "Order",
        position_id: "PositionId" = None,
        client_id: "ClientId" = None,
    ) -> None:
        """
        Submit the given order with optional position ID, execution algorithm and routing instructions.
        提交给定的订单,并使用可选的头寸 ID、执行算法和路由指令。

        A SubmitOrder command will be created and sent to either an ExecAlgorithm, the OrderEmulator or the RiskEngine (depending whether the order is emulated and/or has an exec_algorithm_id specified).
        将创建一个 SubmitOrder 命令,并将其发送到执行算法、订单模拟器或风险引擎(取决于订单是否被模拟和/或是否指定了 exec_algorithm_id)。

        If the client order ID is duplicate, then the order will be denied.
        如果客户端订单 ID 重复,则订单将被拒绝。

        Parameters:
            order (Order) – The order to submit.
            order (Order) - 要提交的订单。
            position_id (PositionId , optional) – The position ID to submit the order against. If a position does not yet exist, then any position opened will have this identifier assigned.
            position_id (PositionId, 可选) - 要提交订单的头寸 ID。如果头寸尚不存在,则任何开仓的头寸都将分配此标识符。
            client_id (ClientId , optional) – The specific execution client ID for the command. If None then will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定执行客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
        Raises:
            ValueError – If order.status is not INITIALIZED.
            ValueError - 如果 order.status 不为 INITIALIZED。
        WARNING
            If a position_id is passed and a position does not yet exist, then any position opened by the order will have this position ID assigned. This may not be what you intended.
            如果传递了 position_id 并且头寸尚不存在,则该订单开仓的任何头寸都将分配此头寸 ID。这可能不是您想要的。
        """
        ...

    def submit_order_list(
        self,
        order_list: "OrderList",
        position_id: "PositionId" = None,
        client_id: "ClientId" = None,
    ) -> None:
        """
        Submit the given order list with optional position ID, execution algorithm and routing instructions.
        提交给定的订单列表,并使用可选的头寸 ID、执行算法和路由指令。

        A SubmitOrderList command with be created and sent to either the OrderEmulator, or the RiskEngine (depending whether an order is emulated).
        将创建一个 SubmitOrderList 命令,并将其发送到订单模拟器或风险引擎(取决于订单是否被模拟)。

        If the order list ID is duplicate, or any client order ID is duplicate, then all orders will be denied.
        如果订单列表 ID 重复或任何客户端订单 ID 重复,则所有订单都将被拒绝。

        Parameters:
            order_list (OrderList) – The order list to submit.
            order_list (OrderList) - 要提交的订单列表。
            position_id (PositionId , optional) – The position ID to submit the order against. If a position does not yet exist, then any position opened will have this identifier assigned.
            position_id (PositionId, 可选) - 要提交订单的头寸 ID。如果头寸尚不存在,则任何开仓的头寸都将分配此标识符。
            client_id (ClientId , optional) – The specific execution client ID for the command. If None then will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定执行客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
        Raises:
            ValueError – If any order.status is not INITIALIZED.
            ValueError - 如果任何 order.status 不为 INITIALIZED。
        WARNING
            If a position_id is passed and a position does not yet exist, then any position opened by an order will have this position ID assigned. This may not be what you intended.
            如果传递了 position_id 并且头寸尚不存在,则任何订单开仓的头寸都将分配此头寸 ID。这可能不是您想要的。
        """
        ...

    def subscribe_bars(
        self,
        bar_type: "BarType",
        client_id: "ClientId" = None,
        await_partial: bool = False,
    ) -> None:
        """
        Subscribe to streaming Bar data for the given bar type.
        订阅给定K线类型的流式K线数据。

        Parameters:
            bar_type (BarType) – The bar type to subscribe to.
            bar_type (BarType) - 要订阅的K线类型。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
            await_partial (bool , default False) – If the bar aggregator should await the arrival of a historical partial bar prior to actively aggregating new bars.
            await_partial (bool, 默认 False) - 如果K线聚合器应在主动聚合新K线之前等待历史部分K线的到来。
        """
        ...

    def subscribe_data(self, data_type: "DataType", client_id: "ClientId" = None) -> None:
        """
        Subscribe to data of the given data type.
        订阅给定数据类型的数据。

        Parameters:
            data_type (DataType) – The data type to subscribe to.
            data_type (DataType) - 要订阅的数据类型。
            client_id (ClientId , optional) – The data client ID. If supplied then a Subscribe command will be sent to the corresponding data client.
            client_id (ClientId, 可选) - 数据客户端 ID。如果提供,则将向相应的数据客户端发送 Subscribe 命令。
        """
        ...

    def subscribe_instrument(
        self, instrument_id: "InstrumentId", client_id: "ClientId" = None
    ) -> None:
        """
        Subscribe to update Instrument data for the given instrument ID.
        订阅给定金融工具 ID 的更新金融工具数据。

        Parameters:
            instrument_id (InstrumentId) – The instrument ID for the subscription.
            instrument_id (InstrumentId) - 订阅的金融工具 ID。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
        """
        ...

    def subscribe_instrument_close(
        self, instrument_id: "InstrumentId", client_id: "ClientId" = None
    ) -> None:
        """
        Subscribe to close updates for the given instrument ID.
        订阅给定金融工具 ID 的收盘价更新。

        Parameters:
            instrument_id (InstrumentId) – The instrument to subscribe to status updates for.
            instrument_id (InstrumentId) - 要订阅状态更新的金融工具。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
        """
        ...

    def subscribe_instrument_status(
        self, instrument_id: "InstrumentId", client_id: "ClientId" = None
    ) -> None:
        """
        Subscribe to status updates for the given instrument ID.
        订阅给定金融工具 ID 的状态更新。

        Parameters:
            instrument_id (InstrumentId) – The instrument to subscribe to status updates for.
            instrument_id (InstrumentId) - 要订阅状态更新的金融工具。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
        """
        ...

    def subscribe_instruments(self, venue: "Venue", client_id: "ClientId" = None) -> None:
        """
        Subscribe to update Instrument data for the given venue.
        订阅给定交易场所的更新金融工具数据。

        Parameters:
            venue (Venue) – The venue for the subscription.
            venue (Venue) - 订阅的交易场所。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从交易场所推断出来。
        """
        ...

    def subscribe_order_book_at_interval(
        self,
        instrument_id: "InstrumentId",
        book_type: "BookType" = BookType.L2_MBP,
        depth: int = 0,
        interval_ms: int = 1000,
        kwargs: dict = None,
        client_id: "ClientId" = None,
        managed: bool = True,
    ) -> None:
        """
        Subscribe to an OrderBook at a specified interval for the given instrument ID.
        以指定的间隔订阅给定金融工具 ID 的订单簿。

        The DataEngine will only maintain one order book for each instrument. Because of this - the level, depth and kwargs for the stream will be set as per the last subscription request (this will also affect all subscribers).
        数据引擎将只为每个金融工具维护一个订单簿。因此,流的级别、深度和 kwargs 将根据最后一个订阅请求进行设置(这也会影响所有订阅者)。

        Parameters:
            instrument_id (InstrumentId) – The order book instrument ID to subscribe to.
            instrument_id (InstrumentId) - 要订阅的订单簿金融工具 ID。
            book_type (BookType {L1_MBP, L2_MBP, L3_MBO}) – The order book type.
            book_type (BookType {L1_MBP, L2_MBP, L3_MBO}) - 订单簿类型。
            depth (int , optional) – The maximum depth for the order book. A depth of 0 is maximum depth.
            depth (int, 可选) - 订单簿的最大深度。深度为 0 表示最大深度。
            interval_ms (int) – The order book snapshot interval in milliseconds (must be positive).
            interval_ms (int) - 订单簿快照间隔(以毫秒为单位)(必须为正数)。
            kwargs (dict , optional) – The keyword arguments for exchange specific parameters.
            kwargs (dict, 可选) - 特定于交易所的参数的关键字参数。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
            managed (bool , default True) – If an order book should be managed by the data engine based on the subscribed feed.
            managed (bool, 默认 True) - 是否应根据订阅的 feed 由数据引擎管理订单簿。
        Raises:
            ValueError – If depth is negative (< 0).
            ValueError - 如果 depth 为负数 (< 0)。
            ValueError – If interval_ms is not positive (> 0).
            ValueError - 如果 interval_ms 不为正数 (> 0)。
        WARNING
            Consider subscribing to order book deltas if you need intervals less than 100 milliseconds.
            如果您需要小于 100 毫秒的间隔,请考虑订阅订单簿增量。
        """
        ...

    def subscribe_order_book_deltas(
        self,
        instrument_id: "InstrumentId",
        book_type: "BookType" = BookType.L2_MBP,
        depth: int = 0,
        kwargs: dict = None,
        client_id: "ClientId" = None,
        managed: bool = True,
        pyo3_conversion: bool = False,
    ) -> None:
        """
        Subscribe to the order book data stream, being a snapshot then deltas for the given instrument ID.
        订阅订单簿数据流,即给定金融工具 ID 的快照,然后是增量。

        Parameters:
            instrument_id (InstrumentId) – The order book instrument ID to subscribe to.
            instrument_id (InstrumentId) - 要订阅的订单簿金融工具 ID。
            book_type (BookType {L1_MBP, L2_MBP, L3_MBO}) – The order book type.
            book_type (BookType {L1_MBP, L2_MBP, L3_MBO}) - 订单簿类型。
            depth (int , optional) – The maximum depth for the order book. A depth of 0 is maximum depth.
            depth (int, 可选) - 订单簿的最大深度。深度为 0 表示最大深度。
            kwargs (dict , optional) – The keyword arguments for exchange specific parameters.
            kwargs (dict, 可选) - 特定于交易所的参数的关键字参数。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
            managed (bool , default True) – If an order book should be managed by the data engine based on the subscribed feed.
            managed (bool, 默认 True) - 是否应根据订阅的 feed 由数据引擎管理订单簿。
            pyo3_conversion (bool , default False) – If received deltas should be converted to nautilus_pyo3.OrderBookDeltas prior to being passed to the on_order_book_deltas handler.
            pyo3_conversion (bool, 默认 False) - 是否应在将接收到的增量传递给 on_order_book_deltas 处理程序之前将其转换为 nautilus_pyo3.OrderBookDeltas。
        """
        ...

    def subscribe_quote_ticks(
        self, instrument_id: "InstrumentId", client_id: "ClientId" = None
    ) -> None:
        """
        Subscribe to streaming QuoteTick data for the given instrument ID.
        订阅给定金融工具 ID 的流式报价 tick 数据。

        Parameters:
            instrument_id (InstrumentId) – The tick instrument to subscribe to.
            instrument_id (InstrumentId) - 要订阅的 tick 金融工具。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
        """
        ...

    def subscribe_signal(self, name: str = "") -> None:
        """
        Subscribe to a specific signal by name, or to all signals if no name is provided.
        按名称订阅特定信号,如果未提供名称,则订阅所有信号。

        Parameters:
            name (str , optional) – The name of the signal to subscribe to. If not provided or an empty string is passed, the subscription will include all signals. The signal name is case-insensitive and will be capitalized (e.g., ‘example’ becomes ‘SignalExample*’).
            name (str, 可选) - 要订阅的信号的名称。如果没有提供名称或传递了空字符串,则订阅将包含所有信号。信号名称不区分大小写,并将大写(例如,“example”将变为“SignalExample*”)。
        """
        ...

    def subscribe_trade_ticks(
        self, instrument_id: "InstrumentId", client_id: "ClientId" = None
    ) -> None:
        """
        Subscribe to streaming TradeTick data for the given instrument ID.
        订阅给定金融工具 ID 的流式交易 tick 数据。

        Parameters:
            instrument_id (InstrumentId) – The tick instrument to subscribe to.
            instrument_id (InstrumentId) - 要订阅的 tick 金融工具。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
        """
        ...

    def to_importable_config(self) -> "ImportableStrategyConfig":
        """
        Returns an importable configuration for this strategy.
        返回此策略的可导入配置。

        Return type:
            ImportableStrategyConfig
        """
        ...

    @property
    def trader_id(self) -> "TraderId":
        """
        The trader ID associated with the component.
        与组件关联的交易者 ID。

        Returns:
            TraderId
        """
        ...

    @property
    def type(self):
        """
        The components type.
        组件类型。

        Returns:
            type
        """
        ...

    def unsubscribe_bars(self, bar_type: "BarType", client_id: "ClientId" = None) -> None:
        """
        Unsubscribe from streaming Bar data for the given bar type.
        取消订阅给定K线类型的流式K线数据。

        Parameters:
            bar_type (BarType) – The bar type to unsubscribe from.
            bar_type (BarType) - 要取消订阅的K线类型。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
        """
        ...

    def unsubscribe_data(self, data_type: "DataType", client_id: "ClientId" = None) -> None:
        """
        Unsubscribe from data of the given data type.
        取消订阅给定数据类型的数据。

        Parameters:
            data_type (DataType) – The data type to unsubscribe from.
            data_type (DataType) - 要取消订阅的数据类型。
            client_id (ClientId , optional) – The data client ID. If supplied then an Unsubscribe command will be sent to the data client.
            client_id (ClientId, 可选) - 数据客户端 ID。如果提供,则将向数据客户端发送 Unsubscribe 命令。
        """
        ...

    def unsubscribe_instrument(
        self, instrument_id: "InstrumentId", client_id: "ClientId" = None
    ) -> None:
        """
        Unsubscribe from update Instrument data for the given instrument ID.
        取消订阅给定金融工具 ID 的更新金融工具数据。

        Parameters:
            instrument_id (InstrumentId) – The instrument to unsubscribe from.
            instrument_id (InstrumentId) - 要取消订阅的金融工具。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
        """
        ...

    def unsubscribe_instrument_status(
        self, instrument_id: "InstrumentId", client_id: "ClientId" = None
    ) -> None:
        """
        Unsubscribe to status updates of the given venue.
        取消订阅给定交易场所的状态更新。

        Parameters:
            instrument_id (InstrumentId) – The instrument to unsubscribe to status updates for.
            instrument_id (InstrumentId) - 要取消订阅状态更新的金融工具。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从交易场所推断出来。
        """
        ...

    def unsubscribe_instruments(self, venue: "Venue", client_id: "ClientId" = None) -> None:
        """
        Unsubscribe from update Instrument data for the given venue.
        取消订阅给定交易场所的更新金融工具数据。

        Parameters:
            venue (Venue) – The venue for the subscription.
            venue (Venue) - 订阅的交易场所。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从交易场所推断出来。
        """
        ...

    def unsubscribe_order_book_at_interval(
        self,
        instrument_id: "InstrumentId",
        interval_ms: int = 1000,
        client_id: "ClientId" = None,
    ) -> None:
        """
        Unsubscribe from an OrderBook at a specified interval for the given instrument ID.
        取消订阅以指定间隔获取给定金融工具 ID 的订单簿。

        The interval must match the previously subscribed interval.
        间隔必须与之前订阅的间隔匹配。

        Parameters:
            instrument_id (InstrumentId) – The order book instrument to subscribe to.
            instrument_id (InstrumentId) - 要订阅的订单簿金融工具。
            interval_ms (int) – The order book snapshot interval in milliseconds.
            interval_ms (int) - 订单簿快照间隔(以毫秒为单位)。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
        """
        ...

    def unsubscribe_order_book_deltas(
        self, instrument_id: "InstrumentId", client_id: "ClientId" = None
    ) -> None:
        """
        Unsubscribe the order book deltas stream for the given instrument ID.
        取消订阅给定金融工具 ID 的订单簿增量流。

        Parameters:
            instrument_id (InstrumentId) – The order book instrument to subscribe to.
            instrument_id (InstrumentId) - 要订阅的订单簿金融工具。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
        """
        ...

    def unsubscribe_quote_ticks(
        self, instrument_id: "InstrumentId", client_id: "ClientId" = None
    ) -> None:
        """
        Unsubscribe from streaming QuoteTick data for the given instrument ID.
        取消订阅给定金融工具 ID 的流式报价 tick 数据。

        Parameters:
            instrument_id (InstrumentId) – The tick instrument to unsubscribe from.
            instrument_id (InstrumentId) - 要取消订阅的 tick 金融工具。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
        """
        ...

    def unsubscribe_trade_ticks(
        self, instrument_id: "InstrumentId", client_id: "ClientId" = None
    ) -> None:
        """
        Unsubscribe from streaming TradeTick data for the given instrument ID.
        取消订阅给定金融工具 ID 的流式交易 tick 数据。

        Parameters:
            instrument_id (InstrumentId) – The tick instrument ID to unsubscribe from.
            instrument_id (InstrumentId) - 要取消订阅的 tick 金融工具 ID。
            client_id (ClientId , optional) – The specific client ID for the command. If None then will be inferred from the venue in the instrument ID.
            client_id (ClientId, 可选) - 命令的特定客户端 ID。如果为 None,则将从金融工具 ID 中的交易场所推断出来。
        """
        ...

    def update_synthetic(self, synthetic: "SyntheticInstrument") -> None:
        """
        Update the synthetic instrument in the cache.
        更新缓存中的合成金融工具。

        Parameters:
            synthetic (SyntheticInstrument) – The synthetic instrument to update in the cache.
            synthetic (SyntheticInstrument) - 要在缓存中更新的合成金融工具。
        Raises:
            KeyError – If synthetic does not already exist in the cache.
            KeyError - 如果合成金融工具在缓存中不存在。
        """
        ...

The Trader class is intended to manage a fleet of trading strategies within a running instance of the platform.
交易者类旨在管理平台运行实例中的一组交易策略。

A running instance could be either a test/backtest or live implementation - the Trader will operate in the same way.
运行实例可以是测试/回测或实时实现 - 交易者的操作方式相同。

class Trader 交易者

Provides a trader for managing a fleet of actors, execution algorithms, and trading strategies.
提供一个交易者,用于管理一组 actors、执行算法和交易策略。

Parameters: trader_id (TraderId) – The ID for the trader.
trader_id (TraderId) - 交易者的 ID。 instance_id (UUID4) – The instance ID for the trader.
instance_id (UUID4) - 交易者的实例 ID。 msgbus (MessageBus) – The message bus for the trader.
msgbus (MessageBus) - 交易者的消息总线。 cache (Cache) – The cache for the trader.
cache (Cache) - 交易者的缓存。 portfolio (Portfolio) – The portfolio for the trader.
portfolio (Portfolio) - 交易者的投资组合。 data_engine (DataEngine) – The data engine for the trader.
data_engine (DataEngine) - 交易者的数据引擎。 risk_engine (RiskEngine) – The risk engine for the trader.
risk_engine (RiskEngine) - 交易者的风险引擎。 exec_engine (ExecutionEngine) – The execution engine for the trader.
exec_engine (ExecutionEngine) - 交易者的执行引擎。 clock (Clock) – The clock for the trader.
clock (Clock) - 交易者的时钟。 has_controller (bool , default False) – If the trader has a controller.
has_controller (bool,默认 False) - 交易者是否具有控制器。 loop (asyncio.AbstractEventLoop , optional) – The event loop for the trader.
loop (asyncio.AbstractEventLoop,可选) - 交易者的事件循环。 Raises: ValueError – If portfolio is not equal to the exec_engine portfolio.
ValueError - 如果 portfolio 不等于 exec_engine 的 portfolio。 ValueError – If strategies is None.
ValueError - 如果 strategies 为 None。 ValueError – If strategies is empty.
ValueError - 如果 strategies 为空。 TypeError – If strategies contains a type other than Strategy.
TypeError - 如果 strategies 包含 Strategy 以外的类型。

class Trader(Component):
    """
    Provides a trader for managing a fleet of actors, execution algorithms and trading strategies.

    提供一个交易者,用于管理一组actors、执行算法和交易策略。

    Parameters:
        trader_id (TraderId) – The ID for the trader.
        trader_id (TraderId) - 交易者的ID。
        instance_id (UUID4) – The instance ID for the trader.
        instance_id (UUID4) - 交易者的实例ID。
        msgbus (MessageBus) – The message bus for the trader.
        msgbus (MessageBus) - 交易者的消息总线。
        cache (Cache) – The cache for the trader.
        cache (Cache) - 交易者的缓存。
        portfolio (Portfolio) – The portfolio for the trader.
        portfolio (Portfolio) - 交易者的投资组合。
        data_engine (DataEngine) – The data engine for the trader.
        data_engine (DataEngine) - 交易者的数据引擎。
        risk_engine (RiskEngine) – The risk engine for the trader.
        risk_engine (RiskEngine) - 交易者的风险引擎。
        exec_engine (ExecutionEngine) – The execution engine for the trader.
        exec_engine (ExecutionEngine) - 交易者的执行引擎。
        clock (Clock) – The clock for the trader.
        clock (Clock) - 交易者的时钟。
        has_controller (bool , default False) – If the trader has a controller.
        has_controller (bool, 默认False) - 交易者是否具有控制器。
        loop (asyncio.AbstractEventLoop , optional) – The event loop for the trader.
        loop (asyncio.AbstractEventLoop, 可选) - 交易者的事件循环。
    Raises:
        ValueError – If portfolio is not equal to the exec_engine portfolio.
        ValueError - 如果投资组合不等于执行引擎投资组合。
        ValueError – If strategies is None.
        ValueError - 如果策略为None。
        ValueError – If strategies is empty.
        ValueError - 如果策略为空。
        TypeError – If strategies contains a type other than Strategy.
        TypeError - 如果策略包含Strategy以外的类型。
    """

    @property
    def instance_id(self) -> "UUID4":
        """
        Return the traders instance ID.
        返回交易者的实例ID。

        Return type:
            UUID4
        """
        ...

    def actors(self) -> list["Actor"]:
        """
        Return the actors loaded in the trader.
        返回加载到交易者中的actors。

        Return type:
            list[Actor]
        """
        ...

    def strategies(self) -> list["Strategy"]:
        """
        Return the strategies loaded in the trader.
        返回加载到交易者中的策略。

        Return type:
            list[Strategy]
        """
        ...

    def exec_algorithms(self) -> list:
        """
        Return the execution algorithms loaded in the trader.
        返回加载到交易者中的执行算法。

        Return type:
            list[ExecAlgorithms]
        """
        ...

    def actor_ids(self) -> list["ComponentId"]:
        """
        Return the actor IDs loaded in the trader.
        返回加载到交易者中的actor ID。

        Return type:
            list[ComponentId]
        """
        ...

    def strategy_ids(self) -> list["StrategyId"]:
        """
        Return the strategy IDs loaded in the trader.
        返回加载到交易者中的策略ID。

        Return type:
            list[StrategyId]
        """
        ...

    def exec_algorithm_ids(self) -> list["ExecAlgorithmId"]:
        """
        Return the execution algorithm IDs loaded in the trader.
        返回加载到交易者中的执行算法ID。

        Return type:
            list[ExecAlgorithmId]
        """
        ...

    def actor_states(self) -> dict["ComponentId", str]:
        """
        Return the traders actor states.
        返回交易者的actor状态。

        Return type:
            dict[ComponentId, str]
        """
        ...

    def strategy_states(self) -> dict["StrategyId", str]:
        """
        Return the traders strategy states.
        返回交易者的策略状态。

        Return type:
            dict[StrategyId, str]
        """
        ...

    def exec_algorithm_states(self) -> dict["ExecAlgorithmId", str]:
        """
        Return the traders execution algorithm states.
        返回交易者的执行算法状态。

        Return type:
            dict[ExecAlgorithmId, str]
        """
        ...

    def add_actor(self, actor: "Actor") -> None:
        """
        Add the given custom component to the trader.
        将给定的自定义组件添加到交易者。

        Parameters:
            actor (Actor) – The actor to add and register.
            actor (Actor) - 要添加和注册的actor。
        Raises:
            ValueError – If actor.state is RUNNING or DISPOSED.
            ValueError - 如果actor.state为RUNNING或DISPOSED。
            RuntimeError – If actor.id already exists in the trader.
            RuntimeError - 如果actor.id已存在于交易者中。
        """
        ...

    def add_actors(self, actors: list["Actor"]) -> None:
        """
        Add the given actors to the trader.
        将给定的actors添加到交易者。

        Parameters:
            actors (list *[*TradingStrategies ]) – The actors to add and register.
            actors (list *[*TradingStrategies ]) - 要添加和注册的actors。
        Raises:
            ValueError – If actors is None or empty.
            ValueError - 如果actors为None或空。
        """
        ...

    def add_strategy(self, strategy: "Strategy") -> None:
        """
        Add the given trading strategy to the trader.
        将给定的交易策略添加到交易者。

        Parameters:
            strategy (Strategy) – The trading strategy to add and register.
            strategy (Strategy) - 要添加和注册的交易策略。
        Raises:
            ValueError – If strategy.state is RUNNING or DISPOSED.
            ValueError - 如果strategy.state为RUNNING或DISPOSED。
            RuntimeError – If strategy.id already exists in the trader.
            RuntimeError - 如果strategy.id已存在于交易者中。
        """
        ...

    def add_strategies(self, strategies: list["Strategy"]) -> None:
        """
        Add the given trading strategies to the trader.
        将给定的交易策略添加到交易者。

        Parameters:
            strategies (list *[*TradingStrategies ]) – The trading strategies to add and register.
            strategies (list *[*TradingStrategies ]) - 要添加和注册的交易策略。
        Raises:
            ValueError – If strategies is None or empty.
            ValueError - 如果策略为None或空。
        """
        ...

    def add_exec_algorithm(self, exec_algorithm) -> None:
        """
        Add the given execution algorithm to the trader.
        将给定的执行算法添加到交易者。

        Parameters:
            exec_algorithm (ExecAlgorithm) – The execution algorithm to add and register.
            exec_algorithm (ExecAlgorithm) - 要添加和注册的执行算法。
        Raises:
            KeyError – If exec_algorithm.id already exists in the trader.
            KeyError - 如果exec_algorithm.id已存在于交易者中。
            ValueError – If exec_algorithm.state is RUNNING or DISPOSED.
            ValueError - 如果exec_algorithm.state为RUNNING或DISPOSED。
        """
        ...

    def add_exec_algorithms(self, exec_algorithms: list) -> None:
        """
        Add the given execution algorithms to the trader.
        将给定的执行算法添加到交易者。

        Parameters:
            exec_algorithms (list [ExecAlgorithm ]) – The execution algorithms to add and register.
            exec_algorithms (list [ExecAlgorithm ]) - 要添加和注册的执行算法。
        Raises:
            ValueError – If exec_algorithms is None or empty.
            ValueError - 如果执行算法为None或空。
        """
        ...

    def start_actor(self, actor_id: "ComponentId") -> None:
        """
        Start the actor with the given actor_id.
        使用给定的actor_id启动actor。

        Parameters:
            actor_id (ComponentId) – The component ID to start.
            actor_id (ComponentId) - 要启动的组件ID。
        Raises:
            ValueError – If an actor with the given actor_id is not found.
            ValueError - 如果未找到具有给定actor_id的actor。
        """
        ...

    def start_strategy(self, strategy_id: "StrategyId") -> None:
        """
        Start the strategy with the given strategy_id.
        使用给定的strategy_id启动策略。

        Parameters:
            strategy_id (StrategyId) – The strategy ID to start.
            strategy_id (StrategyId) - 要启动的策略ID。
        Raises:
            ValueError – If a strategy with the given strategy_id is not found.
            ValueError - 如果未找到具有给定strategy_id的策略。
        """
        ...

    def stop_actor(self, actor_id: "ComponentId") -> None:
        """
        Stop the actor with the given actor_id.
        使用给定的actor_id停止actor。

        Parameters:
            actor_id (ComponentId) – The actor ID to stop.
            actor_id (ComponentId) - 要停止的actor ID。
        Raises:
            ValueError – If an actor with the given actor_id is not found.
            ValueError - 如果未找到具有给定actor_id的actor。
        """
        ...

    def stop_strategy(self, strategy_id: "StrategyId") -> None:
        """
        Stop the strategy with the given strategy_id.
        使用给定的strategy_id停止策略。

        Parameters:
            strategy_id (StrategyId) – The strategy ID to stop.
            strategy_id (StrategyId) - 要停止的策略ID。
        Raises:
            ValueError – If a strategy with the given strategy_id is not found.
            ValueError - 如果未找到具有给定strategy_id的策略。
        """
        ...

    def remove_actor(self, actor_id: "ComponentId") -> None:
        """
        Remove the actor with the given actor_id.
        移除具有给定actor_id的actor。

        Will stop the actor first if state is RUNNING.
        如果状态为RUNNING,将首先停止actor。

        Parameters:
            actor_id (ComponentId) – The actor ID to remove.
            actor_id (ComponentId) - 要移除的actor ID。
        Raises:
            ValueError – If an actor with the given actor_id is not found.
            ValueError - 如果未找到具有给定actor_id的actor。
        """
        ...

    def remove_strategy(self, strategy_id: "StrategyId") -> None:
        """
        Remove the strategy with the given strategy_id.
        移除具有给定strategy_id的策略。

        Will stop the strategy first if state is RUNNING.
        如果状态为RUNNING,将首先停止策略。

        Parameters:
            strategy_id (StrategyId) – The strategy ID to remove.
            strategy_id (StrategyId) - 要移除的策略ID。
        Raises:
            ValueError – If a strategy with the given strategy_id is not found.
            ValueError - 如果未找到具有给定strategy_id的策略。
        """
        ...

    def clear_actors(self) -> None:
        """
        Dispose and clear all actors held by the trader.
        处理并清除交易者持有的所有actors。

        Raises:
            ValueError – If state is RUNNING.
            ValueError - 如果状态为RUNNING。
        """
        ...

    def clear_strategies(self) -> None:
        """
        Dispose and clear all strategies held by the trader.
        处理并清除交易者持有的所有策略。

        Raises:
            ValueError – If state is RUNNING.
            ValueError - 如果状态为RUNNING。
        """
        ...

    def clear_exec_algorithms(self) -> None:
        """
        Dispose and clear all execution algorithms held by the trader.
        处理并清除交易者持有的所有执行算法。

        Raises:
            ValueError – If state is RUNNING.
            ValueError - 如果状态为RUNNING。
        """
        ...

    def subscribe(self, topic: str, handler: "Callable[[Any], None]") -> None:
        """
        Subscribe to the given message topic with the given callback handler.
        使用给定的回调处理程序订阅给定的消息主题。

        Parameters:
            topic (str) – The topic for the subscription. May include wildcard glob patterns.
            topic (str) - 订阅的主题。可以包含通配符glob模式。
            handler (Callable [ *[*Any ] , None ]) – The handler for the subscription.
            handler (Callable [ *[*Any ] , None ]) - 订阅的处理程序。
        """
        ...

    def unsubscribe(self, topic: str, handler: "Callable[[Any], None]") -> None:
        """
        Unsubscribe the given handler from the given message topic.
        取消给定的处理程序对给定消息主题的订阅。

        Parameters:
            topic (str , optional) – The topic to unsubscribe from. May include wildcard glob patterns.
            topic (str, 可选) - 要取消订阅的主题。可以包含通配符glob模式。
            handler (Callable [ *[*Any ] , None ]) – The handler for the subscription.
            handler (Callable [ *[*Any ] , None ]) - 订阅的处理程序。
        """
        ...

    def save(self) -> None:
        """
        Save all actor and strategy states to the cache.
        将所有actor和策略状态保存到缓存。
        """
        ...

    def load(self) -> None:
        """
        Load all actor and strategy states from the cache.
        从缓存中加载所有actor和策略状态。
        """
        ...

    def check_residuals(self) -> None:
        """
        Check for residual open state such as open orders or open positions.
        检查残留的未平仓状态,例如未结订单或未平仓头寸。
        """
        ...

    def generate_orders_report(self) -> "DataFrame":
        """
        Generate an orders report.
        生成订单报告。

        Return type:
            pd.DataFrame
        """
        ...

    def generate_order_fills_report(self) -> "DataFrame":
        """
        Generate an order fills report.
        生成订单成交报告。

        Return type:
            pd.DataFrame
        """
        ...

    def generate_fills_report(self) -> "DataFrame":
        """
        Generate a fills report.
        生成成交报告。

        Return type:
            pd.DataFrame
        """
        ...

    def generate_positions_report(self) -> "DataFrame":
        """
        Generate a positions report.
        生成头寸报告。

        Return type:
            pd.DataFrame
        """
        ...

    def generate_account_report(self, venue: "Venue") -> "DataFrame":
        """
        Generate an account report.
        生成账户报告。

        Return type:
            pd.DataFrame
        """
        ...

    def degrade(self) -> None:
        """
        Degrade the component.
        降级组件。

        While executing on_degrade() any exception will be logged and reraised, then the component will remain in a DEGRADING state.
        在执行 on_degrade() 时,任何异常都将被记录并重新引发,然后组件将保持在 DEGRADING 状态。

        WARNING
            Do not override.
            不要覆盖。

        If the component is not in a valid state from which to execute this method, then the component state will not change, and an error will be logged.
        如果组件处于无效状态,无法执行此方法,则组件状态将不会更改,并且会记录错误。
        """
        ...

    def dispose(self) -> None:
        """
        Dispose of the component.
        处理组件。

        While executing on_dispose() any exception will be logged and reraised, then the component will remain in a DISPOSING state.
        在执行 on_dispose() 时,任何异常都将被记录并重新引发,然后组件将保持在 DISPOSING 状态。

        WARNING
            Do not override.
            不要覆盖。

        If the component is not in a valid state from which to execute this method, then the component state will not change, and an error will be logged.
        如果组件处于无效状态,无法执行此方法,则组件状态将不会更改,并且会记录错误。
        """
        ...

    def fault(self) -> None:
        """
        Fault the component.
        使组件出错。

        Calling this method multiple times has the same effect as calling it once (it is idempotent). Once called, it cannot be reversed, and no other methods should be called on this instance.
        多次调用此方法与调用一次具有相同的效果(它是幂等的)。一旦调用,它就无法撤消,并且不应在此实例上调用任何其他方法。

        While executing on_fault() any exception will be logged and reraised, then the component will remain in a FAULTING state.
        在执行 on_fault() 时,任何异常都将被记录并重新引发,然后组件将保持在 FAULTING 状态。

        WARNING
            Do not override.
            不要覆盖。

        If the component is not in a valid state from which to execute this method, then the component state will not change, and an error will be logged.
        如果组件处于无效状态,无法执行此方法,则组件状态将不会更改,并且会记录错误。
        """
        ...

    @classmethod
    def fully_qualified_name(cls) -> str:
        """
        Return the fully qualified name for the components class.
        返回组件类的完全限定名称。

        Return type:
            str
        """
        ...

    @property
    def id(self) -> "ComponentId":
        """
        The components ID.
        组件ID。

        Returns:
            ComponentId
        """
        ...

    @property
    def is_degraded(self) -> bool:
        """
        bool

        Return whether the current component state is DEGRADED.
        返回当前组件状态是否为DEGRADED。

        Return type:
            bool
        Type:
            Component.is_degraded
        """
        ...

    @property
    def is_disposed(self) -> bool:
        """
        bool

        Return whether the current component state is DISPOSED.
        返回当前组件状态是否为DISPOSED。

        Return type:
            bool
        Type:
            Component.is_disposed
        """
        ...

    @property
    def is_faulted(self) -> bool:
        """
        bool

        Return whether the current component state is FAULTED.
        返回当前组件状态是否为FAULTED。

        Return type:
            bool
        Type:
            Component.is_faulted
        """
        ...

    @property
    def is_initialized(self) -> bool:
        """
        bool

        Return whether the component has been initialized (component.state >= INITIALIZED).
        返回组件是否已初始化(component.state >= INITIALIZED)。

        Return type:
            bool
        Type:
            Component.is_initialized
        """
        ...

    @property
    def is_running(self) -> bool:
        """
        bool

        Return whether the current component state is RUNNING.
        返回当前组件状态是否为RUNNING。

        Return type:
            bool
        Type:
            Component.is_running
        """
        ...

    @property
    def is_stopped(self) -> bool:
        """
        bool

        Return whether the current component state is STOPPED.
        返回当前组件状态是否为STOPPED。

        Return type:
            bool
        Type:
            Component.is_stopped
        """
        ...

    def reset(self) -> None:
        """
        Reset the component.
        重置组件。

        All stateful fields are reset to their initial value.
        所有有状态字段都重置为其初始值。

        While executing on_reset() any exception will be logged and reraised, then the component will remain in a RESETTING state.
        在执行on_reset()时,任何异常都将被记录并重新引发,然后组件将保持在RESETTING状态。

        WARNING
            Do not override.
            不要覆盖。

        If the component is not in a valid state from which to execute this method, then the component state will not change, and an error will be logged.
        如果组件处于无效状态,无法执行此方法,则组件状态将不会更改,并且会记录错误。
        """
        ...

    def resume(self) -> None:
        """
        Resume the component.
        恢复组件。

        While executing on_resume() any exception will be logged and reraised, then the component will remain in a RESUMING state.
        在执行on_resume()时,任何异常都将被记录并重新引发,然后组件将保持在RESUMING状态。

        WARNING
            Do not override.
            不要覆盖。

        If the component is not in a valid state from which to execute this method, then the component state will not change, and an error will be logged.
        如果组件处于无效状态,无法执行此方法,则组件状态将不会更改,并且会记录错误。
        """
        ...

    def start(self) -> None:
        """
        Start the component.
        启动组件。

        While executing on_start() any exception will be logged and reraised, then the component will remain in a STARTING state.
        在执行on_start()时,任何异常都将被记录并重新引发,然后组件将保持在STARTING状态。

        WARNING
            Do not override.
            不要覆盖。

        If the component is not in a valid state from which to execute this method, then the component state will not change, and an error will be logged.
        如果组件处于无效状态,无法执行此方法,则组件状态将不会更改,并且会记录错误。
        """
        ...

    @property
    def state(self) -> "ComponentState":
        """
        ComponentState

        Return the components current state.
        返回组件的当前状态。

        Return type:
            ComponentState
        Type:
            Component.state
        """
        ...

    def stop(self) -> None:
        """
        Stop the component.
        停止组件。

        While executing on_stop() any exception will be logged and reraised, then the component will remain in a STOPPING state.
        在执行on_stop()时,任何异常都将被记录并重新引发,然后组件将保持在STOPPING状态。

        WARNING
            Do not override.
            不要覆盖。

        If the component is not in a valid state from which to execute this method, then the component state will not change, and an error will be logged.
        如果组件处于无效状态,无法执行此方法,则组件状态将不会更改,并且会记录错误。
        """
        ...

    @property
    def trader_id(self) -> "TraderId":
        """
        The trader ID associated with the component.
        与组件关联的交易者ID。

        Returns:
            TraderId
        """
        ...

    @property
    def type(self):
        """
        The components type.
        组件类型。

        Returns:
            type
        """
        ...
文档 (Documentation)
入门 (Getting Started)
概念 (Concepts)
教程 (Tutorials)
集成 (Integrations)
Python API
Rust API[未翻译]
开发者指南 (Developer Guide)
Clone this wiki locally