Skip to main content
Glama
picjhoe-dev

binance-market-mcp-server

by picjhoe-dev

Get Historical OHLC Candles

binance_get_historical_ohlc
Read-onlyIdempotent

Fetch historical open, high, low, close (OHLC) candles from Binance for any trading pair and date range. Use it to build price series for technical indicators or backtesting trading strategies.

Instructions

Get historical OHLC (open/high/low/close) candles for a crypto trading pair from Binance, for a given date range and interval.

Use this to build price series for indicator calculation (momentum, moving averages, volatility models like EGARCH) or backtesting. Automatically paginates past Binance's 1000-candle-per-request limit. Caps total candles returned at 2000 per call — if your range would exceed that, the response is truncated and "truncated": true is set; split the request into smaller date ranges if you hit this.

Args:

  • symbol (string, optional): Trading pair, e.g. "BTCUSDT". Defaults to "BTCUSDT".

  • interval (string, optional): Candle size — "1h", "4h", "1d", or "1w". Defaults to "1d".

  • start_date (string, required): Start date, format YYYY-MM-DD. BTCUSDT data begins 2017-08-17.

  • end_date (string, required): End date, format YYYY-MM-DD.

Returns: { "symbol": string, "interval": string, "requested_start": string, "requested_end": string, "candle_count": number, "truncated": boolean, // true if more candles existed than were returned "note": string (optional), // present if truncated or range predates available data "candles": [ { "open_time": string, // ISO 8601 "open": number, "high": number, "low": number, "close": number, "volume": number, "close_time": string, // ISO 8601 "quote_volume": number, "trade_count": number } ] }

Examples:

  • Use when: "get me 5 years of daily BTC prices" -> symbol="BTCUSDT", interval="1d", start_date="2020-01-01", end_date="2025-01-01"

  • Use when: "weekly BTC candles for the last 2 years" -> interval="1w" with an appropriate date range

  • Don't use when: you just need the current price (use binance_get_current_price)

Error Handling:

  • Returns "Error: ..." text if dates are malformed, start is after end, or Binance is rate-limiting.

  • If start_date predates 2017-08-17, the response will include a "note" explaining the series starts later than requested.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolNoTrading pair symbol in Binance format, e.g. "BTCUSDT". Defaults to "BTCUSDT".BTCUSDT
end_dateYesEnd date (inclusive), format YYYY-MM-DD, e.g. "2024-12-31".
intervalNoCandle interval. One of: 1d, 1w, 4h, 1h. Defaults to "1d" (daily), which is what most momentum/volatility backtesting needs.1d
start_dateYesStart date (inclusive), format YYYY-MM-DD, e.g. "2020-01-01". Binance BTCUSDT history begins 2017-08-17; earlier dates return no data.
Behavior5/5

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

Annotations already declare readOnly, openWorld, idempotent, and non-destructive. The description adds major behavioral context: automatic pagination past Binance's 1000-candle limit, a 2000-candle cap with a 'truncated' flag, error handling for malformed dates/rate limits, and behavior for dates before available data. No contradiction with annotations.

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 well-structured with clearly labeled sections (Args, Returns, Examples, Error Handling). Every sentence serves a purpose—pagination, truncation, and error behavior are all disclosed without fluff. Though lengthy, it is information-dense and front-loaded with the core purpose.

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?

With no output schema, the description provides a detailed Returns block showing exact fields and types, plus a note field explanation. It covers edge cases (truncation, pre-2017 data) and error conditions, making invocation reliable. This is unusually complete for a read-only tool.

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 descriptions already cover all four parameters (100% coverage), giving baseline 3. The description adds value through usage examples that map natural language queries to specific parameter values, and offers interval guidance ('1d' for most momentum/volatility backtesting). It also clarifies inclusive dates and data availability, though it largely restates schema info.

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 specific verb and resource: 'Get historical OHLC candles for a crypto trading pair from Binance.' It clearly distinguishes from the sibling tool via the contrast with binance_get_current_price, explicitly stating 'Don't use when: you just need the current price.'

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?

The description provides explicit 'Use when' examples for price series construction and explicitly contrasts with the current-price tool. It also recommends appropriate intervals for backtesting, such as '1d' for momentum/volatility. This goes beyond generic guidance to actionable selection criteria.

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/picjhoe-dev/binance-market-mcp-server'

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