def save_tns(self, tns_data):
    '\n        保存多空事务记录=》csv文件,便于后续分析\n        :param tns_data: {"datetime":xxx, "direction":"long"或者"short", "price":xxx}\n        :return:\n        '
    if self.backtesting:
        save_path = self.cta_engine.get_logs_path()
    else:
        save_path = self.cta_engine.get_data_path()
    try:
        file_name = os.path.abspath(os.path.join(save_path, f'{self.strategy_name}_tns.csv'))
        append_data(file_name=file_name, dict_data=tns_data)
    except Exception as ex:
        self.write_error(u'save_tns 异常:{} {}'.format(str(ex), traceback.format_exc()))
保存多空事务记录=》csv文件,便于后续分析
:param tns_data: {"datetime":xxx, "direction":"long"或者"short", "price":xxx}
:return:
def save_tns(self, tns_data):
    '\n        保存多空事务记录=》csv文件,便于后续分析\n        :param tns_data: {"datetime":xxx, "direction":"long"或者"short", "price":xxx}\n        :return:\n        '
    if self.backtesting:
        save_path = self.cta_engine.get_logs_path()
    else:
        save_path = self.cta_engine.get_data_path()
    try:
        file_name = os.path.abspath(os.path.join(save_path, f'{self.strategy_name}_tns.csv'))
        append_data(file_name=file_name, dict_data=tns_data)
    except Exception as ex:
        self.write_error(u'save_tns 异常:{} {}'.format(str(ex), traceback.format_exc()))