[bug fix]

This commit is contained in:
msincenselee 2020-05-17 13:48:43 +08:00
parent e6251c7467
commit 57448173a6
2 changed files with 5 additions and 3 deletions

View File

@ -16,7 +16,7 @@ from vnpy.trader.constant import Interval, Direction, Offset, Status, OrderType,
from vnpy.trader.object import BarData, TickData, OrderData, TradeData, PositionData from vnpy.trader.object import BarData, TickData, OrderData, TradeData, PositionData
from vnpy.trader.utility import virtual, append_data, extract_vt_symbol, get_underlying_symbol, round_to from vnpy.trader.utility import virtual, append_data, extract_vt_symbol, get_underlying_symbol, round_to
from .base import StopOrder from .base import StopOrder,EngineType
from vnpy.component.cta_grid_trade import CtaGrid, CtaGridTrade from vnpy.component.cta_grid_trade import CtaGrid, CtaGridTrade
from vnpy.component.cta_position import CtaPosition from vnpy.component.cta_position import CtaPosition
from vnpy.component.cta_policy import CtaPolicy from vnpy.component.cta_policy import CtaPolicy
@ -403,6 +403,7 @@ class StockPolicy(CtaPolicy):
j['singlals'] = d j['singlals'] = d
return j return j
class CtaStockTemplate(CtaTemplate): class CtaStockTemplate(CtaTemplate):
""" """
股票增强模板 股票增强模板
@ -439,7 +440,7 @@ class CtaStockTemplate(CtaTemplate):
self.max_invest_margin = 0 # 资金上限 0不限制 self.max_invest_margin = 0 # 资金上限 0不限制
# 是否回测状态 # 是否回测状态
backtesting = False self.backtesting = False
self.cur_datetime: datetime = None # 当前Tick时间 self.cur_datetime: datetime = None # 当前Tick时间
self.last_minute = None # 最后的分钟,用于on_tick内每分钟处理的逻辑 self.last_minute = None # 最后的分钟,用于on_tick内每分钟处理的逻辑
@ -1293,3 +1294,4 @@ class CtaStockTemplate(CtaTemplate):
if self.backtesting: if self.backtesting:
return return
self.cta_engine.send_wechat(msg=msg, strategy=self) self.cta_engine.send_wechat(msg=msg, strategy=self)

View File

@ -147,7 +147,7 @@ class CtaManager(QtWidgets.QWidget):
auto_init = setting.pop("auto_init", False) auto_init = setting.pop("auto_init", False)
auto_start = setting.pop("auto_start", False) auto_start = setting.pop("auto_start", False)
self.cta_engine.add_strategy( self.cta_engine.add_strategy(
class_name, strategy_name, vt_symbol, setting, auto_init, auto_start class_name, strategy_name, vt_symbols, setting, auto_init, auto_start
) )
def clear_log(self): def clear_log(self):