本文整理汇总了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)