Skip to main content
Glama

backtest_grid_search

Read-onlyIdempotent

Search across a grid of strategy parameters to identify the combination yielding the highest Sharpe ratio for a given stock and strategy.

Instructions

對單一策略做參數網格搜尋 — 在指定參數範圍內跑完所有組合,找出夏普比率最高的參數配置。適合「我想知道 RSI 策略用哪組參數最穩」這類問題。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
stockIdYes股票代號
marketNo市場 TW 或 US,預設 TW
strategyYes策略名稱:rsi_oversold / ma_crossover / breakout / mean_reversion
daysNo回測天數(預設 252)
paramGridYes參數網格,key 為參數名、value 為候選值陣列。例如 {"period":[10,14,20],"threshold":[25,30,35]}
Behavior3/5

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

Annotations already indicate read-only, non-destructive, idempotent behavior. The description adds that the tool exhaustively runs all combinations and selects the best Sharpe ratio configuration. However, it omits potential performance implications (e.g., grid size can cause long execution) and does not detail output structure. With annotations covering safety, the description provides moderate added value.

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?

The description is two concise sentences in Chinese, front-loaded with the main action and purpose. Every word adds value; no redundancy or unnecessary details.

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?

Given the tool's complexity (grid search, nested paramGrid, 5 parameters, no output schema), the description provides the core purpose and outcome (finding best Sharpe). It could be more complete by mentioning that it returns only the best configuration or a list of results, but it is sufficient for an AI to understand when to invoke this tool.

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 baseline is 3. The description does not add any additional meaning or context for parameters beyond what the schema already provides. For example, it does not explain the paramGrid structure or provide usage examples beyond what is in the schema.

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 clearly states the tool performs a parameter grid search for a single strategy, exhaustively testing all combinations and finding the configuration with the highest Sharpe ratio. It provides an example use case and distinguishes itself from siblings like backtest_strategy and backtest_multi_strategy by specifying exhaustive search over multiple parameter combinations.

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?

The description implicitly guides when to use: when wanting to know the best parameter set for a strategy. It does not explicitly exclude alternatives, but the context of sibling tools (backtest_strategy for single backtests) provides differentiation. A slight lack of explicit when-not-to-use guidance prevents a 5.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/kevinlin49361128-stack/stock-analyzer-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server