Files
big-qmt/py-client/strategy/zt/runtime.py
2026-09-06 11:53:28 +08:00

32 lines
873 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""做 T 策略单次运行所需的上下文对象。"""
from dataclasses import dataclass
from config import AccountConfig, GlobalConfig
from libs.grid_take_profit import GridTrailingTracker
from sdk import Client
from .order import OrderBook
from .watch import DipWatch
from .state import TState
@dataclass(slots=True)
class Runtime:
"""集中保存策略运行期间共享的依赖和状态。
将这些对象集中到一个 dataclass 后,开仓、持仓管理和单轮调度函数
只需接收一个 Runtime无需重复传递大量参数。
"""
# 外部服务与账户配置。
client: Client
global_cfg: GlobalConfig
account_cfg: AccountConfig
# 策略运行过程中共享的状态组件。
state: TState
orders: OrderBook
open_watch: DipWatch
buy_watch: DipWatch
sell_tracker: GridTrailingTracker