(self, instruments=None, start_time=None, end_time=None)
| 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: |
nothing calls this directly
no test coverage detected