本文整理汇总了Python中EventEngine.DyEvent.data['state']方法的典型用法代码示例。如果您正苦于以下问题:Python DyEvent.data['state']方法的具体用法?Python DyEvent.data['state']怎么用?Python DyEvent.data['state']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventEngine.DyEvent
的用法示例。
在下文中一共展示了DyEvent.data['state']方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: checkAll
# 需要导入模块: from EventEngine import DyEvent [as 别名]
# 或者: from EventEngine.DyEvent import data['state'] [as 别名]
def checkAll(self, strategyCls, eventEngine):
""" check '运行' 和 '监控' """
if self.isState(DyStockStrategyState.running) and self.isState(DyStockStrategyState.monitoring):
return
if self._state is None:
event = DyEvent(DyEventType.startStockCtaStrategy)
event.data['class'] = strategyCls
event.data['state'] = DyStockStrategyState(DyStockStrategyState.running, DyStockStrategyState.monitoring)
self.add(DyStockStrategyState.running, DyStockStrategyState.monitoring)
else:
if self.isState(DyStockStrategyState.running):
self.add(DyStockStrategyState.monitoring)
else:
self.add(DyStockStrategyState.running)
event = DyEvent(DyEventType.changeStockCtaStrategyState)
event.data['class'] = strategyCls
event.data['state'] = DyStockStrategyState(DyStockStrategyState.monitoring, DyStockStrategyState.running)
eventEngine.put(event)
示例2: checkState
# 需要导入模块: from EventEngine import DyEvent [as 别名]
# 或者: from EventEngine.DyEvent import data['state'] [as 别名]
def checkState(self, state, strategyCls, eventEngine):
if self.isState(state):
return
self.add(state)
if self._state == state:
event = DyEvent(DyEventType.startStockCtaStrategy)
event.data['class'] = strategyCls
event.data['state'] = DyStockStrategyState(self._state)
else:
event = DyEvent(DyEventType.changeStockCtaStrategyState)
event.data['class'] = strategyCls
event.data['state'] = DyStockStrategyState(*self._state.split('+'))
eventEngine.put(event)
示例3: _beginStockTradeDayHandler
# 需要导入模块: from EventEngine import DyEvent [as 别名]
# 或者: from EventEngine.DyEvent import data['state'] [as 别名]
def _beginStockTradeDayHandler(self, event):
if self._strategyMirror and not self._strategies:
# init
self._curInit()
self._info.print('股票CTA引擎: 开始交易日[{}]'.format(self._curDate), DyLogData.ind2)
# start strategies
for strategyCls, state in self._strategyMirror.items():
event = DyEvent(DyEventType.startStockCtaStrategy)
event.data['class'] = strategyCls
event.data['state'] = state
self._startStockCtaStrategyHandler(event)
self._strategyMirror = {}
示例4: uncheckState
# 需要导入模块: from EventEngine import DyEvent [as 别名]
# 或者: from EventEngine.DyEvent import data['state'] [as 别名]
def uncheckState(self, state, strategyCls, eventEngine):
if not self.isState(state):
return
self.remove(state)
if not self._state:
event = DyEvent(DyEventType.stopStockCtaStrategy)
event.data['class'] = strategyCls
else:
event = DyEvent(DyEventType.changeStockCtaStrategyState)
event.data['class'] = strategyCls
event.data['state'] = DyStockStrategyState(self._state)
eventEngine.put(event)