reset simulation trader when clear stratege data
This commit is contained in:
parent
f4c040d75c
commit
f26d9b7a33
@ -712,6 +712,13 @@ def clear_strategy(strategy_name):
|
||||
if not strategy_name:
|
||||
raise ValueError("缺少策略名称参数")
|
||||
|
||||
# 重置模拟交易实例(通过重新创建实例的方式)
|
||||
global _sim_trader_instance
|
||||
if _sim_trader_instance is not None:
|
||||
logger.info("重置模拟交易实例")
|
||||
# 创建一个新的模拟交易实例,替换原有实例
|
||||
_sim_trader_instance = SimulationTrader()
|
||||
|
||||
# 检查策略是否存在
|
||||
if strategy_name in strategy_positions:
|
||||
# 从策略持仓字典中删除该策略
|
||||
|
Loading…
x
Reference in New Issue
Block a user