import json from pathlib import Path # 恢复sample文件 sample_data = { "strategy": { "FreqaiPrimer": { "trades": [ { "pair": "BTC/USDT", "open_date": "2024-01-01T10:00:00Z", "close_date": "2024-01-02T10:00:00Z", "open_rate": 40000.0, "close_rate": 41000.0, "amount": 0.009878, "profit_ratio": 0.0248, "profit_abs": 98.78, "exit_reason": "roi", "fee_open": 4.0, "fee_close": 4.09998, "trade_duration": 86400, "min_rate": 39800.0, "max_rate": 41200.0, "orders": [ {"id": "1", "type": "buy", "price": 40000.0, "amount": 0.009878, "cost": 395.12, "timestamp": "2024-01-01T10:00:00Z"} ] }, { "pair": "ETH/USDT", "open_date": "2024-01-03T09:00:00Z", "close_date": "2024-01-04T09:00:00Z", "open_rate": 1900.0, "close_rate": 1950.0, "amount": 0.05, "profit_ratio": 0.0259, "profit_abs": 25.0, "exit_reason": "roi", "fee_open": 0.95, "fee_close": 0.975, "trade_duration": 86400, "min_rate": 1880.0, "max_rate": 1960.0, "orders": [ {"id": "2", "type": "buy", "price": 1900.0, "amount": 0.05, "cost": 95.0, "timestamp": "2024-01-03T09:00:00Z"} ] } ] } } } result_dir = Path('../result') sample_file = result_dir / "backtest-result-sample.json" with open(sample_file, 'w') as f: json.dump(sample_data, f, ensure_ascii=False, indent=2) print(f"Sample file restored at {sample_file}") print("Now you can run the final verification")