def save_klines_to_cache(self, kline_names: list=[]):
    '\n        保存K线数据到缓存\n        :param kline_names: 一般为self.klines的keys\n        :return:\n        '
    if (len(kline_names) == 0):
        kline_names = list(self.klines.keys())
    save_path = self.cta_engine.get_data_path()
    file_name = os.path.abspath(os.path.join(save_path, f'{self.strategy_name}_klines.pkb2'))
    with bz2.BZ2File(file_name, 'wb') as f:
        klines = {}
        for kline_name in kline_names:
            kline = self.klines.get(kline_name, None)
            klines.update({kline_name: kline})
        pickle.dump(klines, f)
保存K线数据到缓存
:param kline_names: 一般为self.klines的keys
:return:
def save_klines_to_cache(self, kline_names: list=[]):
    '\n        保存K线数据到缓存\n        :param kline_names: 一般为self.klines的keys\n        :return:\n        '
    if (len(kline_names) == 0):
        kline_names = list(self.klines.keys())
    save_path = self.cta_engine.get_data_path()
    file_name = os.path.abspath(os.path.join(save_path, f'{self.strategy_name}_klines.pkb2'))
    with bz2.BZ2File(file_name, 'wb') as f:
        klines = {}
        for kline_name in kline_names:
            kline = self.klines.get(kline_name, None)
            klines.update({kline_name: kline})
        pickle.dump(klines, f)