Check Backtestability
tt_check_backtestabilityPre-flight a template against Tradetron's NATIVE backtest (the Backtest button in ASB): will the run succeed, before the user submits it?
Answers a different question from tt_validate_markdown — a template TT accepts can still fail its backtest, because the BT engine implements a subset of the live keyword surface and the BT data store covers a subset of exchanges. Checks: (1) every function token in conditions/legs/variables exists in the BT engine namespace (e.g. Leg SL trail, PCR, Total OI do NOT); (2) the exchanges touched have backtest data — NSE/NFO/BFO run (SENSEX options from 2023-08-07, BANKEX from 2023-08-11), MCX futures + options run (FastBT launch segment), Delta-India BTC/ETH daily options run (BTC from 2024-01-01, ETH from 2024-02-05), US venues run per-underlying (SPX/XSP/NDX/VIX index options from 2023-02-15 + an 18-symbol stock/ETF option list from 2021-08-16); non-Delta crypto exchanges remain blocked; (3) the window doesn't predate coverage; (4) error-prone classes (custom python, runtime-var underlying) are flagged. Since 2026-08-25 EVERY backtest — web or chat — runs on FastBT; this check pre-flights that engine.
Call it before tt_backtest_strategy or whenever the user asks "can I backtest this?".
Args:
template: the strategy object, passed INLINE — tt_create_strategy output or a
TT v2 export (both shapes accepted). Unlike tt_backtest_strategy, this tool
has NO strategy_id parameter: for a strategy already saved in the user's
account, call tt_get_strategy(strategy_id) first and pass its
data.strategy here as template.
start, end: optional 'YYYY-MM-DD' backtest window — enables coverage-window checks.
An end inside the last 35 days is a BT_WINDOW_TOO_RECENT blocker on NSE,
NFO and BFO (backtests there may only use data at least 35 days old; MCX,
crypto and US may end yesterday; the finding names the latest allowed
end date).
Returns {backtestable, verdict, confidence, blockers[], warnings[], stats, engine_build, billing, run_type_recommendation}. Blockers mean the run WILL fail; warnings mean it should run but may error or silently skip data.
BRANCH ON verdict, NOT ON backtestable. The boolean has two values and
this check has three answers: "blocked", "backtestable", and "unknown" —
one or more checks could not run (checks_skipped says which and why), or
the template carries a reference tt_create_strategy itself refuses. In the
"unknown" state backtestable still reads true, and it means UNCHECKED:
an exchange absent from the coverage table is judged by nothing, while one
that is IN it and has no data is a clean false. Never report "unknown" to
a user as "yes, this will backtest" — say which check did not run. Each finding is
{code, message, where?, fix?, detail?}: message is written FOR THE USER
(what is wrong, then what to change) and where names the place the way
ASB numbers it ("Set 1 -> Condition 18"), so relay them as they stand
rather than rewriting them. detail is the engineering explanation —
read it to reason, do not paste it at the user. The billing block carries the
LIST per-run price and whether backtest billing is enabled. It is not the
account's quote: a prepaid pack is spent first at ₹0 cash, and the binding
price is the one tt_backtest_strategy quotes before the user confirms — for
the LIVE wallet balance, pack credits and a top-up link call
tt_wallet_balance (this check makes no network calls).
run_type_recommendation = {type, confidence, evidence[]} — the intraday-vs-
positional reading derived from the template's own structure (same detector the
submit path uses). Present it as the DEFAULT when asking the user which way to
run; both remain runnable.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"template": "<template>"
},
"name": "tt_check_backtestability"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| end | No | Optional backtest window end, YYYY-MM-DD. | |
| start | No | Optional backtest window start, YYYY-MM-DD. | |
| template | Yes |