Skip to main content
Glama
agent-next

polymarket-paper-trader

Run backtest

backtest

Replay a trading strategy over historical price snapshots on synthetic order books to evaluate performance without touching paper accounts.

Instructions

Replay a strategy over historical price snapshots on synthetic order books.

Reads the data file and returns performance metrics; it does not touch your paper accounts. Use pk_battle to compare two strategies live, or stats for an account's real results.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
depthNoSynthetic order-book size in shares at each price level. Default 500.
spreadNoSynthetic order-book spread as a price fraction (0.02 = 2 cents). Default 0.02.
balanceNoStarting USD balance. Default 10000.
data_pathYesPath to a CSV or JSON file of price snapshots (timestamp, market_slug, outcome, midpoint); must be under the home directory or /tmp.
strategy_pathYesDotted Python path of the strategy function, e.g. 'examples.momentum.run'; only 'examples.' modules are allowed.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changedv0.4.13
    • addedInput schema / properties / balance / description
      Added value: +"Starting USD balance. Default 10000."
    • addedInput schema / properties / data_path / description
      Added value: +"Path to a CSV or JSON file of price snapshots (timestamp, market_slug, outcome, midpoint); must be under the home directory or /tmp."
    • addedInput schema / properties / depth / description
      Added value: +"Synthetic order-book size in shares at each price level. Default 500."
    • addedInput schema / properties / spread / description
      Added value: +"Synthetic order-book spread as a price fraction (0.02 = 2 cents). Default 0.02."
    • addedInput schema / properties / strategy_path / description
      Added value: +"Dotted Python path of the strategy function, e.g. 'examples.momentum.run'; only 'examples.' modules are allowed."
  2. First observedv0.4.1

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already declare the safety profile (readOnlyHint=false, destructiveHint=false, idempotentHint=false), lowering the burden. The description adds genuine behavioral context beyond them: it reads a data file, returns performance metrics, and crucially 'does not touch your paper accounts' — an isolation guarantee the annotations do not convey. It is slightly in tension with readOnlyHint=false (the tool runs user strategy code), but the scope claim itself is accurate.

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

Conciseness5/5

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

Three tight sentences with zero waste: purpose first, then the behavioral/scope clarification, then sibling routing. Front-loaded and every sentence earns its place.

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?

An output schema exists, so return values need not be explained, and the description covers purpose, scope, and alternatives. The only omission is that the tool executes Python strategy code — implied by strategy_path's schema but not surfaced in the description.

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 all five parameters (data_path, strategy_path, depth, spread, balance) are fully documented with defaults and constraints in the schema. The description adds no syntax or format details beyond that, so the baseline 3 applies.

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+resource+scope: 'Replay a strategy over historical price snapshots on synthetic order books.' An agent can distinguish this from pk_battle (live comparison) and stats (real account results) without opening any schema.

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?

Explicitly names the two alternatives and the conditions that select them: 'Use pk_battle to compare two strategies live, or stats for an account's real results.' Nothing is left to inference about when to pick this tool.

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