Przejdź do głównej treści

Candle (OHLCV) tool reference

This page is the tool reference for** retrieving candle (OHLCV) data from the Cryptohopper Market Data MCP**.

Tool name

get_candles

Purpose

Returns a series of OHLCV (Open, High, Low, Close, Volume) candles for a specified pair on a specified exchange at a specified timeframe. Supports current (real-time) candles on all tiers and historical candles on Explorer, Adventurer, and Hero.

Arguments

ArgumentTypeRequiredDescription
exchangestringYesExchange identifier (lowercase). See supported exchanges.
pairstringYesPair in BASE/QUOTE format.
timeframestringYesBar size. See supported timeframes below.
limitintegerNoNumber of candles to return. Default and maximum are tier-dependent.
sincestring (ISO-8601)NoStart time for historical queries. If omitted, returns the most recent limit bars.

Either limit alone (recent bars) or since + limit (historical range) may be used. limit alone is the common case.

Supported timeframes

ValueDuration
1m1 minute
5m5 minutes
15m15 minutes
1h1 hour
4h4 hours
1d1 day

Weekly, monthly, and other timeframe aliases are not supported and will be rejected. Not every supported timeframe is available on every exchange. Unsupported combinations return TIMEFRAME_NOT_SUPPORTED.

Response schema

{
"exchange": "binance",
"pair": "BTC/USDT",
"timeframe": "1h",
"candles": [
[1778540400000, 80214.00, 80820.50, 80120.00, 80651.42, 412.85, 318],
[1778544000000, 80651.42, 80936.22, 80590.00, 80934.19, 298.12, 274]
]
}

Top-level fields

FieldTypeDescription
exchangestringThe exchange identifier the data came from.
pairstringThe pair, in BASE/QUOTE format.
timeframestringThe bar size (e.g. 1h).
candlesarrayArray of OHLCV records, ordered chronologically (oldest first). Each record is itself an array of seven positions.

Candle record fields

Each candle is an array with the following positions:

IndexFieldTypeDescription
0timestampnumberOpen time of the bar (Unix timestamp in milliseconds).
1opennumberFirst traded price in the bar.
2highnumberHighest traded price in the bar.
3lownumberLowest traded price in the bar.
4closenumberLast traded price in the bar (or current price, for an open bar).
5volumenumberBase-asset volume traded in the bar.
6countnumberNumber of trades in the bar.

Prices and volume are returned as JSON numbers. Clients that require exact precision should convert them to a decimal type immediately after parsing. See data model.

Ordering

Candles are returned in chronological order — the oldest bar first, the most recent bar last. This matches what most indicator libraries expect as input.

Open vs. closed bars

The last element of the candles array is typically the current, open bar — the bar whose time window has not yet completed. Its close value reflects the current price, not a finalised close. All earlier bars are closed and immutable.

Applications performing indicator calculations (RSI, MACD, moving averages) should typically operate on closed bars only, ignoring the last element. Using the open bar introduces look-ahead noise that can destabilise signals.

Cost

ScenarioCost on PioneerCost on Explorer/AdventurerCost on Hero
Current bar only (real-time)111
Short-history lookbackN/A
Long-history lookbackN/A20×

The boundary between "short" and "long" lookback is tier-specific. See rate limits explained for the exact cost matrix and guidance on staying efficient.

Tier access for historical data

TierHistorical lookback
PioneerNot available — current bar only
ExplorerUp to 90 days
AdventurerUp to 365 days
HeroUp to 3 years

Requests exceeding the tier's maximum history return HISTORY_LIMIT_EXCEEDED.

Lookback guidance

Most analyses require far fewer candles than users intuitively request. Suggested lookbacks:

IndicatorMinimum barsComfortable
RSI(14)14100
MACD(12, 26, 9)35100
Moving average (N-period)NN + 50
Bollinger Bands (20, 2?)20100
ATR(14)14100

Pulling more bars than necessary inflates cost (historical queries on Explorer/Adventurer can cost up to 20× a baseline call) without improving the indicator's quality.

Example invocations

Recent bars

Prompted in an MCP client:

Pull the last 100 1-hour candles for ETH/USDT on Binance.

The agent invokes get_candles(exchange="binance", pair="ETH/USDT", timeframe="1h", limit=100).

Historical range

Pull daily candles for BTC/USDT on Binance from 2026-01-01 onwards.

The agent invokes get_candles(exchange="binance", pair="BTC/USDT", timeframe="1d", since="2026-01-01T00:00:00Z", limit=120).

Multi-timeframe

Pull 1h and 4h candles for SOL/USDT on Binance, last 100 each. Compute RSI on both timeframes.

The agent invokes get_candles twice with different timeframe values. The RSI calculation happens in the model's reasoning, not in a tool call.

Errors

Error codeCause
UNAUTHORIZEDAPI key invalid or revoked.
EXCHANGE_NOT_SUPPORTEDExchange not available on the active tier.
PAIR_NOT_FOUNDPair does not exist on the specified exchange.
TIMEFRAME_NOT_SUPPORTEDRequested timeframe is not supported for this pair/exchange.
HISTORY_LIMIT_EXCEEDEDRequested lookback exceeds the tier's maximum history.
INVALID_PARAMETERArgument failed validation (e.g. limit out of range, unrecognised timeframe alias).
EXCHANGE_UNAVAILABLEUpstream exchange not responding.
DATA_UNAVAILABLERequested candles are not available from the upstream exchange for this range.
RATE_LIMIT_EXCEEDEDShort-interval rate limit hit.
QUOTA_EXCEEDEDWeekly quota reached.

Czy ten artykuł był pomocny?

Zacznij handlować z Cryptohopper za darmo!

Darmowe użytkowanie – nie wymagana karta kredytowa

Let's get started
Nowe aplikacje wkrótce!