API ReferenceToken APIGet OHLCV by Pair AddressVersion: 2.2Get OHLCV by Pair AddressNeed a candlestick chart for your website?Embed our free chart widget directly on your site in just a few clicksEmbed ChartGEThttps://solana-gateway.moralis.io/token/:network/pairs/:pairAddress/ohlcvGets the candlesticks for a specific pair addressPATH PARAMSnetworkstringrequiredThe network to querymainnetdevnetpairAddressstringrequiredThe pair addressQUERY PARAMStimeframestringrequiredThe timeframe1s10s30s1min5min10min30min1h4h12h1d1w1McurrencystringrequiredThe currencyusdnativefromDatestringrequiredThe 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.toDatestringrequiredThe 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.limitnumberThe number of results to returncursorstringThe cursor returned in the previous response (used for getting the next page)Responses200 Returns the OHLCV data.objectAPI KEYTest Live APINode.jsPythoncURLGoPHP// Dependencies to install:// $ npm install node-fetch --save// add "type": "module" to package.jsonimport 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¤cy=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));# Dependencies to install:# $ python -m pip install requestsimport requestsurl = "https://solana-gateway.moralis.io/token/mainnet/pairs/83v8iPyZihDEjDdY8RdZddyZNyUtXngz69Lgo9Kt5d6d/ohlcv?timeframe=1h¤cy=usd&fromDate=2024-11-25&toDate=2024-11-26&limit=10"headers = { "Accept": "application/json", "X-API-Key": "YOUR_API_KEY"}response = requests.request("GET", url, headers=headers)print(response.text)curl --request GET \ --url 'https://solana-gateway.moralis.io/token/mainnet/pairs/83v8iPyZihDEjDdY8RdZddyZNyUtXngz69Lgo9Kt5d6d/ohlcv?timeframe=1h¤cy=usd&fromDate=2024-11-25&toDate=2024-11-26&limit=10' \ --header 'accept: application/json' \ --header 'X-API-Key: YOUR_API_KEY' package mainimport ( "fmt" "net/http" "io/ioutil")func main() { url := "https://solana-gateway.moralis.io/token/mainnet/pairs/83v8iPyZihDEjDdY8RdZddyZNyUtXngz69Lgo9Kt5d6d/ohlcv?timeframe=1h¤cy=usd&fromDate=2024-11-25&toDate=2024-11-26&limit=10" req, _ := http.NewRequest("GET", url, payload) req.Header.Add("Accept", "application/json") req.Header.Add("X-API-Key", "YOUR_API_KEY") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := ioutil.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body))}<?php// Dependencies to install:// $ composer require guzzlehttp/guzzlerequire_once('vendor/autoload.php');$client = new \GuzzleHttp\Client();$response = $client->request('GET', 'https://solana-gateway.moralis.io/token/mainnet/pairs/83v8iPyZihDEjDdY8RdZddyZNyUtXngz69Lgo9Kt5d6d/ohlcv?timeframe=1h¤cy=usd&fromDate=2024-11-25&toDate=2024-11-26&limit=10', [ 'headers' => [ 'Accept' => 'application/json', 'X-API-Key' => 'YOUR_API_KEY', ],]);echo $response->getBody();Response Example200 Returns the OHLCV data.{ "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 } ]}