本文整理匯總了Python中EventEngine.DyEvent.data['oneKeyHangUp']方法的典型用法代碼示例。如果您正苦於以下問題:Python DyEvent.data['oneKeyHangUp']方法的具體用法?Python DyEvent.data['oneKeyHangUp']怎麽用?Python DyEvent.data['oneKeyHangUp']使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類EventEngine.DyEvent
的用法示例。
在下文中一共展示了DyEvent.data['oneKeyHangUp']方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _stopAccountManager
# 需要導入模塊: from EventEngine import DyEvent [as 別名]
# 或者: from EventEngine.DyEvent import data['oneKeyHangUp'] [as 別名]
def _stopAccountManager(self, strategyCls, oneKeyHangUp=False):
"""
停止策略的賬戶管理者
@oneKeyHangUp: 一鍵掛機導致的
"""
if strategyCls.broker is None:
return
if strategyCls.broker not in self._accountManagers:
return
self._info.print('股票CTA引擎: 賬號[{0}]解除綁定策略[{1}]'.format(self.accountManagerMap[strategyCls.broker].brokerName, strategyCls.chName), DyLogData.ind1)
# check if other running strategies use the same account manager
for strategy, _ in self._strategies.values():
if strategy.name != strategyCls.name and \
strategyCls.broker == strategy.broker and \
strategy.state.isState(DyStockStrategyState.running):
return
# 退出策略的實盤交易接口
event = DyEvent(DyEventType.stockLogout)
event.data['broker'] = strategyCls.broker
event.data['oneKeyHangUp'] = oneKeyHangUp
self._eventEngine.put(event)
# 銷毀券商賬戶管理者
self._accountManagers[strategyCls.broker].exit()
del self._accountManagers[strategyCls.broker]
示例2: _endStockTradeDayHandler
# 需要導入模塊: from EventEngine import DyEvent [as 別名]
# 或者: from EventEngine.DyEvent import data['oneKeyHangUp'] [as 別名]
def _endStockTradeDayHandler(self, event):
if not self._strategyMirror and self._strategies:
self._info.print('股票CTA引擎: 結束交易日[{}]'.format(self._curDate), DyLogData.ind2)
# save strategies and stop strategy running
for strategy, _ in self._strategies.values():
# save
self._strategyMirror[strategy.__class__] = strategy.state
# stop
event = DyEvent(DyEventType.stopStockCtaStrategy)
event.data['class'] = strategy.__class__
event.data['oneKeyHangUp'] = True
self._stopStockCtaStrategyHandler(event)