Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/backtest-kit/ai-trading-mcp/llms.txt

Use this file to discover all available pages before exploring further.

Paper mode lets you run the complete AI Trading MCP pipeline — Telegram feed, Claude decision loop, engine validation, position lifecycle — against live Binance market data without risking a single cent. Price feeds (OHLCV candles and order book) are fetched in real time from Binance via ccxt, but every fill, take-profit hit, and stop-loss trigger is simulated inside the backtest-kit engine. No Binance API keys are required.

Launch Command

npm start -- --paper --entry ./content/manual.strategy/manual.strategy.ts --ui

--paper

Activates the paper broker. The engine runs all fill logic internally — no exchange credentials needed.

--entry

Points to the strategy file. The bundled manual.strategy.ts registers no signal logic — entries come exclusively from the Claude agent.

--ui

Starts the dashboard server on port 60050. View portfolio state, open positions, PnL history, and the full MCP audit trail from any browser.

What Happens at Startup

1

Engine initialises persistence

Live state directories under dump/ are created. Signals, positions, and session data survive process restarts.
2

13 background loops start

One Live.background() call is issued for every symbol in CC_SYMBOL_LIST. The default whitelist is 13 pairs: BTCUSDT, POLUSDT, ZECUSDT, HYPEUSDT, DOGEUSDT, SOLUSDT, PENGUUSDT, TRXUSDT, HBARUSDT, NEARUSDT, FARTCOINUSDT, ETHUSDT, PUMPUSDT.
for (const symbol of CC_SYMBOL_LIST) {
  Live.background(symbol, {
    exchangeName: exchangeSchema.exchangeName,
    strategyName: strategySchema.strategyName,
  });
}
3

MCP HTTP bridge starts on :60051

serve() (called in config/setup.config.ts) opens the HTTP bridge on 127.0.0.1:60051. The stdio MCP server (npx @backtest-kit/mcp) forwards every get_status, open_position, and close_position call here.
4

Dashboard ready on :60050

The web UI serves the portfolio state, position history, and the markdown dump viewer so you can inspect every get_status response the agent saw.

The Paper Module

modules/paper.module.ts registers the ccxt-exchange schema with a public-only Binance client — no apiKey or secret fields, no authenticated endpoints:
const getExchange = singleshot(async () => {
  const exchange = new ccxt.binance({
    options: {
      defaultType: "spot",
      adjustForTimeDifference: true,
      recvWindow: 60000,
    },
    enableRateLimit: true,
  });
  await exchange.loadMarkets();
  return exchange;
});
This single singleshot-wrapped client powers all four exchange schema methods used by the engine:
MethodWhat it calls
getCandlesexchange.fetchOHLCV — real Binance OHLCV candles
getOrderBookexchange.fetchOrderBook — live bid/ask depth
formatPriceroundTicks(price, tickSize) when tick size is available; falls back to exchange.priceToPrecision
formatQuantityroundTicks(quantity, stepSize) when step size is available; falls back to exchange.amountToPrecision
Because no credentials are configured, any attempt to call an authenticated endpoint (placing or cancelling a real order) would throw immediately — the architecture makes accidental live execution in paper mode impossible.

How Paper Fills Work

When the agent calls open_position, the engine computes entry cost, take-profit, and stop-loss engine-side. modules/paper.module.ts registers no broker adapter — it only supplies an addExchangeSchema with the public ccxt Binance client. All fill logic is handled entirely by the backtest-kit engine’s internal simulation using the live candle and order-book data the exchange schema provides. No orders are placed on Binance. The position, its unrealized PnL, and every state transition are written to dump/data/ so the full lifecycle survives a restart.

Dashboard: Port 60050

Portfolio State

Per-symbol cards showing current price, open position direction, entry price, unrealized PnL, and queued signals.

Audit Trail Viewer

Every get_status response is dumped to dump/mcp/<minute-stamp>.md with attached chart images. The UI renders these dumps so you can replay exactly what the agent saw before each decision.

Why Use Paper Mode

Paper mode is the right starting point for every new setup because it exercises the entire system end-to-end:
  • The Telegram scraper connects, authenticates, and begins fetching posts.
  • The MCP feed assembles portfolio state + last 15 posts (text and images) into a single get_status response.
  • The engine validates open_position calls against the symbol whitelist and existing positions.
  • The audit trail writes every byte the agent saw to disk.
  • The dashboard lets you verify positions and history visually.
Nothing about this pipeline changes when you switch to live — only the broker adapter is swapped out.
Paper mode shares the identical code path with live mode all the way down to the broker boundary. A strategy that opens, manages, and closes positions correctly in paper will behave identically in live — except fills are real and slippage is real. Run paper long enough to observe a full position lifecycle (open → TP or SL hit → close) before switching.

Build docs developers (and LLMs) love