dev zt
This commit is contained in:
@@ -1,22 +1,31 @@
|
||||
"""做 T 策略的运行期依赖。"""
|
||||
"""做 T 策略单次运行所需的上下文对象。"""
|
||||
|
||||
from dataclasses import dataclass
|
||||
|
||||
from config import AccountConfig, GlobalConfig
|
||||
from libs.grid_take_profit import GridTrailingTracker
|
||||
from sdk import Client
|
||||
from strategy.trend.order import OrderBook
|
||||
from strategy.trend.watch import DipWatch
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user