TBS Compare
Status (2026-11-09): built, not deployed. Page TBS > TBS Compare (pages/TbsCompare.jsx, route /tbs-compare, DEVELOPER), API POST /api/tbs/compare and /export (app/api/tbs_compare.py), maths in backend/tbs/compare.py, Excel in tbs/compare_export.py.
What it does
Pick 2 to 6 of your saved backtest reports (Save report on a result page). Finished runs are not offered: they are shared by every user on the server, a saved report belongs to the signed-in user, and the API rejects run ids. All baskets are put on one calendar (the days any of them traded inside the window, 0 where one did not trade), so Sharpe, correlation and drawdown mean the same for each. The window is the common window (where all could trade), each full period, or custom dates; the capital for the % figures is each basket's own margin or one common capital (so a 6-pair and a 20-pair basket compare fairly). A basket with no stored margin is flagged and uses Rs 1 lakh.
- KPIs in four groups: return (net, return on capital, return on margin, average / best day), risk (max drawdown % of peak and Rs, Calmar, longest drawdown, Sharpe, Sortino, worst day, 5% worst day, worst month), consistency (win days, profit factor, profitable months, losing streak, average win / average loss) and capital and costs. Best value green, worst red, direction aware; one config array in the page drives the table.
- Best by strip, equity and drawdown overlay (
ComparePanel, each basket on the same start value), risk versus return scatter, correlation matrix of daily P&L, Combine them (P&L and capital added; diversification = 1 - combined max drawdown / the sum of their own) and a month-by-month heatmap. Excel export. The choice is in the URL (?reports=1,2,3). - Conventions (CLAUDE.md rule 11): a period under one year shows the absolute return, from one year % p.a. (CAGR); drawdown as a % of the peak; every figure after slippage, brokerage and charges (the run's own numbers). Calmar and Sharpe use the annualised return and daily P&L.
Limits
A basket's margin is what its run stored (Quick estimate or exact SPAN). A report is compared on its stored legs without extra filters. Sharpe uses no risk-free rate.
Who sees which runs
Each TBS run records its owner (bt_run.usrid, migration d5e8a1c4f7b2). Recent runs, results, trades, exports, cancel and delete only work for the user's own runs; another user's run answers 404. Runs from before owners were recorded (usrid empty) are shown to ADMIN only. Run the alembic migration on the VPS.