1、准备更新order单前备份
This commit is contained in:
@@ -5,6 +5,8 @@ from datetime import datetime
|
||||
import math
|
||||
from typing import Dict, Any, Optional, List, TYPE_CHECKING
|
||||
|
||||
import numpy as np
|
||||
|
||||
# 使用 TYPE_CHECKING 避免循环导入,但保留类型提示
|
||||
from ..backtest_context import BacktestContext # 转发引用 BacktestEngine
|
||||
from ..core_data import Bar, Order, Trade # 导入必要的类型
|
||||
@@ -201,3 +203,12 @@ class Strategy(ABC):
|
||||
|
||||
def get_price_history(self, key: str):
|
||||
return self.context.get_price_history(key)
|
||||
|
||||
def get_indicator_tuple(self):
|
||||
close = np.array(self.get_price_history("close"))
|
||||
open = np.array(self.get_price_history("open"))
|
||||
high = np.array(self.get_price_history("high"))
|
||||
low = np.array(self.get_price_history("low"))
|
||||
volume = np.array(self.get_price_history("volume"))
|
||||
|
||||
return (close, open, high, low, volume)
|
||||
|
||||
Reference in New Issue
Block a user