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


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

本文整理汇总了Python中EventEngine.DyEvent.data['param']方法的典型用法代码示例。如果您正苦于以下问题:Python DyEvent.data['param']方法的具体用法?Python DyEvent.data['param']怎么用?Python DyEvent.data['param']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EventEngine.DyEvent的用法示例。


在下文中一共展示了DyEvent.data['param']方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _backTestingParamGroups

# 需要导入模块: from EventEngine import DyEvent [as 别名]
# 或者: from EventEngine.DyEvent import data['param'] [as 别名]
    def _backTestingParamGroups(self):
        """
            类似于窗口推进方式回测参数组合
        """
        if not (self._paramGroups or self._runningBackTestingParamGroups):
            self._eventEngine.put(DyEvent(DyEventType.finish))
            return True

        while len(self._runningBackTestingParamGroups) < self._paramGroupNbr:
            if not self._paramGroups:
                break

            self._paramGroupCount += 1

            self._info.print("开始回测策略: {0}, 参数组合: {1}...".format(self._strategyCls.chName, self._paramGroupCount), DyLogData.ind)

            """ 开始一个参数组合的回测 """
            # pop one param group
            param = self._paramGroups.pop(0)

            # it's one new running paramGroup
            self._runningBackTestingParamGroups[self._paramGroupCount] = []

            # notify Ui to create new param group widget for strategy
            event = DyEvent(DyEventType.newStockStrategyBackTestingParam)
            event.data['class'] = self._strategyCls
            event.data['param'] = {'groupNo': self._paramGroupCount, 'data': param}

            self._eventEngine.put(event)

            """ 开始一个参数组合的多个周期回测 """
            # 分成@self._periodNbr个周期,通过子进程并行运行
            stepSize = (len(self._tradeDays) + self._periodNbr - 1)//self._periodNbr
            if stepSize == 0: return False

            for i in range(0, len(self._tradeDays), stepSize):
                # period
                tradeDays_ = self._tradeDays[i:i + stepSize]

                # notify Ui to create new period widget for strategy
                event = DyEvent(DyEventType.newStockStrategyBackTestingPeriod)
                event.data['class'] = self._strategyCls
                event.data['paramGroupNo'] = self._paramGroupCount
                event.data['period'] = [tradeDays_[0], tradeDays_[-1]]

                self._eventEngine.put(event)

                sleep(1) # !!!sleep so that UI windows can be created firstly.

                # it's one new running period for one new paramGroup
                self._runningBackTestingParamGroups[self._paramGroupCount].append(event.data['period'])

                # create subprocess for processing each period
                reqData = DyStockBackTestingStrategyReqData(self._strategyCls, tradeDays_, self._settings, param, self._testedStocks, self._paramGroupCount)
                self._proxy.startBackTesting(reqData)

        return True
开发者ID:hack1943,项目名称:DevilYuan,代码行数:59,代码来源:DyStockBackTestingStrategyEngine.py

示例2: _stockSelect

# 需要导入模块: from EventEngine import DyEvent [as 别名]
# 或者: from EventEngine.DyEvent import data['param'] [as 别名]
    def _stockSelect(self):
        strategyCls, param = self._widgetStrategy.getStrategy()
        if strategyCls is None: return

        # change UI
        self._startRunningMutexAction(self._stockSelectAction)

        event = DyEvent(DyEventType.stockSelectStrategySelectReq)
        event.data['class'] = strategyCls
        event.data['param'] = param

        self._mainEngine.eventEngine.put(event)
开发者ID:hack1943,项目名称:DevilYuan,代码行数:14,代码来源:DyStockSelectMainWindow.py

示例3: _stockRegression

# 需要导入模块: from EventEngine import DyEvent [as 别名]
# 或者: from EventEngine.DyEvent import data['param'] [as 别名]
    def _stockRegression(self):
        strategyCls, param = self._widgetStrategy.getStrategy()
        if strategyCls is None: return

        data = {}
        if not DyDateDlg(data).exec_():
            return

        # change UI
        self._startRunningMutexAction(self._stockRegressionAction)

        event = DyEvent(DyEventType.stockSelectStrategyRegressionReq)
        event.data['class'] = strategyCls
        event.data['param'] = param
        event.data['startDate'] = data['startDate']
        event.data['endDate'] = data['endDate']

        self._mainEngine.eventEngine.put(event)
开发者ID:hack1943,项目名称:DevilYuan,代码行数:20,代码来源:DyStockSelectMainWindow.py


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