(data, start_index=0)
| 840 | |
| 841 | @staticmethod |
| 842 | def build_index_from_data(data, start_index=0): |
| 843 | if data.empty: |
| 844 | return pd.DataFrame() |
| 845 | line_data = data.groupby("datetime", group_keys=False).size() |
| 846 | line_data.sort_index(inplace=True) |
| 847 | index_end = line_data.cumsum() |
| 848 | index_start = index_end.shift(1, fill_value=0) |
| 849 | |
| 850 | index_data = pd.DataFrame() |
| 851 | index_data["start"] = index_start |
| 852 | index_data["end"] = index_end |
| 853 | index_data += start_index |
| 854 | return index_data |
| 855 | |
| 856 | def gen_dataset_cache(self, cache_path: Union[str, Path], instruments, fields, freq, inst_processors=[]): |
| 857 | """gen_dataset_cache |
no test coverage detected