Ejemplo n.º 1
0
 def clockhandel(self, Event):
     date = Event.data.strftime("%Y-%m-%d")
     bar = tusharebar(date).getOneBar("600008.SH")
     event = Event(event_type=self.EventType, data=bar)
     print("传递bar")
     print(bar)
     self.event_engine.put(event)
Ejemplo n.º 2
0
 def push_quotation(self):
     while self.is_active:
         clock_data = self.fetch_clock()
         date = clock_data.data.strftime("%Y-%m-%d")
         bar = tusharebar(date).getOneBar("600008.SH")
         event = Event(event_type=self.EventType, data=bar)
         print("传递bar")
         print(bar)
         self.event_engine.put(event)
Ejemplo n.º 3
0
 def push_quotation(self):
     while self.is_active:
         try:
             clock_data = self.fetch_clock()
         except:
             self.wait()
             continue
         feed_data = self.clockhandel(clock_data)
         event = Event(event_type=self.EventType, data=feed_data)
         self.event_engine.put(event)
         self.wait()
Ejemplo n.º 4
0
 def _active_run(self):
     """
     轮询事件是否触发
     :return:
     """
     while self.is_active:
         for _, config in self.__configs.iteritems():
             params = config.is_active()
             if params:
                 event = Event(type=config.event_type, params=params)
                 self.__event_engine.put(event)
Ejemplo n.º 5
0
 def create_algo_instance(self, event_type, param_dict):
     self._event_engine.put(event=Event(event_type, params=param_dict))
Ejemplo n.º 6
0
 def push_clock_event(self, data):
     event = Event(event_type=self.EventType, data=data)
     self.event_engine.put(event)
Ejemplo n.º 7
0
 def __init__(self, market, context, bar_data):
     self.data = market
     self.context = context
     Event.__init__(self)
Ejemplo n.º 8
0
 def push_event_type(self, clock_handler):
     event = Event(eventType=self.EventType, data=Clock(self.trading_state, clock_handler.clock_type))
     for engine in self.eventEngine:
         engine.put(event)