本文整理匯總了Python中vnpy.event.Event類的典型用法代碼示例。如果您正苦於以下問題:Python Event類的具體用法?Python Event怎麽用?Python Event使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Event類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: putSettingEvent
def putSettingEvent(self, settingName, algoSetting):
"""發出算法配置更新事件"""
algoSetting['settingName'] = settingName
event = Event(EVENT_ALGO_SETTING)
event.dict_['data'] = algoSetting
self.eventEngine.put(event)
示例2: writeCtaLog
def writeCtaLog(self, content):
"""快速發出CTA模塊日誌事件"""
log = VtLogData()
log.logContent = content
event = Event(type_=EVENT_CTA_LOG)
event.dict_['data'] = log
self.eventEngine.put(event)
示例3: writeDrLog
def writeDrLog(self, content):
"""快速發出日誌事件"""
log = VtLogData()
log.logContent = content
event = Event(type_=EVENT_DATARECORDER_LOG)
event.dict_['data'] = log
self.eventEngine.put(event)
示例4: writeLog
def writeLog(self, content):
"""快速發出日誌事件"""
print "%s.%s.%s" % (__name__, self.__class__.__name__, get_current_function_name())
log = VtLogData()
log.logContent = content
event = Event(type_=EVENT_LOG)
event.dict_['data'] = log
self.eventEngine.put(event)
示例5: writeLog
def writeLog(self, content):
"""快速發出日誌事件"""
log = VtLogData()
log.logContent = content
log.gatewayName = 'MAIN_ENGINE'
event = Event(type_=EVENT_LOG)
event.dict_['data'] = log
self.eventEngine.put(event)
示例6: writeLog
def writeLog(self, content):
"""發出日誌事件"""
log = VtLogData()
log.logContent = content
log.gatewayName = 'JAQS_SERVICE'
event = Event(type_=EVENT_JS_LOG)
event.dict_['data'] = log
self.eventEngine.put(event)
示例7: writeLog
def writeLog(self, msg):
""""""
log = VtLogData()
log.logContent = msg
event = Event(EVENT_TC_LOG)
event.dict_['data'] = log
self.eventEngine.put(event)
示例8: writeLog
def writeLog(self, content):
"""發出日誌 """
log = VtLogData()
log.logContent = content
event = Event(EVENT_OM_LOG)
event.dict_['data'] = log
self.eventEngine.put(event)
示例9: writeLog
def writeLog(self, content):
"""輸出日誌"""
log = VtLogData()
log.logContent = content
event = Event(EVENT_SPREADTRADING_ALGOLOG)
event.dict_['data'] = log
self.eventEngine.put(event)
示例10: putSpreadPosEvent
def putSpreadPosEvent(self, spread):
"""發出價差持倉事件"""
event1 = Event(EVENT_SPREADTRADING_POS+spread.name)
event1.dict_['data'] = spread
self.eventEngine.put(event1)
event2 = Event(EVENT_SPREADTRADING_POS)
event2.dict_['data'] = spread
self.eventEngine.put(event2)
示例11: putSpreadTickEvent
def putSpreadTickEvent(self, spread):
"""發出價差行情更新事件"""
event1 = Event(EVENT_SPREADTRADING_TICK+spread.name)
event1.dict_['data'] = spread
self.eventEngine.put(event1)
event2 = Event(EVENT_SPREADTRADING_TICK)
event2.dict_['data'] = spread
self.eventEngine.put(event2)
示例12: writeLog
def writeLog(self, content):
"""記錄日誌"""
log = VtLogData()
log.logContent = content
log.gatewayName = self.ENGINE_NAME
event = Event(EVENT_RTDSERVICE_LOG)
event.dict_['data'] = log
self.eventEngine.put(event)
示例13: cancelOrder
def cancelOrder(self, cancelOrderReq, gatewayName):
"""對特定接口撤單"""
gateway = self.getGateway(gatewayName)
event1 = Event(type_=EVENT_PRE_CANCEL_ORDER)
event1.dict_['data'] = cancelOrderReq
self.eventEngine.put(event1)
if gateway:
gateway.cancelOrder(cancelOrderReq)
示例14: writeLog
def writeLog(self, content, algo=None):
"""輸出日誌"""
log = VtLogData()
log.logContent = content
if algo:
log.gatewayName = algo.algoName
event = Event(EVENT_ALGO_LOG)
event.dict_['data'] = log
self.eventEngine.put(event)
示例15: putStrategyEvent
def putStrategyEvent(self, name):
"""觸發策略狀態變化事件(通常用於通知GUI更新)"""
strategy = self.strategyDict[name]
d = {k:strategy.__getattribute__(k) for k in strategy.varList}
event = Event(EVENT_CTA_STRATEGY+name)
event.dict_['data'] = d
self.eventEngine.put(event)
d2 = {k:str(v) for k,v in d.items()}
d2['name'] = name
event2 = Event(EVENT_CTA_STRATEGY)
event2.dict_['data'] = d2
self.eventEngine.put(event2)