當前位置: 首頁>>代碼示例>>Python>>正文


Python DyEvent.data['oneKeyHangUp']方法代碼示例

本文整理匯總了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]
開發者ID:yutiansut,項目名稱:DevilYuan,代碼行數:32,代碼來源:DyStockCtaEngine.py

示例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)
開發者ID:yutiansut,項目名稱:DevilYuan,代碼行數:17,代碼來源:DyStockCtaEngine.py


注:本文中的EventEngine.DyEvent.data['oneKeyHangUp']方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。