Skip to main content
Glama

Compare Relative Return of Two Markets

compare_relative_return
Read-onlyIdempotent

Did one market beat another over a fixed window, and how often has it? coverage.resultCoverage separates archive gaps, required outcome endpoints, full regime lookbacks and in-play checkpoints, with exact exclusion counts and dated samples. The common data_coverage flag assesses source archives separately. Use this for any A-versus-B question across BTCUSDT, ETHUSDT, SOLUSDT, ZECUSDT, and HYPEUSDT (Binance Spot, HYPEUSDT available from 2026-09-24), for example 'ZEC vs BTC over 12 hours' (interval 1h, horizonBars 12) or 'ZEC vs HYPE over 6 hours, abs(ZEC return) > abs(HYPE return)' (base ZECUSDT, versus HYPEUSDT, interval 1h, horizonBars 6, measure abs_difference). Both legs are Binance spot USDT pairs; each window is open-to-close on a fixed UTC grid and windows never overlap. Set measure='difference' (default, base - versus), 'ratio', or 'abs_difference' (abs(base) - abs(versus), testing magnitude rather than signed direction). Returns how often the base won with a 95% interval, metric quantiles, the share of windows above a ladder of margins, a split by year and by the last 90 and 365 days, whether the previous winner repeats, a regime split (how far apart the two markets were moving before the open, known at the open: calm, mid or wild, with the band and margin ladder for each, the state right now, and a later-half holdout check), the window running now with how the side ahead at this point finished in the past, and the latest finished windows with timestamped opens and closes. The regime sets how wide a window runs, not who wins it: use it to size a margin, never to pick a side. Pass windowOpenMs to read one specific window for settling a round; pass thresholdPct for 'beat by more than X points'; pass offsetBars to move the grid. Quote brief. Missing klines are reported and never filled in. A count of past windows, not a forecast and not a side. NO_TRADE.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "compare_relative_return"
  }
}

Input Schema

NameRequiredDescriptionDefault
baseNoThe market being measured. One of BTCUSDT, ETHUSDT, SOLUSDT, ZECUSDT, HYPEUSDT. Default ZECUSDT.ZECUSDT
versusNoThe market it is measured against. One of BTCUSDT, ETHUSDT, SOLUSDT, ZECUSDT, HYPEUSDT. Default BTCUSDT.BTCUSDT
measureNodifference: base return minus versus return, in percentage points. ratio: return of the base/versus price ratio, (1+base)/(1+versus)−1. abs_difference: abs(base return) minus abs(versus return), in percentage points (at threshold 0 it tests abs(base return) > abs(versus return)). Default difference.difference
sinceMsNoOnly count windows that open at or after this Unix millisecond time.
untilMsNoOnly count windows that open before this Unix millisecond time.
intervalNoCandle size the window is built from: 5m, 15m, 1h, 4h, 1d. Default 1h.1h
offsetBarsNoShift of the window grid in bars. Windows start where (bar open time − offset) is a whole multiple of the window length since 1970-01-01 00:00 UTC. With 1h and 12 bars, 0 gives windows opening at 00:00 and 12:00 UTC; 8 gives 08:00 and 20:00. Default 0.
horizonBarsNoWindow length in bars. 12 bars of 1h is a 12-hour window; 3 bars of 4h is the same span on coarser candles. Default 12.
thresholdPctNoThe base wins a window when its relative return is strictly above this many percentage points. 0 asks 'did base beat versus'; 1 asks 'by more than one point'. Default 0.
windowOpenMsNoReturn the observation for the one window that opens at this Unix millisecond time, for settling a specific round. It must lie on the window grid.
recentWindowsNoHow many of the latest finished windows to list with their timestamped opens and closes. Default 6.
regimeLookbackBarsNoBars before each window open used to measure how much the two markets were moving apart. Default is twice the window length, at least 12 and at most 96 (24 bars for a 12-bar window).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changed
    • changedInput schema / properties / base / description
      Previous value: -"The market being measured. One of BTCUSDT, ETHUSDT, SOLUSDT, ZECUSDT. Default ZECUSDT."New value: +"The market being measured. One of BTCUSDT, ETHUSDT, SOLUSDT, ZECUSDT, HYPEUSDT. Default ZECUSDT."
    • changedInput schema / properties / base / enum
      Previous value: -[
      -  "BTCUSDT",
      -  "ETHUSDT",
      -  "SOLUSDT",
      -  "ZECUSDT"
      -]New value: +[
      +  "BTCUSDT",
      +  "ETHUSDT",
      +  "SOLUSDT",
      +  "ZECUSDT",
      +  "HYPEUSDT"
      +]
    • changedInput schema / properties / measure / description
      Previous value: -"difference: base return minus versus return, in percentage points. ratio: return of the base/versus price ratio, (1+base)/(1+versus)−1. They always agree on the winner at threshold 0. Default difference."New value: +"difference: base return minus versus return, in percentage points. ratio: return of the base/versus price ratio, (1+base)/(1+versus)−1. abs_difference: abs(base return) minus abs(versus return), in percentage points (at threshold 0 it tests abs(base return) > abs(versus return)). Default difference."
    • changedInput schema / properties / measure / enum
      Previous value: -[
      -  "difference",
      -  "ratio"
      -]New value: +[
      +  "difference",
      +  "ratio",
      +  "abs_difference"
      +]
    • changedInput schema / properties / versus / description
      Previous value: -"The market it is measured against. One of BTCUSDT, ETHUSDT, SOLUSDT, ZECUSDT. Default BTCUSDT."New value: +"The market it is measured against. One of BTCUSDT, ETHUSDT, SOLUSDT, ZECUSDT, HYPEUSDT. Default BTCUSDT."
    • changedInput schema / properties / versus / enum
      Previous value: -[
      -  "BTCUSDT",
      -  "ETHUSDT",
      -  "SOLUSDT",
      -  "ZECUSDT"
      -]New value: +[
      +  "BTCUSDT",
      +  "ETHUSDT",
      +  "SOLUSDT",
      +  "ZECUSDT",
      +  "HYPEUSDT"
      +]
  2. Added

TDQS

A4.2/5.0
Behavior5/5

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

Beyond the read-only, idempotent annotations, the description discloses important behavior: missing klines are reported and never filled, windows are open-to-close on a fixed UTC grid and never overlap, coverage separates archive gaps and exclusion counts, and results are historical counts rather than forecasts. It also explains the returned regime split, holdout check, and latest finished windows.

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 content is mostly relevant for a complex 12-parameter tool, but the description is a dense paragraph that jumps from the core question to coverage internals before explaining usage. Some phrases are terse to the point of obscurity, such as 'Quote brief' and 'NO_TRADE', and the structure could be more front-loaded and scannable.

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?

Given the tool's complexity and lack of an output schema, the description is complete enough: it explains what the return includes, how data gaps are handled, what the regime split means, how recent windows are reported, and how special parameters alter behavior. An agent has enough context to invoke it correctly and interpret the main outputs.

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 schema already defines all 12 parameters. The description adds useful usage context by tying parameters to examples and purposes, such as windowOpenMs for settling a specific round, thresholdPct for 'beat by more than X points', and offsetBars for moving the grid.

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

Purpose4/5

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

The description clearly states a specific comparison: whether one market beat another over a fixed window and how often, across named Binance spot pairs. It gives concrete examples like 'ZEC vs BTC over 12 hours' and distinguishes this as an A-versus-B question, though it does not explicitly name a sibling tool as an alternative.

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 provides strong when-to-use guidance: any A-versus-B question across the listed markets, with examples for interval, horizonBars, threshold, and measure. It also advises using regime data to size margins rather than pick sides and says the result is not a forecast. It lacks explicit named alternatives or when-not-to-use conditions beyond the NO_TRADE caveat.

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.

Resources