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

Method dataset

qlib/data/data.py:902–927  ·  view source on GitHub ↗
(
        self,
        instruments,
        fields,
        start_time=None,
        end_time=None,
        freq="day",
        inst_processors=[],
    )

Source from the content-addressed store, hash-verified

900 self.align_time = align_time
901
902 def dataset(
903 self,
904 instruments,
905 fields,
906 start_time=None,
907 end_time=None,
908 freq="day",
909 inst_processors=[],
910 ):
911 instruments_d = self.get_instruments_d(instruments, freq)
912 column_names = self.get_column_names(fields)
913 if self.align_time:
914 # NOTE: if the frequency is a fixed value.
915 # align the data to fixed calendar point
916 cal = Cal.calendar(start_time, end_time, freq)
917 if len(cal) == 0:
918 return pd.DataFrame(
919 index=pd.MultiIndex.from_arrays([[], []], names=("instrument", "datetime")), columns=column_names
920 )
921 start_time = cal[0]
922 end_time = cal[-1]
923 data = self.dataset_processor(
924 instruments_d, column_names, start_time, end_time, freq, inst_processors=inst_processors
925 )
926
927 return data
928
929 @staticmethod
930 def multi_cache_walker(instruments, fields, start_time=None, end_time=None, freq="day"):

Callers

nothing calls this directly

Calls 4

get_instruments_dMethod · 0.80
get_column_namesMethod · 0.80
dataset_processorMethod · 0.80
calendarMethod · 0.45

Tested by

no test coverage detected