Skip to main content
GET
/
token
/
{network}
/
pairs
/
{address}
/
ohlcv
Get candlesticks for a pair address
curl --request GET \
  --url https://solana-gateway.moralis.io/token/{network}/pairs/{address}/ohlcv \
  --header 'X-Api-Key: <api-key>'
import requests

url = "https://solana-gateway.moralis.io/token/{network}/pairs/{address}/ohlcv"

headers = {"X-Api-Key": "<api-key>"}

response = requests.get(url, headers=headers)

print(response.text)
const options = {method: 'GET', headers: {'X-Api-Key': '<api-key>'}};

fetch('https://solana-gateway.moralis.io/token/{network}/pairs/{address}/ohlcv', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://solana-gateway.moralis.io/token/{network}/pairs/{address}/ohlcv",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-Api-Key: <api-key>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"net/http"
"io"
)

func main() {

url := "https://solana-gateway.moralis.io/token/{network}/pairs/{address}/ohlcv"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("X-Api-Key", "<api-key>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://solana-gateway.moralis.io/token/{network}/pairs/{address}/ohlcv")
.header("X-Api-Key", "<api-key>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://solana-gateway.moralis.io/token/{network}/pairs/{address}/ohlcv")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["X-Api-Key"] = '<api-key>'

response = http.request(request)
puts response.read_body
{
  "page": 123,
  "pairAddress": "<string>",
  "tokenAddress": "<string>",
  "timeframe": "1min",
  "currency": "usd",
  "cursor": "<string>",
  "result": [
    {
      "timestamp": "<string>",
      "open": 123,
      "close": 123,
      "high": 123,
      "low": 123,
      "volume": 123,
      "trades": 123
    }
  ]
}

Authorizations

X-Api-Key
string
header
required

Path Parameters

network
enum<string>
required

The network to query

Available options:
mainnet,
devnet
address
string
required

The address to query

Example:

"So11111111111111111111111111111111111111112"

Query Parameters

cursor
string

The cursor to the next page

fromDate
string
default:2024-10-09
required

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

toDate
string
default:2024-10-10
required

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

timeframe
enum<string>
default:1min
required

The interval of the candle stick

Available options:
1s,
10s,
30s,
1min,
5min,
10min,
30min,
1h,
4h,
12h,
1d,
1w,
1M
currency
enum<string>
default:usd
required

The currency format

Available options:
usd,
native
limit
number
default:100

The limit per page

Required range: 1 <= x <= 1000

Response

200 - application/json
page
number
required

The page number

pairAddress
string
required

The pair address

tokenAddress
string | null
required

The token address

timeframe
enum<string>
default:1min
required

The interval of the candle stick

Available options:
1s,
10s,
30s,
1min,
5min,
10min,
30min,
1h,
4h,
12h,
1d,
1w,
1M
currency
enum<string>
default:usd
required

The currency format

Available options:
usd,
native
cursor
string | null

The cursor to the next page

result
object[]

An array of candlesticks