本文整理汇总了Python中EventEngine.DyEvent.data['result']方法的典型用法代码示例。如果您正苦于以下问题:Python DyEvent.data['result']方法的具体用法?Python DyEvent.data['result']怎么用?Python DyEvent.data['result']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventEngine.DyEvent
的用法示例。
在下文中一共展示了DyEvent.data['result']方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: runStrategy
# 需要导入模块: from EventEngine import DyEvent [as 别名]
# 或者: from EventEngine.DyEvent import data['result'] [as 别名]
def runStrategy(self, strategyCls, paramters):
self._info.print("开始准备运行选股策略: {0}".format(strategyCls.chName), DyLogData.ind)
self._info.initProgress()
# init
self._init()
# create strategy instance
self._strategy = strategyCls(paramters, self._info)
# run
if self._run():
# ack
event = DyEvent(DyEventType.stockSelectStrategySelectAck)
event.data['class'] = strategyCls
event.data['result'] = self._result
event.data['baseDate'] = self._strategy.baseDate
self._eventEngine.put(event)
# finish
self._eventEngine.put(DyEvent(DyEventType.finish))
ret = True
else:
# fail
self._eventEngine.put(DyEvent(DyEventType.fail))
ret = False
return ret
示例2: dyStockSelectRegressionEngineProcess
# 需要导入模块: from EventEngine import DyEvent [as 别名]
# 或者: from EventEngine.DyEvent import data['result'] [as 别名]
def dyStockSelectRegressionEngineProcess(outQueue, inQueue, tradeDays, strategy, codes, histDaysDataSource):
strategyCls = strategy['class']
parameters = strategy['param']
DyStockCommon.defaultHistDaysDataSource = histDaysDataSource
dummyEventEngine = DyDummyEventEngine()
queueInfo = DyQueueInfo(outQueue)
selectEngine = DyStockSelectSelectEngine(dummyEventEngine, queueInfo, False)
selectEngine.setTestedStocks(codes)
for day in tradeDays:
try:
event = inQueue.get_nowait()
except queue.Empty:
pass
parameters['基准日期'] = day
if selectEngine.runStrategy(strategyCls, parameters):
event = DyEvent(DyEventType.stockSelectStrategyRegressionAck)
event.data['class'] = strategyCls
event.data['period'] = [tradeDays[0], tradeDays[-1]]
event.data['day'] = day
event.data['result'] = selectEngine.result
outQueue.put(event)
else:
queueInfo.print('回归选股策略失败:{0}, 周期[{1}, {2}], 基准日期{3}'.format(strategyCls.chName, tradeDays[0], tradeDays[-1], day), DyLogData.error)