Build on the signal panel
Pull our point-in-time, resolved signal history and run the same costed strategy backtester the Backtest Lab uses β from Python, a notebook, or curl. REST in, JSON out. A zero-dependency Python SDK wraps it.
Authentication
Create a key at /account/api-keys and send it as a bearer token. The signal endpoint accepts any key (non-Quant keys get a 90-day-delayed view); the backtest endpoint requires a Quant key.
curl https://www.tradingagentapp.com/api/v1/signals?market=US&horizon=21d&limit=5 \
-H "Authorization: Bearer ta_live_xxxxxxxx"GET /api/v1/signals
The resolved signal panel β one row per name per date, with the model's forecast and the realised forward return. Resolved/ historical only (a factual track record, safe in every jurisdiction); never forward recommendations.
| market | ISO market code (US, TW, HK, β¦). Omit for all. |
| horizon | forecast horizon (e.g. 7d, 21d, 3mo). Omit for all. |
| from / to | ISO date bounds on the observation date. |
| limit | max rows (β€ 50000, default 5000). |
| format | json (default) or csv. |
{
"object": "signal_list",
"tier": "studio",
"full_access": true,
"delayed_days": 0,
"count": 5000,
"schema": { "predicted_pct": "forward-return forecast (fraction)", "...": "..." },
"data": [
{ "date": "2025-05-20", "ticker": "AAPL", "market": "US", "horizon": "21d",
"predicted_pct": 0.0257, "actual_pct": 0.0154, "status": "won", "source": "live" }
]
}POST /api/v1/backtest
Run a cross-sectional strategy and get a costed result: equity curve, Sharpe/IR, turnover, walk-forward out-of-sample folds β or a parameter sweep with the overfit-corrected Deflated Sharpe. Backtest our archive (source) or your rows (panel). Quant key required.
curl -X POST https://www.tradingagentapp.com/api/v1/backtest \
-H "Authorization: Bearer ta_live_xxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"config": { "direction": "long_short", "quantile": 0.1, "weighting": "equal", "holdDays": 21 },
"source": { "market": "TW", "horizon": "21d" },
"sweep": false
}'| config.direction | long_short | long_only |
| config.quantile | top/bottom fraction per leg (0.01β0.5) |
| config.weighting | equal | score | rank |
| config.holdDays | holding horizon in trading days (1β252) |
| config.costBps | flat round-trip override; omit for per-market real costs |
| config.borrowBps | annual short-borrow cost (bps) |
| source | { market?, horizon?, from?, to?, limit? } β backtest our archive |
| panel | [ { date, asset, market?, score, forward_return } ] β backtest your own |
| sweep | true β grid search + Deflated Sharpe of the winner |
{
"object": "backtest_result",
"n_rows": 8421,
"metrics": {
"cagr": 0.123, "sharpe": 1.42, "lo_sharpe": 1.31, "information_ratio": 0.88,
"max_drawdown": 0.19, "avg_turnover": 0.34, "cost_drag_annual": 0.021,
"oos_sharpe_mean": 0.97
},
"equity_curve": [1, 1.01, 0.99, ...],
"folds": [ { "fold": 0, "sharpe": 1.1, "cagr": 0.14, "...": "..." } ]
}GET /api/v1/fundamentals
Point-in-time company fundamentals from official regulator filings β US live (SEC EDGAR), more markets added as their official source allows (Korea via FSS OpenDART). As-first-reported β every row carries its official filed date, and queries are filtered to filed β€ as_of, so a backtest at date T sees only what was public at T (no restatement look-ahead). Annual raw concepts + derived ratios (net_margin, roe, roa, debt_to_equity, asset_turnoverβ¦). Omit ticker to list available markets + tickers.
| ticker | e.g. AAPL. Omit for the index (markets, tickers, metrics). |
| market | optional filter (US, KR, β¦). |
| as_of | ISO date β return only filings public by then (PIT cutoff). Default today. |
| view | history (default) or latest (as-of snapshot, latest value per metric). |
| metric | comma-separated filter (e.g. revenue,net_margin,roe). |
| from | period-end lower bound. |
| format | json (default) or csv. |
curl "https://www.tradingagentapp.com/api/v1/fundamentals?ticker=AAPL&metric=net_margin,roe&as_of=2022-01-01" \
-H "Authorization: Bearer ta_live_xxxxxxxx"
# β only 10-Ks filed on/before 2022-01-01 (point-in-time)Python SDK
One file, standard library only (pandas optional). Download tradingagent.py.
from tradingagent import TradingAgent
ta = TradingAgent() # reads TRADING_AGENT_API_KEY
sig = ta.signals(market="TW", horizon="21d", limit=5000)
bt = ta.backtest(
config={"direction": "long_short", "quantile": 0.1, "holdDays": 21},
source={"market": "TW", "horizon": "21d"},
)
m = bt["metrics"]
print(f"Sharpe {m['sharpe']:.2f} CAGR {m['cagr']:.1%} maxDD {m['max_drawdown']:.1%}")
# Overfit-corrected sweep
sw = ta.backtest(config={"holdDays": 21}, source={"market": "US", "horizon": "21d"}, sweep=True)
print(sw["best"]["label"], sw["deflated_sharpe"]["dsr"], sw["deflated_sharpe"]["survives"])The API exposes only resolved, historical data and factual statistical analysis of it β not forward recommendations and not investment advice. Backtested results are hypothetical, model the modelled spread + each market's statutory costs, and do not predict future returns. Numbers (predicted_pct, actual_pct,forward_return) are fractions: 0.025 = +2.5%.