跳轉到主要內容
GET
/
v2
/
token
/
{chain}
/
{tokenAddress}
/
candles
代幣 - K 線
curl --request GET \
  --url https://api.chainstream.io/v2/token/{chain}/{tokenAddress}/candles \
  --header 'Authorization: Bearer <token>'
import requests

url = "https://api.chainstream.io/v2/token/{chain}/{tokenAddress}/candles"

headers = {"Authorization": "Bearer <token>"}

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

print(response.text)
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://api.chainstream.io/v2/token/{chain}/{tokenAddress}/candles', 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://api.chainstream.io/v2/token/{chain}/{tokenAddress}/candles",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);

$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://api.chainstream.io/v2/token/{chain}/{tokenAddress}/candles"

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

req.Header.Add("Authorization", "Bearer <token>")

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

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

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://api.chainstream.io/v2/token/{chain}/{tokenAddress}/candles")
.header("Authorization", "Bearer <token>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.chainstream.io/v2/token/{chain}/{tokenAddress}/candles")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
[
  {
    "close": "51.2",
    "high": "51.8",
    "low": "50.1",
    "open": "50.5",
    "timestamp": 1709251200000,
    "volume": "1000000",
    "trades": 128,
    "volumeInTokenAmount": "42000.5"
  }
]
取得多種解析度(1m、5m、15m、1h、4h、1d)的 OHLCV K 線資料。適用於繪製圖表與技術分析。
相關: GraphQL OHLC | MCP: token_get_candles

授權

Authorization
string
header
必填

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

路徑參數

chain
enum<string>
必填

支援網路列表中的鏈名稱 Supported blockchain chains

可用選項:
sol,
eth,
bsc
tokenAddress
string
必填

代幣地址

查詢參數

resolution
enum<string>
必填

K 線資料的時間粒度 Candle resolution

可用選項:
1s,
15s,
30s,
1m,
3m,
5m,
15m,
30m,
1h,
2h,
4h,
6h,
8h,
12h,
1d,
3d,
1w,
1M
priceType
enum<string>
預設值:usd

價格類型:usd(預設)或原生代幣價格 Price type for candle data

可用選項:
usd,
native
from
integer<int64>

開始時間戳(Unix 秒級時間戳)

to
integer<int64>

結束時間戳(Unix 秒級時間戳)

limit
integer<int64>

回傳的 K 線數量

回應

200 - application/json

取得 K 線

close
string
必填

Close price

範例:

"51.2"

high
string
必填

High price

範例:

"51.8"

low
string
必填

Low price

範例:

"50.1"

open
string
必填

Open price

範例:

"50.5"

timestamp
integer<int64>
必填

Timestamp

範例:

1709251200000

volume
string
必填

Volume in USD or native currency (depending on priceType)

範例:

"1000000"

trades
integer<int64> | null

Number of trades (swaps) in this candle bar

範例:

128

volumeInTokenAmount
string | null

Base token quantity (e.g. number of CAKE or SOL tokens traded)

範例:

"42000.5"