Fix backtest detail API — check historical/ subdirectory first
Bug: /api/backtest/{name} only looked in backtests/results/,
but all historical backtests are saved in backtests/results/historical/.
Fix: check HISTORICAL_DIR first, then fall back to BACKTEST_DIR.
This fixes SPX backtest detail showing zero prices/fees.
This commit is contained in:
+4
-1
@@ -236,7 +236,10 @@ async def list_backtests():
|
||||
|
||||
@app.get("/api/backtest/{name}")
|
||||
async def get_backtest(name: str):
|
||||
"""Get full backtest result data."""
|
||||
"""Get full backtest result data — checks historical dir first."""
|
||||
# Try historical subdirectory first (where dashboard saves backtests)
|
||||
fpath = os.path.join(HISTORICAL_DIR, f"{name}.json")
|
||||
if not os.path.exists(fpath):
|
||||
fpath = os.path.join(BACKTEST_DIR, f"{name}.json")
|
||||
if os.path.exists(fpath):
|
||||
with open(fpath) as f:
|
||||
|
||||
Reference in New Issue
Block a user