fix: parse JSON string result if needed when retrieving trades

This commit is contained in:
shokollm
2026-04-11 05:36:47 +00:00
parent 847890b634
commit 19ba0c7cc6

View File

@@ -207,7 +207,11 @@ def get_backtest_trades(
# Get trades from result
result = backtest.result or {}
trades = result.get("trades", [])
# Handle case where result might be a JSON string
if isinstance(result, str):
import json
result = json.loads(result)
trades = result.get("trades", []) or []
return {
"backtest_id": run_id,