Skip to main content
Glama
bitbank-lab-mcp

bitbank-lab-mcp

Official
by bitbankinc

run_backtest

Backtest crypto trading strategies like SMA cross, RSI, MACD, and Bollinger breakout across custom periods and timeframes, returning win rate, drawdown, Sharpe ratio, and SVG charts.

Instructions

[Backtest / Strategy Test / SMA Cross / RSI / MACD] 汎用バックテスト(backtest / strategy test / simulation / performance)。データ取得〜計算〜チャート描画を一括実行。

戦略: sma_cross / rsi / macd_cross / bb_breakout。 期間: 1M / 3M / 6M / 1Y / 2Y / 3Y、または start_date+end_date (YYYY-MM-DD) で任意レンジ指定可。 時間軸: 1D / 4H / 1H。 SVG チャート付きで損益・勝率・最大DD・Sharpe Ratio 等を返却。 content テキスト末尾に equity_curve / drawdown_curve の JSON を含む (chartDetail=default は最大 200 点の均等サンプル、full は全点)。独自実装不要。

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "strategy": "<strategy>"
    },
    "name": "run_backtest"
  }
}

Input Schema

NameRequiredDescriptionDefault
pairNoTrading pair (e.g., btc_jpy)btc_jpy
fee_bpNoOne-way fee in basis points. When omitted, resolved dynamically from the current /spot/pairs taker rate (falls back to nominal 12 bp if unavailable). Explicit values are always respected.
periodNoBacktest period: 1M, 3M, 6M, 1Y, 2Y, or 3Y. Ignored when start_date and end_date are both provided.3M
savePngNoSave chart as PNG file to outputDir (default: false). For inline display in chat UI, leave false and use includeSvg or prepare_chart_data instead.
end_dateNoBacktest end date (ISO 8601: YYYY-MM-DD). Takes precedence over period when both start_date and end_date are provided.
strategyYesStrategy configuration
executionNoExecution timing (fixed: t+1_open)t+1_open
outputDirNoOutput directory for chart files. Must be under an allowed root: /mnt/user-data/outputs, the server working directory, or a directory listed in the BACKTEST_OUTPUT_DIR_ALLOWLIST environment variable./mnt/user-data/outputs
timeframeNoCandle timeframe: 1D (daily), 4H (4-hour), 1H (hourly)1D
includeSvgNoInclude SVG string in response (default: false, for token saving)
start_dateNoBacktest start date (ISO 8601: YYYY-MM-DD). Takes precedence over period when both start_date and end_date are provided.
chartDetailNoChart detail level: default (equity+DD only) or full (price+indicator+equity+DD+position). Use full ONLY when user explicitly requests price chart or indicator visualization.default

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.8.0
    • changedInput schema / properties / strategy / properties / params / description
      Previous value: -"Strategy parameters (overrides defaults)"New value: +"Strategy parameters (overrides defaults). Unknown keys are rejected. Period params (short / long / period / fast / slow / signal / sma_filter_period / rsi_filter_period) must be integers."
  2. Changed2 schema fields changedv0.4.1
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • changedInput schema / properties / outputDir / description
      Previous value: -"Output directory for chart files"New value: +"Output directory for chart files. Must be under an allowed root: /mnt/user-data/outputs, the server working directory, or a directory listed in the BACKTEST_OUTPUT_DIR_ALLOWLIST environment variable."
  3. First observedv0.1.1

TDQS

A4.1/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full disclosure burden and does so well: it states what the response contains (SVG chart plus PnL, win rate, max drawdown, Sharpe) and that equity_curve/drawdown_curve JSON is appended to the content text, including that default sampling yields up to 200 evenly spaced points versus all points with full. It also surfaces the outputDir allowlist constraint and the dynamic fee resolution fallback, which are real operational caveats. Latency/runtime cost of a multi-year backtest is not mentioned, keeping it off a 5.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The bracket-tag header and label-prefixed lines (戦略 / 期間 / 時間軸) front-load the identifying information and make scanning fast, and the return-value and chart-detail sentences each carry distinct information. There is minor redundancy where period options are listed both in the description and the schema, but nothing that reads as filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 12-parameter tool with a nested strategy object and no output schema, the description covers outputs (metrics, embedded curve JSON, SVG/PNG options), range-selection precedence, and the writing constraints of outputDir, which is most of what governs a correct call. Gaps remain on strategy parameter defaults and failure modes such as invalid pair or insufficient history, so it is not fully complete. It never claims anything inconsistent with the absence of annotations.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents period, timeframe, fee_bp, outputDir, savePng, includeSvg, and chartDetail, and the description largely restates those. It does add one genuinely new detail not in the schema — that chartDetail=default is a max-200-point even sample while full uses every point — which justifies going to 3 rather than lower, but it does not explain strategy.params defaults or valid period/fast/slow ranges, which is where an agent would most need help for a nested 12-parameter schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description names a specific operation (a full backtest/simulation pipeline from data fetch through computation to chart rendering) and enumerates the four supported strategies (sma_cross / rsi / macd_cross / bb_breakout) plus timeframes. This clearly distinguishes it from sibling snapshot/analysis tools like analyze_sma_snapshot or detect_macd_cross, which detect conditions rather than run an equity simulation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives concrete selection rules: use start_date+end_date to override period, use chartDetail=full ONLY when the user explicitly requests a price/indicator chart, and leave savePng=false for inline chat display and use includeSvg or prepare_chart_data instead. That names an alternative tool and the condition that triggers it. It does not, however, state when to prefer this over the analyze_*/detect_* siblings for signal questions, so it stops short of a full when/when-not matrix.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.