QuantWright is an MCP server published by com.quantwright, hosted at quantwright.com. When last checked on 2026-11-22 it was working: it answers and lists its tools. It declares 6 tools, including describe_data, create_study, run_backtest, get_result, run_held_out_test.
Backtests with costs, a held-out test that counts once, a score that counts every version tried.
532 connections through 4 shared values. Tap any node.
Inferred from the host name and headers: what a server runs on, not who runs it.
Start here to backtest a trading idea. This server holds the price history (US stocks and ETFs, FX, spot gold and silver, spot crypto; daily and intraday bars) and runs backtests on it. Returns the markets and bar sizes served, the default costs per market, the rules and daily limits every run is held to, and how to write the strategy code; then call create_study.
No parameters.
{
"name": "describe_data",
"title": "What can be backtested",
"description": "Start here to backtest a trading idea. This server holds the price history (US stocks and ETFs, FX, spot gold and silver, spot crypto; daily and intraday bars) and runs backtests on it. Returns the markets and bar sizes served, the default costs per market, the rules and daily limits every run is held to, and how to write the strategy code; then call create_study.",
"inputSchema": {
"type": "object",
"required": [],
"properties": {},
"additionalProperties": false
},
"outputSchema": {
"type": "object",
"required": [],
"properties": {
"notes": {
"type": "array",
"items": {
"type": "string"
}
},
"rules": {
"type": "object"
},
"reason": {
"type": "string"
},
"status": {
"enum": [
"invalid_arguments",
"not_found",
"refused"
],
"type": "string"
},
"account": {
"type": "object",
"required": [
"can_run"
],
"properties": {
"reason": {
"enum": [
"terms_not_accepted",
"payment_required",
"ai_data_not_confirmed"
],
"type": "string"
},
"can_run": {
"type": "boolean"
},
"message": {
"type": "string"
},
"left_today": {
"type": "object",
"required": [
"studies",
"runs",
"engine_seconds"
],
"properties": {
"runs": {
"type": "integer"
},
"per_day": {
"type": "object",
"required": [
"studies",
"runs",
"engine_seconds"
],
"properties": {
"runs": {
"type": "integer"
},
"studies": {
"type": "integer"
},
"engine_seconds": {
"type": "integer"
}
},
"additionalProperties": false
},
"studies": {
"type": "integer"
},
"engine_seconds": {
"type": "integer"
}
},
"additionalProperties": false
},
"recent_studies": {
"type": "array",
"items": {
"type": "object",
"required": [
"study_id",
"name",
"created"
],
"properties": {
"name": {
"type": [
"string",
"null"
]
},
"created": {
"type": "string"
},
"study_id": {
"type": "string"
}
},
"additionalProperties": false
},
"maxItems": 10
}
},
"additionalProperties": false
},
"markets": {
"type": "array",
"items": {
"type": "string"
}
},
"message": {
"type": "string"
},
"docs_url": {
"type": "string"
},
"timeframes": {
"type": "array",
"items": {
"type": "string"
}
},
"code_contract": {
"type": "object",
"required": [
"version",
"text"
],
"properties": {
"text": {
"type": "string"
},
"version": {
"type": "string"
}
},
"additionalProperties": false
},
"default_costs": {
"type": "object",
"required": [
"rows",
"basis"
],
"properties": {
"rows": {
"type": "array",
"items": {
"type": "object",
"required": [
"market",
"example_symbol",
"timeframes",
"commission",
"slippage",
"round_trip_bps"
],
"properties": {
"market": {
"type": "string"
},
"slippage": {
"type": "object",
"required": [
"amount",
"unit",
"basis",
"fraction"
],
"properties": {
"unit": {
"type": "string",
"const": "bps"
},
"basis": {
"type": "string",
"const": "per_side"
},
"amount": {
"type": "number"
},
"fraction": {
"type": "number"
}
},
"additionalProperties": false
},
"commission": {
"type": "object",
"required": [
"amount",
"unit",
"basis",
"fraction"
],
"properties": {
"unit": {
"type": "string",
"const": "bps"
},
"basis": {
"type": "string",
"const": "round_trip"
},
"amount": {
"type": "number"
},
"fraction": {
"type": "number"
}
},
"additionalProperties": false
},
"timeframes": {
"type": "array",
"items": {
"type": "string"
}
},
"example_symbol": {
"type": "string"
},
"round_trip_bps": {
"type": "number"
},
"round_trip_pips": {
"type": "object",
"required": [
"pair",
"rate",
"pips"
],
"properties": {
"pair": {
"type": "string"
},
"pips": {
"type": "number"
},
"rate": {
"type": "number"
}
},
"additionalProperties": false
}
},
"additionalProperties": false
}
},
"basis": {
"type": "string"
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
"annotations": {
"readOnlyHint": true,
"openWorldHint": false
}
}None yet. Changes appear after a server's second daily check.
Squares are this server's values; dots are other servers sharing them. A shared address or publisher is a lead, not proof of a common operator.
Opens a study, the named set of runs every backtest belongs to: call it once per question, before run_backtest. Can set a hold-out period, once and only here, that no run tests except run_held_out_test. Only the first held-out test per account and market counts, and any earlier run on the market (in any study, at any bar size) that read its days disqualifies it: set the hold-out in your first study on a market, before any run on it.
| Parameter | Type | Description |
|---|---|---|
| name * | string | What the study tests, in a few words. |
| hold_out | object | The days kept back from every run but run_held_out_test; set once, here. Set it in your first study on a market, before any run on it: a held-out test on days an earlier run on the market read does not count. |
{
"name": "create_study",
"title": "Start a study",
"description": "Opens a study, the named set of runs every backtest belongs to: call it once per question, before run_backtest. Can set a hold-out period, once and only here, that no run tests except run_held_out_test. Only the first held-out test per account and market counts, and any earlier run on the market (in any study, at any bar size) that read its days disqualifies it: set the hold-out in your first study on a market, before any run on it.",
"inputSchema": {
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"type": "string",
"description": "What the study tests, in a few words."
},
"hold_out": {
"type": "object",
"required": [
"from"
],
"properties": {
"to": {
"type": "string",
"pattern": "^\\d{4}-\\d{2}-\\d{2}$",
"description": "A day, YYYY-MM-DD."
},
"from": {
"type": "string",
"pattern": "^\\d{4}-\\d{2}-\\d{2}$",
"description": "A day, YYYY-MM-DD."
}
},
"description": "The days kept back from every run but run_held_out_test; set once, here. Set it in your first study on a market, before any run on it: a held-out test on days an earlier run on the market read does not count.",
"additionalProperties": false
}
},
"additionalProperties": false
},
"outputSchema": {
"type": "object",
"required": [
"status"
],
"properties": {
"next": {
"type": [
"object",
"null"
],
"required": [
"tool",
"arguments",
"why"
],
"properties": {
"why": {
"type": "string"
},
"tool": {
"enum": [
"run_backtest",
"get_result"
],
"type": "string"
},
"arguments": {
"type": "object"
},
"after_seconds": {
"type": "integer"
}
},
"additionalProperties": false
},
"reason": {
"type": "string"
},
"status": {
"enum": [
"created",
"invalid_arguments",
"not_found",
"refused"
],
"type": "string"
},
"message": {
"type": "string"
},
"hold_out": {
"type": [
"object",
"null"
],
"required": [
"from"
],
"properties": {
"to": {
"type": "string"
},
"from": {
"type": "string"
}
},
"additionalProperties": false
},
"study_id": {
"type": "string"
}
},
"additionalProperties": false
},
"annotations": {
"readOnlyHint": false,
"openWorldHint": false,
"idempotentHint": false,
"destructiveHint": false
}
}Backtests a trading rule on this server's price history: one backtesting.py Strategy class, one symbol, one bar size, in a study. Use it to test, backtest or evaluate a trading rule or strategy. Returns summary figures (return, drawdown, Sharpe, win rate, trades, a grade, whether it beat buy-and-hold) and the run's trades (when each entered and left, which exit ended it, its side, win or loss), never prices or bars; a figure may be withheld, with the reason. Waits up to 90 s, then answers status "running" with a run_id for get_result.
| Parameter | Type | Description |
|---|---|---|
| code * | string | One backtesting.py Strategy class (describe_data has the rules). |
| costs | any | The costs: two fractions of the trade value, or a list of costs each in its own unit. |
| label | string | A short text shown with the run. |
| symbol * | string | One ticker ("QQQ", "BTCUSD", "EURUSD"). |
| window | any | Dates ({from, to}; `to` may be "latest") or the last N days, months or years ({last: {n, unit}}). Left out: the standard history, the newest bars counted back from the newest bar, cut at the start of the hold-out. |
| study_id * | string | The id create_study returned. |
| timeframe * | string | one of ["1m","5m","15m","30m","1h","4h","1d"] |
| account_usd | number | The starting account, in US dollars. |
| stated_rules | array | Rules the trades are checked against, one per kind. |
{
"name": "run_backtest",
"title": "Backtest a strategy",
"description": "Backtests a trading rule on this server's price history: one backtesting.py Strategy class, one symbol, one bar size, in a study. Use it to test, backtest or evaluate a trading rule or strategy. Returns summary figures (return, drawdown, Sharpe, win rate, trades, a grade, whether it beat buy-and-hold) and the run's trades (when each entered and left, which exit ended it, its side, win or loss), never prices or bars; a figure may be withheld, with the reason. Waits up to 90 s, then answers status \"running\" with a run_id for get_result.",
"inputSchema": {
"type": "object",
"required": [
"study_id",
"code",
"symbol",
"timeframe"
],
"properties": {
"code": {
"type": "string",
"maxLength": 50000,
"description": "One backtesting.py Strategy class (describe_data has the rules)."
},
"costs": {
"oneOf": [
{
"type": "object",
"required": [],
"properties": {
"slippage": {
"type": "number",
"maximum": 0.05,
"minimum": 0,
"description": "A fraction of the trade value per fill (entry and exit)."
},
"commission": {
"type": "number",
"maximum": 0.05,
"minimum": 0,
"description": "A fraction of the trade value at entry (0.0005 is 0.05%), charged once per round trip."
}
},
"additionalProperties": false
},
{
"type": "array",
"items": {
"type": "object",
"required": [
"side",
"amount",
"unit",
"basis"
],
"properties": {
"side": {
"enum": [
"commission",
"slippage",
"spread"
],
"type": "string"
},
"unit": {
"enum": [
"percent",
"bps",
"usd_per_share",
"usd_per_ounce",
"pips",
"usd_per_order",
"usd_per_lot"
],
"type": "string",
"description": "usd_per_share on stocks and ETFs; usd_per_ounce, and usd_per_lot for a commission per lot, on spot gold and silver; pips on currency pairs; percent, bps and usd_per_order (a flat fee per order, whatever its size) on any market."
},
"basis": {
"enum": [
"per_side",
"round_trip"
],
"type": "string",
"description": "per_side: on each fill; round_trip: once for the entry and exit together."
},
"amount": {
"type": "number",
"minimum": 0,
"description": "The figure in `unit` (0.005 usd_per_share is half a cent a share; 0.1 percent is 0.1%)."
},
"lot_ounces": {
"type": "number",
"description": "usd_per_lot only: the lot's size in ounces. Left out, the standard lot: 100 oz of gold, 5,000 oz of silver.",
"exclusiveMinimum": 0
}
},
"additionalProperties": false
},
"maxItems": 6,
"minItems": 1
}
],
"description": "The costs: two fractions of the trade value, or a list of costs each in its own unit."
},
"label": {
"type": "string",
"description": "A short text shown with the run."
},
"symbol": {
"type": "string",
"description": "One ticker (\"QQQ\", \"BTCUSD\", \"EURUSD\")."
},
"window": {
"oneOf": [
{
"type": "object",
"required": [],
"properties": {
"to": {
"anyOf": [
{
"type": "string",
"pattern": "^\\d{4}-\\d{2}-\\d{2}$",
"description": "A day, YYYY-MM-DD."
},
{
"type": "string",
"const": "latest"
}
]
},
"from": {
"type": "string",
"pattern": "^\\d{4}-\\d{2}-\\d{2}$",
"description": "A day, YYYY-MM-DD."
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"last"
],
"properties": {
"last": {
"type": "object",
"required": [
"n",
"unit"
],
"properties": {
"n": {
"type": "integer",
"minimum": 1
},
"unit": {
"enum": [
"days",
"months",
"years"
],
"type": "string"
}
},
"additionalProperties": false
}
},
"additionalProperties": false
}
],
"description": "Dates ({from, to}; `to` may be \"latest\") or the last N days, months or years ({last: {n, unit}}). Left out: the standard history, the newest bars counted back from the newest bar, cut at the start of the hold-out."
},
"study_id": {
"type": "string",
"description": "The id create_study returned."
},
"timeframe": {
"enum": [
"1m",
"5m",
"15m",
"30m",
"1h",
"4h",
"1d"
],
"type": "string"
},
"account_usd": {
"type": "number",
"description": "The starting account, in US dollars."
},
"stated_rules": {
"type": "array",
"items": {
"oneOf": [
{
"type": "object",
"required": [
"kind"
],
"properties": {
"kind": {
"type": "string",
"const": "no_overnight"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"kind",
"time"
],
"properties": {
"tz": {
"type": "string",
"description": "An IANA time zone (\"America/New_York\"); none is New York."
},
"kind": {
"type": "string",
"const": "flat_by"
},
"time": {
"type": "string",
"pattern": "^([01]\\d|2[0-3]):[0-5]\\d$",
"description": "\"HH:MM\", 24-hour."
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"kind",
"from",
"to"
],
"properties": {
"to": {
"type": "string",
"pattern": "^([01]\\d|2[0-3]):[0-5]\\d$",
"description": "\"HH:MM\", 24-hour."
},
"tz": {
"type": "string",
"description": "An IANA time zone (\"America/New_York\"); none is New York."
},
"from": {
"type": "string",
"pattern": "^([01]\\d|2[0-3]):[0-5]\\d$",
"description": "\"HH:MM\", 24-hour."
},
"kind": {
"type": "string",
"const": "session"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"kind",
"n"
],
"properties": {
"n": {
"type": "integer",
"maximum": 10,
"minimum": 1
},
"kind": {
"type": "string",
"const": "max_trades_per_day"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"kind",
"pct"
],
"properties": {
"pct": {
"type": "number",
"maximum": 10,
"description": "A percent as written: 0.5 is 0.5%.",
"exclusiveMinimum": 0
},
"kind": {
"type": "string",
"const": "risk_per_trade_pct"
}
},
"additionalProperties": false
}
]
},
"maxItems": 5,
"description": "Rules the trades are checked against, one per kind."
}
},
"additionalProperties": false
},
"outputSchema": {
"type": "object",
"required": [
"status"
],
"properties": {
"next": {
"type": [
"object",
"null"
],
"required": [
"tool",
"arguments",
"why"
],
"properties": {
"why": {
"type": "string"
},
"tool": {
"enum": [
"run_backtest",
"get_result"
],
"type": "string"
},
"arguments": {
"type": "object"
},
"after_seconds": {
"type": "integer"
}
},
"additionalProperties": false
},
"basis": {
"type": "object",
"required": [],
"properties": {
"sharpe": {
"type": "string"
},
"exposure": {
"type": "string"
},
"net_return": {
"type": "string"
},
"max_drawdown": {
"type": "string"
},
"profit_factor": {
"type": "string"
},
"deflated_sharpe": {
"type": "string"
}
},
"additionalProperties": false
},
"grade": {
"type": [
"object",
"null"
],
"required": [
"grade",
"score",
"trials",
"deflated_sharpe"
],
"properties": {
"grade": {
"type": [
"string",
"null"
]
},
"score": {
"type": [
"number",
"null"
]
},
"search": {
"type": "object",
"required": [
"market",
"runs",
"evaluations_without_a_run",
"discarded_candidates",
"distinct_setting"
],
"properties": {
"runs": {
"type": "object",
"required": [
"in_study",
"counted"
],
"properties": {
"counted": {
"type": "integer"
},
"in_study": {
"type": "integer"
},
"code_draws": {
"type": "integer"
},
"markets_in_study": {
"type": "integer"
},
"settings_30_days": {
"type": "integer"
},
"left_out_no_trades": {
"type": "integer"
}
},
"additionalProperties": false
},
"market": {
"type": "string"
},
"distinct_setting": {
"type": "string"
},
"independent_tries": {
"type": "object",
"required": [
"settings",
"evaluations"
],
"properties": {
"settings": {
"type": "number"
},
"evaluations": {
"type": "number"
}
},
"additionalProperties": false
},
"discarded_candidates": {
"type": "integer"
},
"evaluations_without_a_run": {
"type": "object",
"required": [
"sweep_cells",
"sensitivity_variants",
"walk_forward_evaluations"
],
"properties": {
"sweep_cells": {
"type": "integer"
},
"sensitivity_variants": {
"type": "integer"
},
"walk_forward_evaluations": {
"type": "integer"
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
"trials": {
"type": "number"
},
"deflated_sharpe": {
"type": [
"number",
"null"
]
}
},
"additionalProperties": false
},
"lines": {
"type": "array",
"items": {
"type": "string"
}
},
"market": {
"type": "object",
"required": [
"symbol",
"timeframe",
"from",
"to",
"bars",
"source",
"derived_only"
],
"properties": {
"to": {
"type": "string"
},
"bars": {
"type": "integer"
},
"from": {
"type": "string"
},
"source": {
"type": "string"
},
"symbol": {
"type": "string"
},
"timeframe": {
"type": "string"
},
"derived_only": {
"type": "boolean",
"description": "True when the market-data licence lets the account see only results derived from the prices (figures, never the prices or bars themselves). It says what may be shown, not how the quote is made."
}
},
"additionalProperties": false
},
"reason": {
"type": "string"
},
"run_id": {
"type": "string"
},
"status": {
"enum": [
"ran",
"running",
"refused",
"rejected",
"error",
"held",
"invalid_arguments",
"not_found"
],
"type": "string"
},
"window": {
"type": "object",
"required": [
"asked",
"run",
"standard",
"longest",
"start_later",
"end_at_hold_out"
],
"properties": {
"run": {
"type": "object",
"required": [
"from",
"to"
],
"properties": {
"to": {
"type": "string"
},
"from": {
"type": "string"
}
},
"additionalProperties": false
},
"gaps": {
"type": "array",
"items": {
"type": "object",
"required": [
"from",
"to"
],
"properties": {
"to": {
"type": "string"
},
"from": {
"type": "string"
}
},
"additionalProperties": false
}
},
"asked": {
"type": [
"object",
"null"
]
},
"warmup": {
"type": "object",
"required": [
"bars"
],
"properties": {
"to": {
"type": "string"
},
"bars": {
"type": "integer"
},
"from": {
"type": "string"
}
},
"additionalProperties": false
},
"longest": {
"type": "object",
"required": [
"all_daily_history"
],
"properties": {
"from": {
"type": "string"
},
"note": {
"type": "string"
},
"most_bars": {
"type": "integer"
},
"all_daily_history": {
"type": "boolean"
}
},
"additionalProperties": false
},
"standard": {
"type": [
"object",
"null"
],
"required": [
"bars"
],
"properties": {
"bars": {
"type": "integer"
}
},
"additionalProperties": false
},
"start_later": {
"type": [
"object",
"null"
],
"required": [
"reason",
"first_bar",
"bars_fetched"
],
"properties": {
"reason": {
"enum": [
"history_starts",
"bars_fetched"
],
"type": "string"
},
"first_bar": {
"type": "string"
},
"bars_fetched": {
"type": "integer"
}
},
"additionalProperties": false
},
"end_at_hold_out": {
"type": [
"string",
"null"
]
}
},
"additionalProperties": false
},
"message": {
"type": "string"
},
"metrics": {
"type": "object",
"required": [
"trades",
"net_return",
"max_drawdown",
"annualized_return",
"win_rate",
"sharpe",
"profit_factor",
"exposure",
"trades_per_year"
],
"properties": {
"sharpe": {
"type": [
"number",
"null"
]
},
"trades": {
"type": [
"integer",
"null"
]
},
"exposure": {
"type": [
"number",
"null"
]
},
"win_rate": {
"type": [
"number",
"null"
]
},
"net_return": {
"type": [
"number",
"null"
]
},
"max_drawdown": {
"type": [
"number",
"null"
]
},
"profit_factor": {
"type": [
"number",
"null"
]
},
"sharpe_withheld": {
"enum": [
"market_data_licence",
"trade_floor",
"trial_count_incomplete",
"not_on_api",
"no_benchmark"
],
"type": "string"
},
"trades_per_year": {
"type": [
"number",
"null"
]
},
"trades_withheld": {
"enum": [
"market_data_licence",
"trade_floor",
"trial_count_incomplete",
"not_on_api",
"no_benchmark"
],
"type": "string"
},
"annualized_return": {
"type": [
"number",
"null"
]
},
"exposure_withheld": {
"enum": [
"market_data_licence",
"trade_floor",
"trial_count_incomplete",
"not_on_api",
"no_benchmark"
],
"type": "string"
},
"win_rate_withheld": {
"enum": [
"market_data_licence",
"trade_floor",
"trial_count_incomplete",
"not_on_api",
"no_benchmark"
],
"type": "string"
},
"net_return_withheld": {
"enum": [
"market_data_licence",
"trade_floor",
"trial_count_incomplete",
"not_on_api",
"no_benchmark"
],
"type": "string"
},
"max_drawdown_withheld": {
"enum": [
"market_data_licence",
"trade_floor",
"trial_count_incomplete",
"not_on_api",
"no_benchmark"
],
"type": "string"
},
"profit_factor_withheld": {
"enum": [
"market_data_licence",
"trade_floor",
"trial_count_incomplete",
"not_on_api",
"no_benchmark"
],
"type": "string"
},
"trades_per_year_withheld": {
"enum": [
"market_data_licence",
"trade_floor",
"trial_count_incomplete",
"not_on_api",
"no_benchmark"
],
"type": "string"
},
"annualized_return_withheld": {
"enum": [
"market_data_licence",
"trade_floor",
"trial_count_incomplete",
"not_on_api",
"no_benchmark"
],
"type": "string"
}
},
"additionalProperties": false
},
"notices": {
"type": "array",
"items": {
"type": "object",
"required": [
"kind",
"field",
"text"
],
"properties": {
"kind": {
"enum": [
"withheld",
"cut"
],
"type": "string"
},
"text": {
"type": "string"
},
"field": {
"type": "string"
},
"total": {
"type": "integer"
},
"reason": {
"enum": [
"market_data_licence",
"trade_floor",
"trial_count_incomplete",
"not_on_api",
"no_benchmark"
],
"type": "string"
},
"returned": {
"type": "integer"
},
"default_limit": {
"type": "integer"
}
},
"additionalProperties": false
}
},
"version": {
"type": "integer"
},
"headline": {
"type": "string"
},
"held_out": {
"type": [
"object",
"null"
],
"required": [
"counts"
],
"properties": {
"counts": {
"type": "boolean"
},
"covered_by": {
"type": "array",
"items": {
"type": "object",
"required": [
"made_in",
"version",
"window"
],
"properties": {
"run_id": {
"type": "string"
},
"window": {
"type": "object",
"required": [
"from",
"to"
],
"properties": {
"to": {
"type": "string"
},
"from": {
"type": "string"
}
},
"additionalProperties": false
},
"made_in": {
"enum": [
"api",
"app"
],
"type": "string"
},
"version": {
"type": "integer"
},
"study_id": {
"type": "string"
}
},
"additionalProperties": false
}
},
"tested_run": {
"type": "object",
"required": [
"run_id"
],
"properties": {
"run_id": {
"type": "string"
},
"version": {
"type": "integer"
}
},
"additionalProperties": false
},
"covered_by_total": {
"type": "integer"
}
},
"additionalProperties": false
},
"settings": {
"type": "object",
"required": [
"account_usd",
"window"
],
"properties": {
"window": {
"type": "object",
"required": [
"value",
"origin"
],
"properties": {
"value": {},
"origin": {
"type": [
"string",
"null"
]
}
},
"additionalProperties": false
},
"slippage": {
"type": "object",
"required": [
"value",
"origin"
],
"properties": {
"value": {},
"origin": {
"type": [
"string",
"null"
]
}
},
"additionalProperties": false
},
"commission": {
"type": "object",
"required": [
"value",
"origin"
],
"properties": {
"value": {},
"origin": {
"type": [
"string",
"null"
]
}
},
"additionalProperties": false
},
"account_usd": {
"type": "object",
"required": [
"value",
"origin"
],
"properties": {
"value": {},
"origin": {
"type": [
"string",
"null"
]
}
},
"additionalProperties": false
},
"costs_charged": {
"type": "object",
"required": [
"value",
"origin"
],
"properties": {
"note": {
"type": "string"
},
"value": {
"type": "array",
"items": {
"type": "object",
"required": [
"side",
"amount",
"unit",
"basis"
],
"properties": {
"side": {
"enum": [
"commission",
"slippage",
"spread"
],
"type": "string"
},
"unit": {
"enum": [
"percent",
"bps",
"usd_per_share",
"usd_per_ounce",
"pips",
"usd_per_order",
"usd_per_lot"
],
"type": "string"
},
"basis": {
"enum": [
"per_side",
"round_trip"
],
"type": "string"
},
"amount": {
"type": "number"
},
"lot_ounces": {
"type": "number"
}
},
"additionalProperties": false
}
},
"origin": {
"type": [
"string",
"null"
]
}
},
"description": "Every cost the run charged, in its own unit and basis. When `costs` was a list, this is the list; `commission` and `slippage` then appear only for a side the list left out (the market's default, as a fraction of the trade value). `note` says where a cost changed basis when charged.",
"additionalProperties": false
}
},
"additionalProperties": false
},
"study_id": {
"type": "string"
},
"warnings": {
"type": "array",
"items": {
"type": "string"
},
"maxItems": 2
},
"retryable": {
"type": "boolean"
},
"cost_table": {
"type": "object",
"required": [
"components",
"defaults_replaced",
"round_trip_total"
],
"properties": {
"components": {
"type": "array",
"items": {
"type": "object",
"required": [
"component",
"amount",
"unit",
"basis",
"per_round_trip",
"charged",
"origin"
],
"properties": {
"unit": {
"enum": [
"percent",
"bps",
"usd_per_share",
"usd_per_ounce",
"pips",
"usd_per_order",
"usd_per_lot"
],
"type": "string"
},
"basis": {
"enum": [
"per_side",
"round_trip"
],
"type": "string"
},
"amount": {
"type": "number"
},
"origin": {
"type": [
"string",
"null"
],
"description": "caller: your costs; default: the market's default."
},
"charged": {
"type": "string",
"description": "When and on what the engine takes it."
},
"component": {
"enum": [
"commission",
"slippage",
"spread"
],
"type": "string"
},
"per_round_trip": {
"type": "object",
"required": [
"amount",
"unit"
],
"properties": {
"unit": {
"enum": [
"bps",
"pips",
"usd",
"usd_per_share",
"usd_per_ounce"
],
"type": "string"
},
"amount": {
"type": "number"
}
},
"additionalProperties": false
}
},
"additionalProperties": false
}
},
"round_trip_total": {
"type": "object",
"required": [
"bps_of_value"
],
"properties": {
"usd": {
"type": "number"
},
"pips": {
"type": "number"
},
"bps_of_value": {
"type": "number"
},
"usd_per_ounce": {
"type": "number"
},
"usd_per_share": {
"type": "number"
}
},
"additionalProperties": false
},
"defaults_replaced": {
"type": "array",
"items": {
"enum": [
"commission",
"slippage"
],
"type": "string"
},
"description": "The market defaults your costs replaced: none of them was charged, and nothing was added to your costs."
}
},
"description": "Every cost the run charged: each component (commission, slippage, spread) with its amount, unit and basis, what it comes to per round trip, when it is taken, and whether it is yours (caller) or the market's default; the round trip summed by unit (pips on a currency pair, the costs stated in pips). Costs you send replace the market's defaults side by side: a commission replaces the default commission, a slippage or a spread replaces the default slippage, a side you leave out is charged at the market's default, and nothing is added on top.",
"additionalProperties": false
},
"disclaimer": {
"type": "string",
"description": "The hypothetical-performance line, on a result (a run, or a study's runs): the same text the app shows with every result."
},
"look_ahead": {
"enum": [
"leak",
"possible",
"clean",
null
],
"type": [
"string",
"null"
]
},
"trade_list": {
"type": "object",
"required": [
"total",
"trades"
],
"properties": {
"next": {
"type": [
"object",
"null"
],
"required": [
"tool",
"arguments",
"why"
],
"properties": {
"why": {
"type": "string"
},
"tool": {
"enum": [
"run_backtest",
"get_result"
],
"type": "string"
},
"arguments": {
"type": "object"
},
"after_seconds": {
"type": "integer"
}
},
"additionalProperties": false
},
"page": {
"type": "integer"
},
"clock": {
"enum": [
"ET",
"CT",
"UTC"
],
"type": "string",
"description": "The clock the times are on; there when the bars are shorter than a day (a daily run gives days)."
},
"pages": {
"type": "integer"
},
"total": {
"type": "integer"
},
"trades": {
"type": "array",
"items": {
"type": "object",
"required": [
"entry",
"exit",
"side",
"outcome"
],
"properties": {
"exit": {
"type": "string"
},
"side": {
"enum": [
"long",
"short"
],
"type": "string"
},
"entry": {
"type": "string"
},
"outcome": {
"enum": [
"win",
"loss",
"flat",
null
],
"type": [
"string",
"null"
]
},
"exit_type": {
"enum": [
"stop",
"target",
"trailing stop",
"time limit",
"exit rule",
"end of data",
null
],
"type": [
"string",
"null"
],
"description": "Which exit ended the trade (never a price or level). There on a list kept with exit types."
}
},
"additionalProperties": false
},
"maxItems": 100
},
"message": {
"type": "string"
},
"outcome_withheld": {
"enum": [
"trade_floor"
],
"type": "string",
"description": "There when every outcome is null: a run of fewer trades than the floor gives no win or loss, as it gives no win rate."
}
},
"description": "The run's trades in the order they were made, a page at a time: when each entered and left (a day on daily bars; a time on the `clock` on shorter ones; \"open at the end\" for a trade still open when the data ended), its side, whether it won or lost after costs, and which exit ended it (a word: stop, exit rule, target, time limit…). No prices, levels, sizes or returns.",
"additionalProperties": false
},
"buy_and_hold": {
"type": "object",
"required": [
"beat",
"return",
"return_withheld"
],
"properties": {
"beat": {
"type": [
"boolean",
"null"
]
},
"return": {
"type": "null"
},
"beat_withheld": {
"enum": [
"market_data_licence",
"trade_floor",
"trial_count_incomplete",
"not_on_api",
"no_benchmark"
],
"type": "string"
},
"return_withheld": {
"enum": [
"market_data_licence",
"not_on_api"
],
"type": "string"
}
},
"additionalProperties": false
},
"replayed_from": {
"type": "string"
},
"grade_withheld": {
"enum": [
"trial_count_incomplete",
"trade_floor",
null
],
"type": [
"string",
"null"
]
},
"runs_left_today": {
"type": "object",
"required": [
"symbol",
"left",
"per_day"
],
"properties": {
"left": {
"type": "integer"
},
"symbol": {
"type": "string"
},
"per_day": {
"type": "integer"
}
},
"additionalProperties": false
},
"hold_out_estimate": {
"type": "object",
"required": [
"expected_trades",
"trade_floor",
"years"
],
"properties": {
"years": {
"type": "number"
},
"trade_floor": {
"type": "integer"
},
"expected_trades": {
"type": "integer"
}
},
"additionalProperties": false
},
"poll_after_seconds": {
"type": "integer"
},
"stated_rule_breaks": {
"type": "array",
"items": {
"type": "object",
"required": [
"rule",
"name",
"count",
"of"
],
"properties": {
"of": {
"type": "integer"
},
"name": {
"type": "string"
},
"rule": {
"type": "string"
},
"count": {
"type": "integer"
}
},
"additionalProperties": false
}
}
},
"additionalProperties": false
},
"annotations": {
"readOnlyHint": false,
"openWorldHint": false,
"idempotentHint": false,
"destructiveHint": false
}
}Reads a backtest result by its run_id (when run_backtest answered "running", call this until the run ends), or a study's runs by study_id (one of them with version). A run comes with its trades, a page at a time (trades_page).
| Parameter | Type | Description |
|---|---|---|
| run_id | string | A run_id run_backtest or run_held_out_test returned. |
| version | any | |
| study_id | string | A study's id, for its runs (the newest 20 by default); with `version`, one of them. |
| trades_page | integer | With a run (run_id, or study_id with version): the page of its trade list, from 1; a page holds 100 trades. Left out: the first. |
| before_version | any | With study_id: the 20 runs before this version (a list's `next` gives it). |
{
"name": "get_result",
"title": "Read a result",
"description": "Reads a backtest result by its run_id (when run_backtest answered \"running\", call this until the run ends), or a study's runs by study_id (one of them with version). A run comes with its trades, a page at a time (trades_page).",
"inputSchema": {
"type": "object",
"required": [],
"properties": {
"run_id": {
"type": "string",
"description": "A run_id run_backtest or run_held_out_test returned."
},
"version": {
"anyOf": [
{
"type": "integer",
"minimum": 1
},
{
"type": "string",
"pattern": "^[vV]?\\d+$"
}
]
},
"study_id": {
"type": "string",
"description": "A study's id, for its runs (the newest 20 by default); with `version`, one of them."
},
"trades_page": {
"type": "integer",
"minimum": 1,
"description": "With a run (run_id, or study_id with version): the page of its trade list, from 1; a page holds 100 trades. Left out: the first."
},
"before_version": {
"anyOf": [
{
"type": "integer",
"minimum": 1
},
{
"type": "string",
"pattern": "^[vV]?\\d+$"
}
],
"description": "With study_id: the 20 runs before this version (a list's `next` gives it)."
}
},
"additionalProperties": false
},
"outputSchema": {
"type": "object",
"required": [
"status"
],
"properties": {
"next": {
"type": [
"object",
"null"
],
"required": [
"tool",
"arguments",
"why"
],
"properties": {
"why": {
"type": "string"
},
"tool": {
"enum": [
"run_backtest",
"get_result"
],
"type": "string"
},
"arguments": {
"type": "object"
},
"after_seconds": {
"type": "integer"
}
},
"additionalProperties": false
},
"runs": {
"type": "array",
"items": {
"type": "object",
"required": [
"version",
"run_id",
"headline",
"grade",
"trials",
"net_return"
],
"properties": {
"grade": {
"type": [
"string",
"null"
]
},
"run_id": {
"type": "string"
},
"trials": {
"type": [
"number",
"null"
]
},
"version": {
"type": "integer"
},
"headline": {
"type": "string"
},
"net_return": {
"type": [
"number",
"null"
]
},
"grade_withheld": {
"enum": [
"trial_count_incomplete",
"trade_floor"
],
"type": "string"
},
"net_return_withheld": {
"enum": [
"market_data_licence",
"trade_floor",
"trial_count_incomplete",
"not_on_api",
"no_benchmark"
],
"type": "string"
}
},
"additionalProperties": false
}
},
"basis": {
"type": "object",
"required": [],
"properties": {
"sharpe": {
"type": "string"
},
"exposure": {
"type": "string"
},
"net_return": {
"type": "string"
},
"max_drawdown": {
"type": "string"
},
"profit_factor": {
"type": "string"
},
"deflated_sharpe": {
"type": "string"
}
},
"additionalProperties": false
},
"grade": {
"type": [
"object",
"null"
],
"required": [
"grade",
"score",
"trials",
"deflated_sharpe"
],
"properties": {
"grade": {
"type": [
"string",
"null"
]
},
"score": {
"type": [
"number",
"null"
]
},
"search": {
"type": "object",
"required": [
"market",
"runs",
"evaluations_without_a_run",
"discarded_candidates",
"distinct_setting"
],
"properties": {
"runs": {
"type": "object",
"required": [
"in_study",
"counted"
],
"properties": {
"counted": {
"type": "integer"
},
"in_study": {
"type": "integer"
},
"code_draws": {
"type": "integer"
},
"markets_in_study": {
"type": "integer"
},
"settings_30_days": {
"type": "integer"
},
"left_out_no_trades": {
"type": "integer"
}
},
"additionalProperties": false
},
"market": {
"type": "string"
},
"distinct_setting": {
"type": "string"
},
"independent_tries": {
"type": "object",
"required": [
"settings",
"evaluations"
],
"properties": {
"settings": {
"type": "number"
},
"evaluations": {
"type": "number"
}
},
"additionalProperties": false
},
"discarded_candidates": {
"type": "integer"
},
"evaluations_without_a_run": {
"type": "object",
"required": [
"sweep_cells",
"sensitivity_variants",
"walk_forward_evaluations"
],
"properties": {
"sweep_cells": {
"type": "integer"
},
"sensitivity_variants": {
"type": "integer"
},
"walk_forward_evaluations": {
"type": "integer"
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
"trials": {
"type": "number"
},
"deflated_sharpe": {
"type": [
"number",
"null"
]
}
},
"additionalProperties": false
},
"lines": {
"type": "array",
"items": {
"type": "string"
}
},
"market": {
"type": "object",
"required": [
"symbol",
"timeframe",
"from",
"to",
"bars",
"source",
"derived_only"
],
"properties": {
"to": {
"type": "string"
},
"bars": {
"type": "integer"
},
"from": {
"type": "string"
},
"source": {
"type": "string"
},
"symbol": {
"type": "string"
},
"timeframe": {
"type": "string"
},
"derived_only": {
"type": "boolean",
"description": "True when the market-data licence lets the account see only results derived from the prices (figures, never the prices or bars themselves). It says what may be shown, not how the quote is made."
}
},
"additionalProperties": false
},
"reason": {
"type": "string"
},
"run_id": {
"type": "string"
},
"status": {
"enum": [
"ran",
"running",
"refused",
"rejected",
"error",
"held",
"invalid_arguments",
"not_found",
"study"
],
"type": "string"
},
"window": {
"type": "object",
"required": [
"asked",
"run",
"standard",
"longest",
"start_later",
"end_at_hold_out"
],
"properties": {
"run": {
"type": "object",
"required": [
"from",
"to"
],
"properties": {
"to": {
"type": "string"
},
"from": {
"type": "string"
}
},
"additionalProperties": false
},
"gaps": {
"type": "array",
"items": {
"type": "object",
"required": [
"from",
"to"
],
"properties": {
"to": {
"type": "string"
},
"from": {
"type": "string"
}
},
"additionalProperties": false
}
},
"asked": {
"type": [
"object",
"null"
]
},
"warmup": {
"type": "object",
"required": [
"bars"
],
"properties": {
"to": {
"type": "string"
},
"bars": {
"type": "integer"
},
"from": {
"type": "string"
}
},
"additionalProperties": false
},
"longest": {
"type": "object",
"required": [
"all_daily_history"
],
"properties": {
"from": {
"type": "string"
},
"note": {
"type": "string"
},
"most_bars": {
"type": "integer"
},
"all_daily_history": {
"type": "boolean"
}
},
"additionalProperties": false
},
"standard": {
"type": [
"object",
"null"
],
"required": [
"bars"
],
"properties": {
"bars": {
"type": "integer"
}
},
"additionalProperties": false
},
"start_later": {
"type": [
"object",
"null"
],
"required": [
"reason",
"first_bar",
"bars_fetched"
],
"properties": {
"reason": {
"enum": [
"history_starts",
"bars_fetched"
],
"type": "string"
},
"first_bar": {
"type": "string"
},
"bars_fetched": {
"type": "integer"
}
},
"additionalProperties": false
},
"end_at_hold_out": {
"type": [
"string",
"null"
]
}
},
"additionalProperties": false
},
"message": {
"type": "string"
},
"metrics": {
"type": "object",
"required": [
"trades",
"net_return",
"max_drawdown",
"annualized_return",
"win_rate",
"sharpe",
"profit_factor",
"exposure",
"trades_per_year"
],
"properties": {
"sharpe": {
"type": [
"number",
"null"
]
},
"trades": {
"type": [
"integer",
"null"
]
},
"exposure": {
"type": [
"number",
"null"
]
},
"win_rate": {
"type": [
"number",
"null"
]
},
"net_return": {
"type": [
"number",
"null"
]
},
"max_drawdown": {
"type": [
"number",
"null"
]
},
"profit_factor": {
"type": [
"number",
"null"
]
},
"sharpe_withheld": {
"enum": [
"market_data_licence",
"trade_floor",
"trial_count_incomplete",
"not_on_api",
"no_benchmark"
],
"type": "string"
},
"trades_per_year": {
"type": [
"number",
"null"
]
},
"trades_withheld": {
"enum": [
"market_data_licence",
"trade_floor",
"trial_count_incomplete",
"not_on_api",
"no_benchmark"
],
"type": "string"
},
"annualized_return": {
"type": [
"number",
"null"
]
},
"exposure_withheld": {
"enum": [
"market_data_licence",
"trade_floor",
"trial_count_incomplete",
"not_on_api",
"no_benchmark"
],
"type": "string"
},
"win_rate_withheld": {
"enum": [
"market_data_licence",
"trade_floor",
"trial_count_incomplete",
"not_on_api",
"no_benchmark"
],
"type": "string"
},
"net_return_withheld": {
"enum": [
"market_data_licence",
"trade_floor",
"trial_count_incomplete",
"not_on_api",
"no_benchmark"
],
"type": "string"
},
"max_drawdown_withheld": {
"enum": [
"market_data_licence",
"trade_floor",
"trial_count_incomplete",
"not_on_api",
"no_benchmark"
],
"type": "string"
},
"profit_factor_withheld": {
"enum": [
"market_data_licence",
"trade_floor",
"trial_count_incomplete",
"not_on_api",
"no_benchmark"
],
"type": "string"
},
"trades_per_year_withheld": {
"enum": [
"market_data_licence",
"trade_floor",
"trial_count_incomplete",
"not_on_api",
"no_benchmark"
],
"type": "string"
},
"annualized_return_withheld": {
"enum": [
"market_data_licence",
"trade_floor",
"trial_count_incomplete",
"not_on_api",
"no_benchmark"
],
"type": "string"
}
},
"additionalProperties": false
},
"notices": {
"type": "array",
"items": {
"type": "object",
"required": [
"kind",
"field",
"text"
],
"properties": {
"kind": {
"enum": [
"withheld",
"cut"
],
"type": "string"
},
"text": {
"type": "string"
},
"field": {
"type": "string"
},
"total": {
"type": "integer"
},
"reason": {
"enum": [
"market_data_licence",
"trade_floor",
"trial_count_incomplete",
"not_on_api",
"no_benchmark"
],
"type": "string"
},
"returned": {
"type": "integer"
},
"default_limit": {
"type": "integer"
}
},
"additionalProperties": false
}
},
"version": {
"type": "integer"
},
"headline": {
"type": "string"
},
"held_out": {
"type": [
"object",
"null"
],
"required": [
"counts"
],
"properties": {
"counts": {
"type": "boolean"
},
"covered_by": {
"type": "array",
"items": {
"type": "object",
"required": [
"made_in",
"version",
"window"
],
"properties": {
"run_id": {
"type": "string"
},
"window": {
"type": "object",
"required": [
"from",
"to"
],
"properties": {
"to": {
"type": "string"
},
"from": {
"type": "string"
}
},
"additionalProperties": false
},
"made_in": {
"enum": [
"api",
"app"
],
"type": "string"
},
"version": {
"type": "integer"
},
"study_id": {
"type": "string"
}
},
"additionalProperties": false
}
},
"tested_run": {
"type": "object",
"required": [
"run_id"
],
"properties": {
"run_id": {
"type": "string"
},
"version": {
"type": "integer"
}
},
"additionalProperties": false
},
"covered_by_total": {
"type": "integer"
}
},
"additionalProperties": false
},
"hold_out": {
"type": [
"object",
"null"
],
"required": [
"from"
],
"properties": {
"to": {
"type": "string"
},
"from": {
"type": "string"
}
},
"additionalProperties": false
},
"settings": {
"type": "object",
"required": [
"account_usd",
"window"
],
"properties": {
"window": {
"type": "object",
"required": [
"value",
"origin"
],
"properties": {
"value": {},
"origin": {
"type": [
"string",
"null"
]
}
},
"additionalProperties": false
},
"slippage": {
"type": "object",
"required": [
"value",
"origin"
],
"properties": {
"value": {},
"origin": {
"type": [
"string",
"null"
]
}
},
"additionalProperties": false
},
"commission": {
"type": "object",
"required": [
"value",
"origin"
],
"properties": {
"value": {},
"origin": {
"type": [
"string",
"null"
]
}
},
"additionalProperties": false
},
"account_usd": {
"type": "object",
"required": [
"value",
"origin"
],
"properties": {
"value": {},
"origin": {
"type": [
"string",
"null"
]
}
},
"additionalProperties": false
},
"costs_charged": {
"type": "object",
"required": [
"value",
"origin"
],
"properties": {
"note": {
"type": "string"
},
"value": {
"type": "array",
"items": {
"type": "object",
"required": [
"side",
"amount",
"unit",
"basis"
],
"properties": {
"side": {
"enum": [
"commission",
"slippage",
"spread"
],
"type": "string"
},
"unit": {
"enum": [
"percent",
"bps",
"usd_per_share",
"usd_per_ounce",
"pips",
"usd_per_order",
"usd_per_lot"
],
"type": "string"
},
"basis": {
"enum": [
"per_side",
"round_trip"
],
"type": "string"
},
"amount": {
"type": "number"
},
"lot_ounces": {
"type": "number"
}
},
"additionalProperties": false
}
},
"origin": {
"type": [
"string",
"null"
]
}
},
"description": "Every cost the run charged, in its own unit and basis. When `costs` was a list, this is the list; `commission` and `slippage` then appear only for a side the list left out (the market's default, as a fraction of the trade value). `note` says where a cost changed basis when charged.",
"additionalProperties": false
}
},
"additionalProperties": false
},
"study_id": {
"type": "string"
},
"warnings": {
"type": "array",
"items": {
"type": "string"
},
"maxItems": 2
},
"retryable": {
"type": "boolean"
},
"cost_table": {
"type": "object",
"required": [
"components",
"defaults_replaced",
"round_trip_total"
],
"properties": {
"components": {
"type": "array",
"items": {
"type": "object",
"required": [
"component",
"amount",
"unit",
"basis",
"per_round_trip",
"charged",
"origin"
],
"properties": {
"unit": {
"enum": [
"percent",
"bps",
"usd_per_share",
"usd_per_ounce",
"pips",
"usd_per_order",
"usd_per_lot"
],
"type": "string"
},
"basis": {
"enum": [
"per_side",
"round_trip"
],
"type": "string"
},
"amount": {
"type": "number"
},
"origin": {
"type": [
"string",
"null"
],
"description": "caller: your costs; default: the market's default."
},
"charged": {
"type": "string",
"description": "When and on what the engine takes it."
},
"component": {
"enum": [
"commission",
"slippage",
"spread"
],
"type": "string"
},
"per_round_trip": {
"type": "object",
"required": [
"amount",
"unit"
],
"properties": {
"unit": {
"enum": [
"bps",
"pips",
"usd",
"usd_per_share",
"usd_per_ounce"
],
"type": "string"
},
"amount": {
"type": "number"
}
},
"additionalProperties": false
}
},
"additionalProperties": false
}
},
"round_trip_total": {
"type": "object",
"required": [
"bps_of_value"
],
"properties": {
"usd": {
"type": "number"
},
"pips": {
"type": "number"
},
"bps_of_value": {
"type": "number"
},
"usd_per_ounce": {
"type": "number"
},
"usd_per_share": {
"type": "number"
}
},
"additionalProperties": false
},
"defaults_replaced": {
"type": "array",
"items": {
"enum": [
"commission",
"slippage"
],
"type": "string"
},
"description": "The market defaults your costs replaced: none of them was charged, and nothing was added to your costs."
}
},
"description": "Every cost the run charged: each component (commission, slippage, spread) with its amount, unit and basis, what it comes to per round trip, when it is taken, and whether it is yours (caller) or the market's default; the round trip summed by unit (pips on a currency pair, the costs stated in pips). Costs you send replace the market's defaults side by side: a commission replaces the default commission, a slippage or a spread replaces the default slippage, a side you leave out is charged at the market's default, and nothing is added on top.",
"additionalProperties": false
},
"disclaimer": {
"type": "string",
"description": "The hypothetical-performance line, on a result (a run, or a study's runs): the same text the app shows with every result."
},
"look_ahead": {
"enum": [
"leak",
"possible",
"clean",
null
],
"type": [
"string",
"null"
]
},
"trade_list": {
"type": "object",
"required": [
"total",
"trades"
],
"properties": {
"next": {
"type": [
"object",
"null"
],
"required": [
"tool",
"arguments",
"why"
],
"properties": {
"why": {
"type": "string"
},
"tool": {
"enum": [
"run_backtest",
"get_result"
],
"type": "string"
},
"arguments": {
"type": "object"
},
"after_seconds": {
"type": "integer"
}
},
"additionalProperties": false
},
"page": {
"type": "integer"
},
"clock": {
"enum": [
"ET",
"CT",
"UTC"
],
"type": "string",
"description": "The clock the times are on; there when the bars are shorter than a day (a daily run gives days)."
},
"pages": {
"type": "integer"
},
"total": {
"type": "integer"
},
"trades": {
"type": "array",
"items": {
"type": "object",
"required": [
"entry",
"exit",
"side",
"outcome"
],
"properties": {
"exit": {
"type": "string"
},
"side": {
"enum": [
"long",
"short"
],
"type": "string"
},
"entry": {
"type": "string"
},
"outcome": {
"enum": [
"win",
"loss",
"flat",
null
],
"type": [
"string",
"null"
]
},
"exit_type": {
"enum": [
"stop",
"target",
"trailing stop",
"time limit",
"exit rule",
"end of data",
null
],
"type": [
"string",
"null"
],
"description": "Which exit ended the trade (never a price or level). There on a list kept with exit types."
}
},
"additionalProperties": false
},
"maxItems": 100
},
"message": {
"type": "string"
},
"outcome_withheld": {
"enum": [
"trade_floor"
],
"type": "string",
"description": "There when every outcome is null: a run of fewer trades than the floor gives no win or loss, as it gives no win rate."
}
},
"description": "The run's trades in the order they were made, a page at a time: when each entered and left (a day on daily bars; a time on the `clock` on shorter ones; \"open at the end\" for a trade still open when the data ended), its side, whether it won or lost after costs, and which exit ended it (a word: stop, exit rule, target, time limit…). No prices, levels, sizes or returns.",
"additionalProperties": false
},
"buy_and_hold": {
"type": "object",
"required": [
"beat",
"return",
"return_withheld"
],
"properties": {
"beat": {
"type": [
"boolean",
"null"
]
},
"return": {
"type": "null"
},
"beat_withheld": {
"enum": [
"market_data_licence",
"trade_floor",
"trial_count_incomplete",
"not_on_api",
"no_benchmark"
],
"type": "string"
},
"return_withheld": {
"enum": [
"market_data_licence",
"not_on_api"
],
"type": "string"
}
},
"additionalProperties": false
},
"replayed_from": {
"type": "string"
},
"grade_withheld": {
"enum": [
"trial_count_incomplete",
"trade_floor",
null
],
"type": [
"string",
"null"
]
},
"runs_left_today": {
"type": "object",
"required": [
"symbol",
"left",
"per_day"
],
"properties": {
"left": {
"type": "integer"
},
"symbol": {
"type": "string"
},
"per_day": {
"type": "integer"
}
},
"additionalProperties": false
},
"hold_out_estimate": {
"type": "object",
"required": [
"expected_trades",
"trade_floor",
"years"
],
"properties": {
"years": {
"type": "number"
},
"trade_floor": {
"type": "integer"
},
"expected_trades": {
"type": "integer"
}
},
"additionalProperties": false
},
"poll_after_seconds": {
"type": "integer"
},
"stated_rule_breaks": {
"type": "array",
"items": {
"type": "object",
"required": [
"rule",
"name",
"count",
"of"
],
"properties": {
"of": {
"type": "integer"
},
"name": {
"type": "string"
},
"rule": {
"type": "string"
},
"count": {
"type": "integer"
}
},
"additionalProperties": false
}
},
"highest_simulated_value": {
"type": [
"object",
"null"
],
"required": [
"version",
"run_id",
"net_return",
"compared_runs",
"withheld_runs"
],
"properties": {
"run_id": {
"type": "string"
},
"version": {
"type": "integer"
},
"net_return": {
"type": "number"
},
"compared_runs": {
"type": "integer"
},
"withheld_runs": {
"type": "integer"
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
"annotations": {
"readOnlyHint": true,
"openWorldHint": false
}
}The final out-of-sample check: runs a finished run's exact code once over its study's hold-out period. Call it at the end, on the run you would keep: the first held-out test per account and market is the one that counts, and a hold-out with too few trades for figures (a result needs 10) spends it all the same: each development run says how many trades the hold-out is expected to hold, in `hold_out_estimate`.
| Parameter | Type | Description |
|---|---|---|
| run_id * | string | A run of a study with a hold-out, which ran. |
{
"name": "run_held_out_test",
"title": "Test on the hold-out",
"description": "The final out-of-sample check: runs a finished run's exact code once over its study's hold-out period. Call it at the end, on the run you would keep: the first held-out test per account and market is the one that counts, and a hold-out with too few trades for figures (a result needs 10) spends it all the same: each development run says how many trades the hold-out is expected to hold, in `hold_out_estimate`.",
"inputSchema": {
"type": "object",
"required": [
"run_id"
],
"properties": {
"run_id": {
"type": "string",
"description": "A run of a study with a hold-out, which ran."
}
},
"additionalProperties": false
},
"outputSchema": {
"type": "object",
"required": [
"status"
],
"properties": {
"next": {
"type": [
"object",
"null"
],
"required": [
"tool",
"arguments",
"why"
],
"properties": {
"why": {
"type": "string"
},
"tool": {
"enum": [
"run_backtest",
"get_result"
],
"type": "string"
},
"arguments": {
"type": "object"
},
"after_seconds": {
"type": "integer"
}
},
"additionalProperties": false
},
"basis": {
"type": "object",
"required": [],
"properties": {
"sharpe": {
"type": "string"
},
"exposure": {
"type": "string"
},
"net_return": {
"type": "string"
},
"max_drawdown": {
"type": "string"
},
"profit_factor": {
"type": "string"
},
"deflated_sharpe": {
"type": "string"
}
},
"additionalProperties": false
},
"grade": {
"type": [
"object",
"null"
],
"required": [
"grade",
"score",
"trials",
"deflated_sharpe"
],
"properties": {
"grade": {
"type": [
"string",
"null"
]
},
"score": {
"type": [
"number",
"null"
]
},
"search": {
"type": "object",
"required": [
"market",
"runs",
"evaluations_without_a_run",
"discarded_candidates",
"distinct_setting"
],
"properties": {
"runs": {
"type": "object",
"required": [
"in_study",
"counted"
],
"properties": {
"counted": {
"type": "integer"
},
"in_study": {
"type": "integer"
},
"code_draws": {
"type": "integer"
},
"markets_in_study": {
"type": "integer"
},
"settings_30_days": {
"type": "integer"
},
"left_out_no_trades": {
"type": "integer"
}
},
"additionalProperties": false
},
"market": {
"type": "string"
},
"distinct_setting": {
"type": "string"
},
"independent_tries": {
"type": "object",
"required": [
"settings",
"evaluations"
],
"properties": {
"settings": {
"type": "number"
},
"evaluations": {
"type": "number"
}
},
"additionalProperties": false
},
"discarded_candidates": {
"type": "integer"
},
"evaluations_without_a_run": {
"type": "object",
"required": [
"sweep_cells",
"sensitivity_variants",
"walk_forward_evaluations"
],
"properties": {
"sweep_cells": {
"type": "integer"
},
"sensitivity_variants": {
"type": "integer"
},
"walk_forward_evaluations": {
"type": "integer"
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
"trials": {
"type": "number"
},
"deflated_sharpe": {
"type": [
"number",
"null"
]
}
},
"additionalProperties": false
},
"lines": {
"type": "array",
"items": {
"type": "string"
}
},
"market": {
"type": "object",
"required": [
"symbol",
"timeframe",
"from",
"to",
"bars",
"source",
"derived_only"
],
"properties": {
"to": {
"type": "string"
},
"bars": {
"type": "integer"
},
"from": {
"type": "string"
},
"source": {
"type": "string"
},
"symbol": {
"type": "string"
},
"timeframe": {
"type": "string"
},
"derived_only": {
"type": "boolean",
"description": "True when the market-data licence lets the account see only results derived from the prices (figures, never the prices or bars themselves). It says what may be shown, not how the quote is made."
}
},
"additionalProperties": false
},
"reason": {
"type": "string"
},
"run_id": {
"type": "string"
},
"status": {
"enum": [
"ran",
"running",
"refused",
"rejected",
"error",
"held",
"invalid_arguments",
"not_found"
],
"type": "string"
},
"window": {
"type": "object",
"required": [
"asked",
"run",
"standard",
"longest",
"start_later",
"end_at_hold_out"
],
"properties": {
"run": {
"type": "object",
"required": [
"from",
"to"
],
"properties": {
"to": {
"type": "string"
},
"from": {
"type": "string"
}
},
"additionalProperties": false
},
"gaps": {
"type": "array",
"items": {
"type": "object",
"required": [
"from",
"to"
],
"properties": {
"to": {
"type": "string"
},
"from": {
"type": "string"
}
},
"additionalProperties": false
}
},
"asked": {
"type": [
"object",
"null"
]
},
"warmup": {
"type": "object",
"required": [
"bars"
],
"properties": {
"to": {
"type": "string"
},
"bars": {
"type": "integer"
},
"from": {
"type": "string"
}
},
"additionalProperties": false
},
"longest": {
"type": "object",
"required": [
"all_daily_history"
],
"properties": {
"from": {
"type": "string"
},
"note": {
"type": "string"
},
"most_bars": {
"type": "integer"
},
"all_daily_history": {
"type": "boolean"
}
},
"additionalProperties": false
},
"standard": {
"type": [
"object",
"null"
],
"required": [
"bars"
],
"properties": {
"bars": {
"type": "integer"
}
},
"additionalProperties": false
},
"start_later": {
"type": [
"object",
"null"
],
"required": [
"reason",
"first_bar",
"bars_fetched"
],
"properties": {
"reason": {
"enum": [
"history_starts",
"bars_fetched"
],
"type": "string"
},
"first_bar": {
"type": "string"
},
"bars_fetched": {
"type": "integer"
}
},
"additionalProperties": false
},
"end_at_hold_out": {
"type": [
"string",
"null"
]
}
},
"additionalProperties": false
},
"message": {
"type": "string"
},
"metrics": {
"type": "object",
"required": [
"trades",
"net_return",
"max_drawdown",
"annualized_return",
"win_rate",
"sharpe",
"profit_factor",
"exposure",
"trades_per_year"
],
"properties": {
"sharpe": {
"type": [
"number",
"null"
]
},
"trades": {
"type": [
"integer",
"null"
]
},
"exposure": {
"type": [
"number",
"null"
]
},
"win_rate": {
"type": [
"number",
"null"
]
},
"net_return": {
"type": [
"number",
"null"
]
},
"max_drawdown": {
"type": [
"number",
"null"
]
},
"profit_factor": {
"type": [
"number",
"null"
]
},
"sharpe_withheld": {
"enum": [
"market_data_licence",
"trade_floor",
"trial_count_incomplete",
"not_on_api",
"no_benchmark"
],
"type": "string"
},
"trades_per_year": {
"type": [
"number",
"null"
]
},
"trades_withheld": {
"enum": [
"market_data_licence",
"trade_floor",
"trial_count_incomplete",
"not_on_api",
"no_benchmark"
],
"type": "string"
},
"annualized_return": {
"type": [
"number",
"null"
]
},
"exposure_withheld": {
"enum": [
"market_data_licence",
"trade_floor",
"trial_count_incomplete",
"not_on_api",
"no_benchmark"
],
"type": "string"
},
"win_rate_withheld": {
"enum": [
"market_data_licence",
"trade_floor",
"trial_count_incomplete",
"not_on_api",
"no_benchmark"
],
"type": "string"
},
"net_return_withheld": {
"enum": [
"market_data_licence",
"trade_floor",
"trial_count_incomplete",
"not_on_api",
"no_benchmark"
],
"type": "string"
},
"max_drawdown_withheld": {
"enum": [
"market_data_licence",
"trade_floor",
"trial_count_incomplete",
"not_on_api",
"no_benchmark"
],
"type": "string"
},
"profit_factor_withheld": {
"enum": [
"market_data_licence",
"trade_floor",
"trial_count_incomplete",
"not_on_api",
"no_benchmark"
],
"type": "string"
},
"trades_per_year_withheld": {
"enum": [
"market_data_licence",
"trade_floor",
"trial_count_incomplete",
"not_on_api",
"no_benchmark"
],
"type": "string"
},
"annualized_return_withheld": {
"enum": [
"market_data_licence",
"trade_floor",
"trial_count_incomplete",
"not_on_api",
"no_benchmark"
],
"type": "string"
}
},
"additionalProperties": false
},
"notices": {
"type": "array",
"items": {
"type": "object",
"required": [
"kind",
"field",
"text"
],
"properties": {
"kind": {
"enum": [
"withheld",
"cut"
],
"type": "string"
},
"text": {
"type": "string"
},
"field": {
"type": "string"
},
"total": {
"type": "integer"
},
"reason": {
"enum": [
"market_data_licence",
"trade_floor",
"trial_count_incomplete",
"not_on_api",
"no_benchmark"
],
"type": "string"
},
"returned": {
"type": "integer"
},
"default_limit": {
"type": "integer"
}
},
"additionalProperties": false
}
},
"version": {
"type": "integer"
},
"headline": {
"type": "string"
},
"held_out": {
"type": [
"object",
"null"
],
"required": [
"counts"
],
"properties": {
"counts": {
"type": "boolean"
},
"covered_by": {
"type": "array",
"items": {
"type": "object",
"required": [
"made_in",
"version",
"window"
],
"properties": {
"run_id": {
"type": "string"
},
"window": {
"type": "object",
"required": [
"from",
"to"
],
"properties": {
"to": {
"type": "string"
},
"from": {
"type": "string"
}
},
"additionalProperties": false
},
"made_in": {
"enum": [
"api",
"app"
],
"type": "string"
},
"version": {
"type": "integer"
},
"study_id": {
"type": "string"
}
},
"additionalProperties": false
}
},
"tested_run": {
"type": "object",
"required": [
"run_id"
],
"properties": {
"run_id": {
"type": "string"
},
"version": {
"type": "integer"
}
},
"additionalProperties": false
},
"covered_by_total": {
"type": "integer"
}
},
"additionalProperties": false
},
"settings": {
"type": "object",
"required": [
"account_usd",
"window"
],
"properties": {
"window": {
"type": "object",
"required": [
"value",
"origin"
],
"properties": {
"value": {},
"origin": {
"type": [
"string",
"null"
]
}
},
"additionalProperties": false
},
"slippage": {
"type": "object",
"required": [
"value",
"origin"
],
"properties": {
"value": {},
"origin": {
"type": [
"string",
"null"
]
}
},
"additionalProperties": false
},
"commission": {
"type": "object",
"required": [
"value",
"origin"
],
"properties": {
"value": {},
"origin": {
"type": [
"string",
"null"
]
}
},
"additionalProperties": false
},
"account_usd": {
"type": "object",
"required": [
"value",
"origin"
],
"properties": {
"value": {},
"origin": {
"type": [
"string",
"null"
]
}
},
"additionalProperties": false
},
"costs_charged": {
"type": "object",
"required": [
"value",
"origin"
],
"properties": {
"note": {
"type": "string"
},
"value": {
"type": "array",
"items": {
"type": "object",
"required": [
"side",
"amount",
"unit",
"basis"
],
"properties": {
"side": {
"enum": [
"commission",
"slippage",
"spread"
],
"type": "string"
},
"unit": {
"enum": [
"percent",
"bps",
"usd_per_share",
"usd_per_ounce",
"pips",
"usd_per_order",
"usd_per_lot"
],
"type": "string"
},
"basis": {
"enum": [
"per_side",
"round_trip"
],
"type": "string"
},
"amount": {
"type": "number"
},
"lot_ounces": {
"type": "number"
}
},
"additionalProperties": false
}
},
"origin": {
"type": [
"string",
"null"
]
}
},
"description": "Every cost the run charged, in its own unit and basis. When `costs` was a list, this is the list; `commission` and `slippage` then appear only for a side the list left out (the market's default, as a fraction of the trade value). `note` says where a cost changed basis when charged.",
"additionalProperties": false
}
},
"additionalProperties": false
},
"study_id": {
"type": "string"
},
"warnings": {
"type": "array",
"items": {
"type": "string"
},
"maxItems": 2
},
"retryable": {
"type": "boolean"
},
"cost_table": {
"type": "object",
"required": [
"components",
"defaults_replaced",
"round_trip_total"
],
"properties": {
"components": {
"type": "array",
"items": {
"type": "object",
"required": [
"component",
"amount",
"unit",
"basis",
"per_round_trip",
"charged",
"origin"
],
"properties": {
"unit": {
"enum": [
"percent",
"bps",
"usd_per_share",
"usd_per_ounce",
"pips",
"usd_per_order",
"usd_per_lot"
],
"type": "string"
},
"basis": {
"enum": [
"per_side",
"round_trip"
],
"type": "string"
},
"amount": {
"type": "number"
},
"origin": {
"type": [
"string",
"null"
],
"description": "caller: your costs; default: the market's default."
},
"charged": {
"type": "string",
"description": "When and on what the engine takes it."
},
"component": {
"enum": [
"commission",
"slippage",
"spread"
],
"type": "string"
},
"per_round_trip": {
"type": "object",
"required": [
"amount",
"unit"
],
"properties": {
"unit": {
"enum": [
"bps",
"pips",
"usd",
"usd_per_share",
"usd_per_ounce"
],
"type": "string"
},
"amount": {
"type": "number"
}
},
"additionalProperties": false
}
},
"additionalProperties": false
}
},
"round_trip_total": {
"type": "object",
"required": [
"bps_of_value"
],
"properties": {
"usd": {
"type": "number"
},
"pips": {
"type": "number"
},
"bps_of_value": {
"type": "number"
},
"usd_per_ounce": {
"type": "number"
},
"usd_per_share": {
"type": "number"
}
},
"additionalProperties": false
},
"defaults_replaced": {
"type": "array",
"items": {
"enum": [
"commission",
"slippage"
],
"type": "string"
},
"description": "The market defaults your costs replaced: none of them was charged, and nothing was added to your costs."
}
},
"description": "Every cost the run charged: each component (commission, slippage, spread) with its amount, unit and basis, what it comes to per round trip, when it is taken, and whether it is yours (caller) or the market's default; the round trip summed by unit (pips on a currency pair, the costs stated in pips). Costs you send replace the market's defaults side by side: a commission replaces the default commission, a slippage or a spread replaces the default slippage, a side you leave out is charged at the market's default, and nothing is added on top.",
"additionalProperties": false
},
"disclaimer": {
"type": "string",
"description": "The hypothetical-performance line, on a result (a run, or a study's runs): the same text the app shows with every result."
},
"look_ahead": {
"enum": [
"leak",
"possible",
"clean",
null
],
"type": [
"string",
"null"
]
},
"trade_list": {
"type": "object",
"required": [
"total",
"trades"
],
"properties": {
"next": {
"type": [
"object",
"null"
],
"required": [
"tool",
"arguments",
"why"
],
"properties": {
"why": {
"type": "string"
},
"tool": {
"enum": [
"run_backtest",
"get_result"
],
"type": "string"
},
"arguments": {
"type": "object"
},
"after_seconds": {
"type": "integer"
}
},
"additionalProperties": false
},
"page": {
"type": "integer"
},
"clock": {
"enum": [
"ET",
"CT",
"UTC"
],
"type": "string",
"description": "The clock the times are on; there when the bars are shorter than a day (a daily run gives days)."
},
"pages": {
"type": "integer"
},
"total": {
"type": "integer"
},
"trades": {
"type": "array",
"items": {
"type": "object",
"required": [
"entry",
"exit",
"side",
"outcome"
],
"properties": {
"exit": {
"type": "string"
},
"side": {
"enum": [
"long",
"short"
],
"type": "string"
},
"entry": {
"type": "string"
},
"outcome": {
"enum": [
"win",
"loss",
"flat",
null
],
"type": [
"string",
"null"
]
},
"exit_type": {
"enum": [
"stop",
"target",
"trailing stop",
"time limit",
"exit rule",
"end of data",
null
],
"type": [
"string",
"null"
],
"description": "Which exit ended the trade (never a price or level). There on a list kept with exit types."
}
},
"additionalProperties": false
},
"maxItems": 100
},
"message": {
"type": "string"
},
"outcome_withheld": {
"enum": [
"trade_floor"
],
"type": "string",
"description": "There when every outcome is null: a run of fewer trades than the floor gives no win or loss, as it gives no win rate."
}
},
"description": "The run's trades in the order they were made, a page at a time: when each entered and left (a day on daily bars; a time on the `clock` on shorter ones; \"open at the end\" for a trade still open when the data ended), its side, whether it won or lost after costs, and which exit ended it (a word: stop, exit rule, target, time limit…). No prices, levels, sizes or returns.",
"additionalProperties": false
},
"buy_and_hold": {
"type": "object",
"required": [
"beat",
"return",
"return_withheld"
],
"properties": {
"beat": {
"type": [
"boolean",
"null"
]
},
"return": {
"type": "null"
},
"beat_withheld": {
"enum": [
"market_data_licence",
"trade_floor",
"trial_count_incomplete",
"not_on_api",
"no_benchmark"
],
"type": "string"
},
"return_withheld": {
"enum": [
"market_data_licence",
"not_on_api"
],
"type": "string"
}
},
"additionalProperties": false
},
"replayed_from": {
"type": "string"
},
"grade_withheld": {
"enum": [
"trial_count_incomplete",
"trade_floor",
null
],
"type": [
"string",
"null"
]
},
"runs_left_today": {
"type": "object",
"required": [
"symbol",
"left",
"per_day"
],
"properties": {
"left": {
"type": "integer"
},
"symbol": {
"type": "string"
},
"per_day": {
"type": "integer"
}
},
"additionalProperties": false
},
"hold_out_estimate": {
"type": "object",
"required": [
"expected_trades",
"trade_floor",
"years"
],
"properties": {
"years": {
"type": "number"
},
"trade_floor": {
"type": "integer"
},
"expected_trades": {
"type": "integer"
}
},
"additionalProperties": false
},
"poll_after_seconds": {
"type": "integer"
},
"stated_rule_breaks": {
"type": "array",
"items": {
"type": "object",
"required": [
"rule",
"name",
"count",
"of"
],
"properties": {
"of": {
"type": "integer"
},
"name": {
"type": "string"
},
"rule": {
"type": "string"
},
"count": {
"type": "integer"
}
},
"additionalProperties": false
}
}
},
"additionalProperties": false
},
"annotations": {
"readOnlyHint": false,
"openWorldHint": false,
"idempotentHint": false,
"destructiveHint": false
}
}Checks a trader's own trades against a run's rule, on the price history this server holds: for each trade, in their order, whether the rule would have taken it and, if not, why (already in a trade, no entry signal that day, no bar that day). Use it when the trader lists trades they made and asks which the rule took. Takes a run (run_id) and the trades, each {side, entry, exit?}; answers in words, never prices. It re-runs the run's code, so it counts as a run on the run's symbol.
| Parameter | Type | Description |
|---|---|---|
| run_id | string | A run_id run_backtest or run_held_out_test returned: the run whose code is checked against the trades. |
| trades * | array | The trader's own trades, in their order, each stamp exactly as the trader wrote it. |
| version | any | |
| study_id | string | A study's id; with `version`, one of its runs. |
| time_zone | string | The clock the trader says their times are on ("UTC+2", "New York", "Europe/Prague"). Left out: the clock the run's trade list is on (ET for stocks and ETFs, UTC otherwise). |
{
"name": "compare_trades",
"title": "Check my own trades",
"description": "Checks a trader's own trades against a run's rule, on the price history this server holds: for each trade, in their order, whether the rule would have taken it and, if not, why (already in a trade, no entry signal that day, no bar that day). Use it when the trader lists trades they made and asks which the rule took. Takes a run (run_id) and the trades, each {side, entry, exit?}; answers in words, never prices. It re-runs the run's code, so it counts as a run on the run's symbol.",
"inputSchema": {
"type": "object",
"required": [
"trades"
],
"properties": {
"run_id": {
"type": "string",
"description": "A run_id run_backtest or run_held_out_test returned: the run whose code is checked against the trades."
},
"trades": {
"type": "array",
"items": {
"type": "object",
"required": [
"side",
"entry"
],
"properties": {
"exit": {
"type": "string",
"description": "When they exited, the same way. Left out when they gave none."
},
"side": {
"enum": [
"long",
"short"
],
"type": "string"
},
"entry": {
"type": "string",
"description": "When they entered: \"YYYY-MM-DD\", or \"YYYY-MM-DD HH:MM\" on the clock they wrote."
}
},
"additionalProperties": false
},
"maxItems": 50,
"minItems": 1,
"description": "The trader's own trades, in their order, each stamp exactly as the trader wrote it."
},
"version": {
"anyOf": [
{
"type": "integer",
"minimum": 1
},
{
"type": "string",
"pattern": "^[vV]?\\d+$"
}
]
},
"study_id": {
"type": "string",
"description": "A study's id; with `version`, one of its runs."
},
"time_zone": {
"type": "string",
"description": "The clock the trader says their times are on (\"UTC+2\", \"New York\", \"Europe/Prague\"). Left out: the clock the run's trade list is on (ET for stocks and ETFs, UTC otherwise)."
}
},
"additionalProperties": false
},
"outputSchema": {
"type": "object",
"required": [
"status"
],
"properties": {
"note": {
"type": "string"
},
"clock": {
"type": "string",
"description": "On bars shorter than a day: the clock every time of the answer is on (your time_zone as you stated it, else ET for stocks and ETFs, UTC otherwise)."
},
"counts": {
"type": "object",
"required": [
"taken",
"not_taken",
"not_compared"
],
"properties": {
"taken": {
"type": "integer"
},
"not_taken": {
"type": "integer"
},
"not_compared": {
"type": "integer"
}
},
"additionalProperties": false
},
"market": {
"type": "object",
"required": [
"symbol",
"timeframe"
],
"properties": {
"symbol": {
"type": "string"
},
"timeframe": {
"type": "string"
}
},
"additionalProperties": false
},
"reason": {
"type": "string"
},
"run_id": {
"type": "string"
},
"status": {
"enum": [
"compared",
"invalid_arguments",
"not_found",
"refused",
"error"
],
"type": "string"
},
"trades": {
"type": "array",
"items": {
"type": "object",
"required": [
"n",
"trade",
"rule",
"reason",
"answer",
"why"
],
"properties": {
"n": {
"type": "integer"
},
"why": {
"type": "string"
},
"rule": {
"enum": [
"taken",
"not taken",
"not compared"
],
"type": "string"
},
"trade": {
"type": "string"
},
"answer": {
"type": "string"
},
"reason": {
"type": "string",
"description": "The code for why: taken, in_trade, exit_unknown, no_bar, side_never, flat, outside_bars, other_symbol or no_time."
}
},
"additionalProperties": false
}
},
"message": {
"type": "string"
},
"summary": {
"type": "string"
},
"version": {
"type": "integer"
},
"study_id": {
"type": "string"
},
"runs_left_today": {
"type": "object",
"required": [
"symbol",
"left",
"per_day"
],
"properties": {
"left": {
"type": "integer"
},
"symbol": {
"type": "string"
},
"per_day": {
"type": "integer"
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
"annotations": {
"readOnlyHint": false,
"openWorldHint": false,
"idempotentHint": false,
"destructiveHint": false
}
}Backtests a trading rule or strategy on historical prices: US stocks and ETFs, FX, spot gold and silver, and spot crypto. The server holds the price history and runs the backtest on it. Flow: describe_data, create_study, run_backtest, get_result; run_held_out_test once, at the end. You write the strategy as one backtesting.py Strategy class; the server runs it in a sandbox and returns summary figures and the run's trades (when each entered and left, which exit ended it, its side, win or loss), never prices or bars. describe_data lists the markets, bar sizes, default costs and rules, and how to write the code. create_study can set a hold-out period that only run_held_out_test uses: set it in your first study on a market, before any run on it, as a held-out test on days an earlier run read does not count. run_backtest takes one symbol and one bar size per run; it waits up to 90 s, then answers "running" with a run_id for get_result. Run the held-out test once, on the run you would keep: only the first per account and market counts, and a hold-out with too few trades for a result to show figures spends it all the same (each development run says how many it is expected to hold: hold_out_estimate). To check which of a trader's own trades a run's rule would have taken, and why not, use compare_trades with the run and their trades. Limits: results are summary figures and a trade list (no prices, bars or charts); a run reads one symbol; a day takes at most 40 runs per symbol and 150 runs and 50 studies in all (the count resets at 00:00 UTC).
Names, descriptions and schemas were written by the server and are shown as data.
Shared addresses on big platforms (Cloudflare, Vercel and the like) put unrelated servers together; those are marked shared_infrastructure. A match is a pivot, not a link between operators.