Skip to main content

Don't have an API key yet?

Sign-up to Moralis to get your free API key and start building today.

Get Your Free API Key
Version: 2.2

Get OHLCV by Pair Address

Need a candlestick chart for your website?

Embed our free chart widget directly on your site in just a few clicks

Embed Chart
Ethereum Logo

Looking for OHLCV data on EVM?

Access OHLCV data by pair address on EVM using our API.

Explore EVM API
GEThttps://solana-gateway.moralis.io/token/:network/pairs/:pairAddress/ohlcv

Gets the candlesticks for a specific pair address

PATH PARAMS
networkstringrequired
The network to query
pairAddressstringrequired
The pair address
QUERY PARAMS
timeframestringrequired
The timeframe
currencystringrequired
The currency
fromDatestringrequired

The starting date (format in seconds or datestring accepted by momentjs)

  • Provide the param 'fromBlock' or 'fromDate'
  • If 'fromDate' and 'fromBlock' are provided, 'fromBlock' will be used.
toDatestringrequired

The ending date (format in seconds or datestring accepted by momentjs)

  • Provide the param 'toBlock' or 'toDate'
  • If 'toDate' and 'toBlock' are provided, 'toBlock' will be used.
limitnumber
The number of results to return
cursorstring
The cursor returned in the previous response (used for getting the next page)
Responses
API KEY
// Dependencies to install:
// $ npm install node-fetch --save
// add "type": "module" to package.json

import fetch from 'node-fetch';

const options = {
method: 'GET',
headers: {
accept: 'application/json',
'X-API-Key': 'YOUR_API_KEY'
},
};

fetch('https://solana-gateway.moralis.io/token/mainnet/pairs/83v8iPyZihDEjDdY8RdZddyZNyUtXngz69Lgo9Kt5d6d/ohlcv?timeframe=1h&currency=usd&fromDate=2024-11-25&toDate=2024-11-26&limit=10', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
Response Example
{
"cursor": "string",
"page": 1,
"pairAddress": "879F697iuDJGMevRkRcnW21fcXiAeLJK1ffsw2ATebce",
"tokenAddress": "MEW1gQWJ3nEXg2qgERiKu7FAFj79PHvQVREQUzScPP5",
"timeframe": "1h",
"currency": "usd",
"result": [
{
"timestamp": "2024-02-14T00:00:00.000Z",
"open": 253.82,
"high": 255.14,
"low": 252.91,
"close": 253.95,
"volume": 23544.27541795,
"swaps": 48
}
]
}