From 19ba0c7cc6e909b64f114e4997542cb702e5d18f Mon Sep 17 00:00:00 2001 From: shokollm <270575765+shokollm@users.noreply.github.com> Date: Sat, 11 Apr 2026 05:36:47 +0000 Subject: [PATCH] fix: parse JSON string result if needed when retrieving trades --- src/backend/app/api/backtest.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/backend/app/api/backtest.py b/src/backend/app/api/backtest.py index 5007a45..d716926 100644 --- a/src/backend/app/api/backtest.py +++ b/src/backend/app/api/backtest.py @@ -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,