backtrade.
Backtrade?

BUILD & RUN

Developer integrations

Native API formats and optional external connections.
Strategy library ↗

← Back to Backtrade

Use an existing broker client

Choose the API format your existing code expects. This does not require an external account for replay.

Manage API keys ↗

Historical replay only. External connections are configured separately under Connect to paper trading.

Connect your strategy

Download the local bridge and verify its checksum.

backtrade-bridge.mjs ↓SHA-256 checksum ↓
node backtrade-bridge.mjs ./backtrade-broker.json
REST
http://127.0.0.1:18900/v2
Streaming
/v2/iex · /stream
Replay controls
/backtrade/advance · /play · /finish

Use the local token from your config for API authentication. Start with DAY market, limit, stop and stop-limit orders. Unsupported options fail explicitly.

Client examples & compatibility ↗
Connect an AI agent to this broker setup

The local broker MCP keeps the same account, position, order and contract tools when you switch from replay to paper. Replay adds clock controls.

codex mcp add backtrade-broker -- node /absolute/path/backtrade-bridge.mjs --mcp /private/path/backtrade-broker.json
claude mcp add backtrade-broker -- node /absolute/path/backtrade-bridge.mjs --mcp /private/path/backtrade-broker.json

Use session_status, resolve_contract, get_account, get_bars, place_order, get_orders and get_positions. Confirm actual fills. For replay, let your harness advance time; paper time moves independently.

Connect your AI client to Backtrade

Connect the Backtrade MCP adapter with your account key, then use this starting instruction.

Use Backtrade. List available SPY ticks days first. Start a Backtrade replay for an available date, data=ticks, purpose=broker_rehearsal, bar_interval=1Min, strategy="My strategy", strategy_version="v1". Return its watch_url. Trade only from available observations, check actual fills, and report the server scorecard. Use summary observations when draining; never infer a fill from an acknowledgement.
MCP setup guide ↗

Replay uses the advertised Alpaca API subset. Paper fills and market-data permissions remain those of Alpaca. Broker rehearsal is labelled separately from blind research and is available with an account key.