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
GEThttps://deep-index.moralis.io/api/v2.2/pairs/:address/ohlcv

Get the OHLCV candle stick by using pair address

PATH PARAMS
addressstringrequired
The pair address
QUERY PARAMS
chainstring
The chain to query
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://deep-index.moralis.io/api/v2.2/pairs/0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640/ohlcv?chain=eth&timeframe=1h&currency=usd&fromDate=2024-11-25&toDate=2024-11-26', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
Response Example
{
"cursor": "string",
"page": 1,
"pairAddress": "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640",
"tokenAddress": "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640",
"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
}
]
}