当前位置: 首页>>代码示例>>Python>>正文


Python DyEvent.data['state']方法代码示例

本文整理汇总了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)
开发者ID:hack1943,项目名称:DevilYuan,代码行数:28,代码来源:DyStockStrategyBase.py

示例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)
开发者ID:hack1943,项目名称:DevilYuan,代码行数:20,代码来源:DyStockStrategyBase.py

示例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 = {}
开发者ID:yutiansut,项目名称:DevilYuan,代码行数:18,代码来源:DyStockCtaEngine.py

示例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)
开发者ID:hack1943,项目名称:DevilYuan,代码行数:19,代码来源:DyStockStrategyBase.py


注:本文中的EventEngine.DyEvent.data['state']方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。