diff --git a/tools/.tradestocsv.py.swp b/tools/.tradestocsv.py.swp deleted file mode 100644 index 62760a09..00000000 Binary files a/tools/.tradestocsv.py.swp and /dev/null differ diff --git a/tools/tradestocsv.py b/tools/tradestocsv.py index f7c368dd..0cadef1f 100644 --- a/tools/tradestocsv.py +++ b/tools/tradestocsv.py @@ -23,8 +23,11 @@ largest_file = max(json_files, key=lambda x: x.stat().st_size) with open(largest_file) as f: data = json.load(f) +# 从环境变量中获取策略名称 +strategy_name = os.environ.get('STRATEGY_NAME', 'TheForceV7') # 如果未设置环境变量,则使用默认值 'TheForceV7' + # 提取交易记录 -trades = data['strategy']['TheForceV7']['trades'] +trades = data['strategy'][strategy_name]['trades'] trades_df = pd.DataFrame(trades) # 选择关键字段