Skip to main content
Glama

Strategy backtest (crypto, daily closes) ($0.009)

strategy_backtest
Read-onlyIdempotent

PAID ($0.009 USDC via x402). Backtest a simple, stated trading rule on a crypto asset's daily USD closes from Coinbase Exchange and compare it with buying and holding over the same window. Strategies: sma_cross (long while the fast simple moving average is above the slow one), rsi_reversion (buy below rsiBuy, sell above rsiSell), dca (buy a fixed slice every dcaEveryDays), buy_and_hold. Signals formed at one close are executed at the next (no look-ahead); a fee of feeBps per trade; long or flat only. Returns total return, buy-and-hold return, max drawdown, Sharpe, exposure, win rate, the trades and an equity curve, with the full rules in method. 30-365 days. An empty body tests BTC, SMA 20/50 over 180 days. A ticker with no Coinbase USD market is 404 (not charged). A test of past prices, not a forecast or advice. Without payment this returns the 402 challenge; the fiatdock-mcp npm package pays automatically. Any answer the tool cannot produce is >= 400 and is NOT charged.

Input Schema

NameRequiredDescriptionDefault
daysNoLength of the tested window in days, 30-365 (default 180)
fastNosma_cross: fast moving-average length in days, 2-100 (default 20)
slowNosma_cross: slow moving-average length in days, 3-200, longer than fast (default 50)
assetNoCrypto asset ticker with a USD market on Coinbase Exchange (BTC, ETH, SOL, …). Default BTC
feeBpsNoFee on every trade in basis points, 0-100 (default 10 = 0.1%)
rsiBuyNorsi_reversion: buy when RSI falls below this, 1-50 (default 30)
paymentNoBase64 of a single x402 v2 PaymentPayload (EIP-3009 transferWithAuthorization on Base USDC). OMIT it on the first call: the 402 you get back carries `howToPay.payloadTemplate` — the exact envelope to fill in — plus the price and the EIP-712 domain. Send it on the second call to complete the purchase; it is forwarded as the PAYMENT-SIGNATURE header, never as body data. Nothing is charged for the 402 itself, and a call that fails after payment settles nothing.
rsiSellNorsi_reversion: sell when RSI rises above this, 50-99 (default 70)
strategyNosma_cross (long while the fast moving average is above the slow one), rsi_reversion (buy when RSI falls below rsiBuy, sell when it rises above rsiSell), dca (buy a fixed amount every dcaEveryDays), buy_and_hold. Default sma_cross
rsiPeriodNorsi_reversion: RSI length in days, 2-50 (default 14)
capitalUsdNoStarting capital in USD, 10-10000000 (default 1000)
dcaEveryDaysNodca: days between purchases, 1-30 (default 7)

Output Schema

NameRequiredDescriptionDefault
asOfYesISO time the prices were read
noteYesWhat a backtest is and is not
assetYesThe asset tested (its ticker)
marketYesThe Coinbase Exchange market read, e.g. BTC-USD
methodYesThe rules, in full — enough to recompute every number
paramsYesThe parameters the rule used (defaults filled in)
periodYesThe tested window: first and last completed UTC day, and its length
sharpeYesAnnualised Sharpe ratio of daily equity returns (risk-free 0); null when equity never moved
sourceYesWhere the prices come from
tradesYesNumber of trades (buys and sells)
strategyYesThe rule tested: sma_cross, rsi_reversion, dca or buy_and_hold
tradeListYesThe last 30 trades: date, buy or sell, execution close
winRatePctYesShare of closed round trips that ended above their entry, in percent; null with no closed trip
endPriceUsdYesClose on the last day of the window
equityCurveYesUp to 31 evenly spaced points of the equity curve, with the asset's close
exposurePctYesShare of days the rule held the asset, in percent
startPriceUsdYesClose on the first day of the window
finalEquityUsdYesCapital at the end, cash plus the asset at the last close
maxDrawdownPctYesThe largest peak-to-trough fall of the rule's equity, in percent
totalReturnPctYesThe rule's return over the window, fees included, in percent
buyAndHoldReturnPctYesBuying at the first close and holding, in percent (no fee) — the benchmark

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.6/5.0
Behavior5/5

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

Annotations only declare readOnly/openWorld/idempotent; the description adds substantial context the annotations cannot: price ($0.009 USDC via x402), the exact payment choreography (402 challenge, template, PAYMENT-SIGNATURE header), that failures after payment settle nothing, and the simulation mechanics (signals at close executed at next close, no look-ahead, feeBps per trade, long-or-flat only). The purchasing flow is fully disclosed without contradicting readOnlyHint, since no market state is mutated.

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?

Front-loaded with payment model and purpose, and every clause carries information the schema does not. It is long and somewhat list-dense, and the strategy enumeration is repeated verbatim from the schema's enum description, which is mild redundancy rather than a real defect.

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 12-parameter, zero-required, paid, output-schema-backed tool, everything an agent needs is present: cost, payment handshake, error/charging semantics, defaults, and window bounds. Return values are summarized but the output schema exists, so that redundancy does not create a gap.

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, and the description largely mirrors the schema's strategy explanations. It adds one genuinely new composition the schema lacks: the empty-body default bundle (BTC, SMA 20/50, 180 days), plus execution semantics ('signals formed at one close are executed at the next') that give meaning to the strategy parameters.

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 specific verb and resource — backtest a stated trading rule on a crypto asset's daily USD closes from Coinbase Exchange — and names the comparison baseline (buy-and-hold over the same window). This clearly separates it from price/report siblings like token_price or token_report, which return data rather than simulate a rule.

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?

Gives explicit entry conditions: an empty body tests BTC with SMA 20/50 over 180 days, the window is constrained to 30-365 days, and a ticker without a Coinbase USD market returns an uncharged 404. It does not name alternative sibling tools for related questions, so it stops just short of full when/when-not routing 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.