예제 #1
0
 def get_bar(self, order_book_id, dt, frequency='1d'):
     # type: (str, Union[datetime, date], str) -> BarObject
     instrument = self.instruments(order_book_id)
     if dt is None:
         return BarObject(instrument, NANDict, dt)
     bar = self._data_source.get_bar(instrument, dt, frequency)
     if bar:
         return BarObject(instrument, bar)
     return BarObject(instrument, NANDict, dt)
예제 #2
0
 def get_bar(self, order_book_id, dt, frequency='1d'):
     instrument = self.instruments(order_book_id)
     bar = self._data_source.get_bar(instrument, dt, frequency)
     if bar:
         if frequency[-1] == 'd':
             return BarObject(instrument, bar)
         return MinuteBarObject(instrument, bar)
예제 #3
0
def mock_bar(instrument, **kwargs):
    from rqalpha.model.bar import BarObject
    return BarObject(instrument, kwargs)
예제 #4
0
 def get_bar(self, order_book_id, dt, frequency='1d'):
     instrument = self.instruments(order_book_id)  #判断是不是指数
     bar = self._data_source.get_bar(instrument, dt, frequency)
     if bar:
         return BarObject(instrument, bar)