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)
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)
def mock_bar(instrument, **kwargs): from rqalpha.model.bar import BarObject return BarObject(instrument, kwargs)
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)