1、新增dp策略
This commit is contained in:
@@ -71,7 +71,7 @@ class TqsdkEngine:
|
||||
self._api: TqApi = api
|
||||
|
||||
# 从策略参数中获取主symbol,TqsdkContext 需要知道它
|
||||
self.symbol: str = strategy_params.get("symbol")
|
||||
self.symbol: str = symbol.replace('_', '.')
|
||||
if not self.symbol:
|
||||
raise ValueError("strategy_params 必须包含 'symbol' 字段")
|
||||
|
||||
@@ -106,12 +106,12 @@ class TqsdkEngine:
|
||||
self._is_rollover_bar: bool = False # 换月信号
|
||||
self._last_underlying_symbol = self.symbol # 用于检测主力合约换月
|
||||
|
||||
self.klines = api.get_kline_serial(symbol, duration_seconds)
|
||||
self.klines_1min = api.get_kline_serial(symbol, 60)
|
||||
self.klines = api.get_kline_serial(self.symbol, duration_seconds)
|
||||
self.klines_1min = api.get_kline_serial(self.symbol, 60)
|
||||
self.now = None
|
||||
self.quote = None
|
||||
if roll_over_mode:
|
||||
self.quote = api.get_quote(symbol)
|
||||
self.quote = api.get_quote(self.symbol)
|
||||
|
||||
print("TqsdkEngine: 初始化完成。")
|
||||
|
||||
@@ -127,6 +127,7 @@ class TqsdkEngine:
|
||||
异步处理 Context 中排队的订单和取消请求。
|
||||
"""
|
||||
# 处理订单
|
||||
print(self._context.order_queue)
|
||||
while self._context.order_queue:
|
||||
order_to_send: Order = self._context.order_queue.popleft()
|
||||
print(f"Engine: 处理订单请求: {order_to_send}")
|
||||
|
||||
Reference in New Issue
Block a user