MCPcopy
hub / github.com/microsoft/qlib / load

Method load

qlib/data/dataset/loader.py:254–269  ·  view source on GitHub ↗
(self, instruments=None, start_time=None, end_time=None)

Source from the content-addressed store, hash-verified

252 return {k: v for k, v in self.__dict__.items() if not k.startswith("_")}
253
254 def load(self, instruments=None, start_time=None, end_time=None) -> pd.DataFrame:
255 self._maybe_load_raw_data()
256
257 # 1) Filter by instruments
258 if instruments is None:
259 df = self._data
260 else:
261 df = self._data.loc(axis=0)[:, instruments]
262
263 # 2) Filter by Datetime
264 if start_time is None and end_time is None:
265 return df # NOTE: avoid copy by loc
266 # pd.Timestamp(None) == NaT, use NaT as index can not fetch correct thing, so do not change None.
267 start_time = time_to_slc_point(start_time)
268 end_time = time_to_slc_point(end_time)
269 return df.loc[start_time:end_time]
270
271 def _maybe_load_raw_data(self):
272 if self._data is not None:

Callers

nothing calls this directly

Calls 3

_maybe_load_raw_dataMethod · 0.95
time_to_slc_pointFunction · 0.90
locMethod · 0.45

Tested by

no test coverage detected