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=7d&limit=5 \
-H "Authorization: Bearer ta_live_xxxxxxxx"No account yet? Use the public demo key β literally the word demo. It works on every endpoint at free-tier limits (fundamentals: 37 flagship tickers across all seven markets at full fidelity; signals: 90-day-delayed view). Zero signup, zero card.
GET /api/v1/fundamentals
Point-in-time company fundamentals from official regulator filings β over 2.2 million companies, most of them PRIVATE: France (INPI), Belgium (NBB), New Zealand's Charities Register, plus listed issuers from US SEC EDGAR (annual + quarterly), Taiwan TWSE and Korea OpenDART. Denmark is loading. Every figure is as first reported, keyed by its filing date: query with as_of and you see only what was public that day. Pricing and licences: /fundamentals.
# works right now β public demo key, no signup
curl "https://www.tradingagentapp.com/api/v1/fundamentals?ticker=2330.TW" \
-H "Authorization: Bearer demo"
# the as-of snapshot a backtest at 2022-01-01 was allowed to see
curl "https://www.tradingagentapp.com/api/v1/fundamentals?ticker=AAPL&as_of=2022-01-01&view=latest" \
-H "Authorization: Bearer demo"| ticker | AAPL, 2330.TW, 005930.KS β¦ omit for the coverage index (markets, tickers, manifests). |
| as_of | ISO date β point-in-time cutoff: only rows with filed <= as_of. Default today. |
| view | history (default) or latest (one row per metric: the as-of snapshot). |
| metric | comma list (revenue, net_income, roe, β¦). Omit for all. |
| from | period-end lower bound (ISO date). |
| market | US, TW, KR β optional filter. |
| format | json (default) or csv. |
Row fields: m metric Β· fy/fp fiscal year/period (FY, Q1βQ4) Β· end period end Β· filed filing date (the PIT key) Β· v/u value/unit. Metrics span raw statement lines (revenue, net_income, assets, equity, eps, β¦) and derived ratios (net_margin, roe, roa, debt_to_equity, β¦). Notes: Taiwan income-statement figures are cumulative year-to-date (Taiwan convention β difference adjacent quarters for single-quarter flows); every response embeds its statutory source attribution.
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: 1d, 3d, or 7d. 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": "7d",
"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": "7d" },
"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 β live today: France (INPI annual accounts via the Ministere de l'Economie β 850,000 companies from 2022 onward, keyed to dateDepot β the register's own record of when the accounts were deposited β with balance sheets; 2017-2021 is still backfilling), Belgium (NBB Balanscentrale β 670,000 companies, full balance sheets, statutory rather than consolidated accounts), New Zealand (Charities Register β registered charities rather than listed issuers, because NZ company financials are not published as open data), US (SEC EDGAR), Taiwan (TWSE) and Korea (FSS OpenDART). Denmark's full register is loading now. Each market's manifest states its own reporting basis, because the same column does not mean the same thing everywhere. 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 β pip install pit-fundamentals
Zero-dependency package (pandas optional) with the demo key built in:
pip install pit-fundamentals
import pit_fundamentals as pf
rows = pf.fundamentals("2330.TW") # works instantly β demo key default
snap = pf.latest("AAPL", as_of="2022-01-01") # the PIT snapshot
panel = pf.signals(market="US", horizon="7d") # scored history (delayed on free)
# paid key: export PIT_FUNDAMENTALS_KEY=ta_live_β¦ (code unchanged)The original single-file SDK also remains: Download tradingagent.py.
from tradingagent import TradingAgent
ta = TradingAgent() # reads TRADING_AGENT_API_KEY
sig = ta.signals(market="TW", horizon="7d", limit=5000)
bt = ta.backtest(
config={"direction": "long_short", "quantile": 0.1, "holdDays": 7},
source={"market": "TW", "horizon": "7d"},
)
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": 7}, source={"market": "US", "horizon": "7d"}, sweep=True)
print(sw["best"]["label"], sw["deflated_sharpe"]["dsr"], sw["deflated_sharpe"]["survives"])Notebooks β runnable on the demo key
Three worked examples, each runnable end-to-end with zero signup (open in Jupyter, VS Code, or Colab):
- The reporting-lag trap β why joining fundamentals on period end (not filing date) silently inflates backtests β measure the lag yourself
- Taiwan fundamentals in 5 minutes β TSMC point-in-time, plus the cumulative-YTD convention every TW quant must know
- Fundamentals meet a scored signal panel β join PIT factors to realised forward returns with zero leakage by construction
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%.