Skip to main content
Glama

Backtesting Arena

Run a Grid-Trading Backtest

arena_run_grid_backtest

Would a grid bot have made money here? Simulate a GRID BOT (buy-low / sell-high ladder inside a fixed price range) on historical candles. Returns final value, return %, CAGR, trade count, fees paid and a Buy & Hold comparison — plus zerlegung (spot runs): decomposition splits the result into ladder P&L from completed buy→sell cycles, allocation P&L of the starting coins, open grid buys and fees (identity_check_usd must be ~0); benchmarks anchors buy-and-hold, the never-touched starting split (static_allocation, with coin_share_start) and an arithmetic 50/50 at the entry price — grid_vs_static_pp is the number that says whether the ladder added anything over just holding the split; fee_economics gives the break-even spacing (2 × fee) and flags below_breakeven. Note: buyhold_return/outperformance keep their legacy anchor (first→last candle close); benchmarks anchor at entry. outperformance = CAGR gap, not return gap (benchmarks.grid_vs_buy_and_hold_pp). max_drawdown_pct/buyhold_max_drawdown_pct: % peak-to-trough per candle close. This is a different machine from the strategy backtester: grid bots earn from oscillation inside a range, not from trend — for signal-based strategies use arena_run_backtest instead. The result depends heavily on the range you choose (low_price / high_price); a range the price left early makes the bot idle (by default the grid pauses outside the range and resumes when price returns; set stop_on_range_exit to end the run at the first close outside it instead, selling all coins there), so treat range choice as part of the hypothesis, not a detail — arena_suggest_grid_range proposes a defensible range. Each run is saved to your account (the returned id is the run_id); publish a public snapshot page with arena_share_grid_backtest. grid_mode picks neutral (default) or long. Optional leverage (2/3/5, grid_mode long only, Pro) with funding_mode (conservative default / historical BTCUSDT / none): simulates an isolated-margin futures long grid — margin = total_investment, the grid trades margin × leverage, by default opening an initial position at the start like Binance/KuCoin futures grids (start_rule), funding accrues daily on the open position, liquidation is checked per candle at the low. It simulates, it does not recommend: the result can be a total loss of the margin. Free tier limited to BTCUSDT/ETHUSDT. Per-day quota: Free=5, Pro=50, Power=500. [Free / Pro / Power tier]

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": {
      "pair": "<pair>",
      "start_date": "<start_date>",
      "end_date": "<end_date>",
      "total_investment": "<total_investment>",
      "low_price": "<low_price>",
      "high_price": "<high_price>",
      "grid_count": "<grid_count>",
      "grid_type": "<grid_type>",
      "fee_rate": "<fee_rate>"
    },
    "name": "arena_run_grid_backtest"
  }
}

Input Schema

NameRequiredDescriptionDefault
pairYesCrypto pair symbol, e.g. BTCUSDT. Free tier: BTCUSDT or ETHUSDT only.
end_dateYesSimulation end, YYYY-MM-DD.
fee_rateYesPer-trade fee fraction, e.g. 0.001 for 0.1% (Binance spot taker).
leverageNoOptional, default 1 (spot grid, unchanged). 2/3/5 = isolated-margin long grid (grid_mode must be long; Pro). Adds liquidated, liquidation_time/price, funding_cost_usd and max_notional_exposure to the result; final_value/total_return are then on the margin.
grid_modeNo'neutral' (default): buys coins for every level above the entry at the start (the coin share follows the entry's position in the range — measured 2–83 %, NOT a fixed 50/50; see benchmarks.static_allocation.coin_share_start), then buys and sells around the entry. 'long': starts 100% in cash, buys dips below the entry, sells on recovery — required for leverage (with leverage the start follows start_rule).
grid_typeYesLevel spacing: 'arithmetic' = equal price steps, 'geometric' = equal percentage steps (usually the better fit for crypto).
low_priceYesLower bound of the grid range, in quote currency. Below it the bot is fully invested and stops buying.
grid_countYesNumber of grid levels between low_price and high_price (2–200). More levels = more, smaller trades = more fees.
high_priceYesUpper bound of the grid range, in quote currency. Above it the bot is fully in cash and stops selling. Must exceed low_price.
start_dateYesSimulation start, YYYY-MM-DD.
start_ruleNoOnly with leverage > 1. 'initial_position' (default, exchange rule of a futures long grid): at the start the bot buys one grid amount for every level above the entry at the entry price, so it holds a position — and carries funding and liquidation risk — from the first candle. 'cash': starts 100% in cash and only buys once price falls to a buy level (idle after a rising start).
entry_priceNoOptional price at which the bot starts; default is the OPEN of the first candle (must lie inside low_price..high_price).
funding_modeNoOnly with leverage > 1. 'conservative' (default): flat 0.05%/day on the open position. 'historical': recorded daily average of three exchanges, BTCUSDT from 2019-09-08 only — otherwise falls back to conservative and flags funding_fell_back_to_conservative. 'none': no funding (optimistic).
stop_loss_priceNoOptional: liquidate the whole grid and stop once price falls to this level.
total_investmentYesCapital in USDT spread across the grid; min 100.
take_profit_priceNoOptional: liquidate the whole grid and stop once price rises to this level.
stop_on_range_exitNoOptional (default false): stop once a candle CLOSES outside low_price..high_price — sell all coins at that close, stop_reason range_exit_high/low. Default: the grid pauses outside the range and resumes when price returns.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changed
    • removedInput schema / additionalProperties
      Removed value: -false
    • addedInput schema / properties / leverage / anyOf
      Added value: +[
      +  {
      +    "const": 1,
      +    "type": "number"
      +  },
      +  {
      +    "const": 2,
      +    "type": "number"
      +  },
      +  {
      +    "const": 3,
      +    "type": "number"
      +  },
      +  {
      +    "const": 5,
      +    "type": "number"
      +  }
      +]
    • removedInput schema / properties / leverage / enum
      Removed value: -[
      -  1,
      -  2,
      -  3,
      -  5
      -]
    • removedInput schema / properties / leverage / type
      Removed value: -"number"
  2. Changed2 schema fields changed
    • changedInput schema / properties / grid_mode / description
      Previous value: -"'neutral' (default): buys coins for every level above the entry at the start (the coin share follows the entry's position in the range — measured 2–83 %, NOT a fixed 50/50; see benchmarks.static_allocation.coin_share_start), then buys and sells around the entry. 'long': starts 100% in cash, buys dips below the entry, sells on recovery — required for leverage."New value: +"'neutral' (default): buys coins for every level above the entry at the start (the coin share follows the entry's position in the range — measured 2–83 %, NOT a fixed 50/50; see benchmarks.static_allocation.coin_share_start), then buys and sells around the entry. 'long': starts 100% in cash, buys dips below the entry, sells on recovery — required for leverage (with leverage the start follows start_rule)."
    • addedInput schema / properties / start_rule
      Added value: +{
      +  "description": "Only with leverage > 1. 'initial_position' (default, exchange rule of a futures long grid): at the start the bot buys one grid amount for every level above the entry at the entry price, so it holds a position — and carries funding and liquidation risk — from the first candle. 'cash': starts 100% in cash and only buys once price falls to a buy level (idle after a rising start).",
      +  "enum": [
      +    "initial_position",
      +    "cash"
      +  ],
      +  "type": "string"
      +}
  3. Changed1 schema field changed
    • addedInput schema / properties / stop_on_range_exit
      Added value: +{
      +  "description": "Optional (default false): stop once a candle CLOSES outside low_price..high_price — sell all coins at that close, stop_reason range_exit_high/low. Default: the grid pauses outside the range and resumes when price returns.",
      +  "type": "boolean"
      +}
  4. Changed2 schema fields changed
    • changedInput schema / properties / entry_price / description
      Previous value: -"Optional price at which the bot starts; default is the first close in the range."New value: +"Optional price at which the bot starts; default is the OPEN of the first candle (must lie inside low_price..high_price)."
    • changedInput schema / properties / grid_mode / description
      Previous value: -"'neutral' (default): starts half in coins, buys and sells around the entry. 'long': starts 100% in cash, buys dips below the entry, sells on recovery — required for leverage."New value: +"'neutral' (default): buys coins for every level above the entry at the start (the coin share follows the entry's position in the range — measured 2–83 %, NOT a fixed 50/50; see benchmarks.static_allocation.coin_share_start), then buys and sells around the entry. 'long': starts 100% in cash, buys dips below the entry, sells on recovery — required for leverage."
  5. Changed3 schema fields changed
    • addedInput schema / properties / funding_mode
      Added value: +{
      +  "description": "Only with leverage > 1. 'conservative' (default): flat 0.05%/day on the open position. 'historical': recorded daily average of three exchanges, BTCUSDT from 2019-09-08 only — otherwise falls back to conservative and flags funding_fell_back_to_conservative. 'none': no funding (optimistic).",
      +  "enum": [
      +    "none",
      +    "conservative",
      +    "historical"
      +  ],
      +  "type": "string"
      +}
    • addedInput schema / properties / grid_mode
      Added value: +{
      +  "description": "'neutral' (default): starts half in coins, buys and sells around the entry. 'long': starts 100% in cash, buys dips below the entry, sells on recovery — required for leverage.",
      +  "enum": [
      +    "neutral",
      +    "long"
      +  ],
      +  "type": "string"
      +}
    • addedInput schema / properties / leverage
      Added value: +{
      +  "description": "Optional, default 1 (spot grid, unchanged). 2/3/5 = isolated-margin long grid (grid_mode must be long; Pro). Adds liquidated, liquidation_time/price, funding_cost_usd and max_notional_exposure to the result; final_value/total_return are then on the margin.",
      +  "enum": [
      +    1,
      +    2,
      +    3,
      +    5
      +  ],
      +  "type": "number"
      +}
  6. Changed3 schema fields changed
    • addedInput schema / additionalProperties
      Added value: +false
    • removedInput schema / properties / context
      Removed value: -{
      -  "description": "Explain why you are calling this tool and how it fits into the user's overall goal. This parameter is used for analytics and user intent tracking. YOU MUST provide 15-25 words (count carefully). NEVER use first person ('I', 'we', 'you') - maintain third-person perspective. NEVER include sensitive information such as credentials, passwords, or personal data. Example (20 words): \"Searching across the organization's repositories to find all open issues related to performance complaints and latency issues for team prioritization.\"",
      -  "type": "string"
      -}
    • changedInput schema / required
      Previous value: -[
      -  "pair",
      -  "start_date",
      -  "end_date",
      -  "total_investment",
      -  "low_price",
      -  "high_price",
      -  "grid_count",
      -  "grid_type",
      -  "fee_rate",
      -  "context"
      -]New value: +[
      +  "pair",
      +  "start_date",
      +  "end_date",
      +  "total_investment",
      +  "low_price",
      +  "high_price",
      +  "grid_count",
      +  "grid_type",
      +  "fee_rate"
      +]
  7. Changed12 schema fields changed
    • addedInput schema / properties / end_date / description
      Added value: +"Simulation end, YYYY-MM-DD."
    • addedInput schema / properties / entry_price / description
      Added value: +"Optional price at which the bot starts; default is the first close in the range."
    • changedInput schema / properties / fee_rate / description
      Previous value: -"Per-trade fee fraction, e.g. 0.001 for 0.1%."New value: +"Per-trade fee fraction, e.g. 0.001 for 0.1% (Binance spot taker)."
    • addedInput schema / properties / grid_count / description
      Added value: +"Number of grid levels between low_price and high_price (2–200). More levels = more, smaller trades = more fees."
    • addedInput schema / properties / grid_type / description
      Added value: +"Level spacing: 'arithmetic' = equal price steps, 'geometric' = equal percentage steps (usually the better fit for crypto)."
    • addedInput schema / properties / high_price / description
      Added value: +"Upper bound of the grid range, in quote currency. Above it the bot is fully in cash and stops selling. Must exceed low_price."
    • addedInput schema / properties / low_price / description
      Added value: +"Lower bound of the grid range, in quote currency. Below it the bot is fully invested and stops buying."
    • addedInput schema / properties / pair / description
      Added value: +"Crypto pair symbol, e.g. BTCUSDT. Free tier: BTCUSDT or ETHUSDT only."
    • addedInput schema / properties / start_date / description
      Added value: +"Simulation start, YYYY-MM-DD."
    • addedInput schema / properties / stop_loss_price / description
      Added value: +"Optional: liquidate the whole grid and stop once price falls to this level."
    • addedInput schema / properties / take_profit_price / description
      Added value: +"Optional: liquidate the whole grid and stop once price rises to this level."
    • changedInput schema / properties / total_investment / description
      Previous value: -"USDT amount; min 100."New value: +"Capital in USDT spread across the grid; min 100."
  8. First observed

TDQS

A4.7/5.0
Behavior5/5

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

Annotations only declare readOnlyHint=false, idempotentHint=false, destructiveHint=false; the description adds substantial context beyond that — each run is persisted to the account and returns a run_id, quotas and tier gating apply, leverage simulates isolated margin with per-candle liquidation checks at the low, and it warns the result can be a total loss of margin and is not a recommendation. That is far more than the annotations carry.

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

Conciseness3/5

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

The purpose is front-loaded and every section is on-topic, but the body is one dense block of semicolon-chained clauses with heavy inline code markup and untranslated jargon ('zerlegung', identity_check_usd, grid_vs_static_pp) that is hard to scan. Given 17 parameters and no output schema some length is justified, but the output-decomposition detail could be tightened or split.

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

Completeness5/5

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

For a 17-parameter simulation tool with no output schema, the description covers the essentials: what is returned at a high level (final value, return %, CAGR, trade count, fees, buy & hold comparison), how the decomposition and benchmark blocks should be read, the legacy-anchor caveat, risk of total loss, persistence, and quota limits.

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

Parameters4/5

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

Schema description coverage is 100%, so the baseline is 3; the description earns above that by adding decision-level meaning the schema does not, notably that 'the result depends heavily on the range you choose (low_price / high_price)' and that range choice is part of the hypothesis, plus the default pause-vs-stop semantics of stop_on_range_exit and the leverage/start_rule interaction. It does not repeat every parameter, which is correct since the schema already documents them.

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?

States a concrete verb and resource ('Simulate a GRID BOT ... on historical candles') and immediately bounds the concept with a plain-language definition (buy-low/sell-high ladder inside a fixed price range). It also explicitly distinguishes itself from the sibling strategy backtester ('This is a different machine from the strategy backtester ... for signal-based strategies use arena_run_backtest instead').

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

Usage Guidelines5/5

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

Gives explicit routing rules: use arena_run_backtest for signal-based strategies, arena_suggest_grid_range to pick a defensible range, arena_share_grid_backtest to publish. It also names the conditions that change behavior (range exit pausing vs stop_on_range_exit, leverage only with grid_mode long and Pro) and states the tier/quota limits (Free=5/day, Pro=50, Power=500, Free pairs BTCUSDT/ETHUSDT).

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.