Example #1
0
 def onPosition(self, position):
     """持仓信息推送"""
     # 通用事件
     event1 = Event(type_=EVENT_POSITION)
     event1.dict_['data'] = position
     self.eventEngine.put(event1)
     pass
Example #2
0
 def onTick(self, tick):
     """市场行情推送"""
     # 通用事件
     event1 = Event(type_=EVENT_TICK)
     event1.dict_['data'] = tick
     self.eventEngine.put(event1)
     pass
Example #3
0
 def onOrder(self, order):
     """订单变化推送"""
     # 通用事件
     event1 = Event(type_=EVENT_ORDER)
     event1.dict_['data'] = order
     self.eventEngine.put(event1)
     pass
Example #4
0
 def onContract(self, contract):
     """合约基础信息推送"""
     # 通用事件
     event1 = Event(type_=EVENT_CONTRACT)
     event1.dict_['data'] = contract
     self.eventEngine.put(event1)
     pass
Example #5
0
 def onLog(self, log):
     """日志推送"""
     # 通用事件
     event1 = Event(type_=EVENT_LOG)
     event1.dict_['data'] = log
     self.eventEngine.put(event1)
     pass
Example #6
0
 def onError(self, error):
     """错误信息推送"""
     # 通用事件
     event1 = Event(type_=EVENT_ERROR)
     event1.dict_['data'] = error
     self.eventEngine.put(event1)
     pass
Example #7
0
    def __runTimer(self):
        """运行在计时器线程中的循环函数"""
        while self.__timerActive:
            # 创建计时器事件
            event = Event(type_=EVENT_TIMER)

            # 向队列中存入计时器事件
            self.put(event)

            # 等待
            sleep(self.__timerSleep)
Example #8
0
 def onAccount(self, account):
     """账户信息推送"""
     # 通用事件
     event1 = Event(type_=EVENT_ACCOUNT)
     event1.dict_['data'] = account
     self.eventEngine.put(event1)
Example #9
0
 def onTrade(self, trade):
     """成交信息推送"""
     # 通用事件
     event1 = Event(type_=EVENT_TRADE)
     event1.dict_['data'] = trade
     pass