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. 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.8/5.0
Behavior5/5

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

Beyond the annotations (readOnlyHint false, non-idempotent), the description discloses what happens to data (each run is saved to the account, returns a run_id), the destructive worst case (total loss of margin on leveraged grids), and operational limits (Free tier BTCUSDT/ETHUSDT only; per-day quota Free=5/Pro=50/Power=500). It also explains the pause-outside-range default vs stop_on_range_exit and that buyhold_return uses a legacy anchor while benchmarks anchor at entry — materially useful behavior not in the annotations.

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?

It is front-loaded with the decision-relevant framing (what it is, how it differs, why range matters) before the dense decomposition/leverage detail. It is long, but the length is justified by a 17-parameter, multi-mode tool; the backtick-heavy run-on paragraph on zerlegung could be split, which is the only real cost to readability.

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?

There is no output schema, yet the description enumerates the returned metrics (final value, return %, CAGR, trade count, fees, Buy & Hold), the decomposition identity (identity_check_usd ~0), benchmarks and fee_economics, and the leverage-only fields. For a tool this complex, nothing an agent needs to call or interpret it correctly is missing.

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 coverage is 100%, so 3 is the floor, but the description adds interpretation the schema only partially covers: it explains the downstream consequence of low_price/high_price (a range the price left early makes the bot idle), the coin-share behavior at entry (2–83%, not 50/50), and the leverage/funding/start_rule interactions. Some of this restates rich schema text, keeping it just short of a 5.

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 opens with a concrete framing question and then states precisely what it does: simulates a grid bot (buy-low/sell-high ladder in a fixed range) on historical candles. It explicitly distinguishes this machine from arena_run_backtest (grid earns from oscillation, not trend), so an agent can route correctly without opening schemas.

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?

It names the alternative for signal-based strategies (arena_run_backtest) and the prerequisite helper for range selection (arena_suggest_grid_range), plus the publish sibling (arena_share_grid_backtest). It also frames when the tool applies (range-bound oscillation) and warns that range choice must be part of the hypothesis — explicit when and when-not guidance.

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.