SDK
import { Client } from '@solana-tracker/data-api';
const client = new Client({ apiKey: 'YOUR_API_KEY' });
const data = await client.getWalletChartV2('CN8w8cuh87gZYjhpaPxbD78GTrBmUKmVysqgsC9uYu9i', {
interval: '1d', // Or '1h', up to 90 days.
timeFrom: Math.floor(Date.now() / 1000) - 30 * 86400, // Unix seconds.
includesPositions: true, // Leaves out the older tokens-only points.
});
console.log(data.change['24h'].percent, data.points.at(-1)?.usd);
curl --request GET \
--url https://data.solanatracker.io/v2/wallet/{wallet}/chart \
--header 'x-api-key: <api-key>'import requests
url = "https://data.solanatracker.io/v2/wallet/{wallet}/chart"
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://data.solanatracker.io/v2/wallet/{wallet}/chart', 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://data.solanatracker.io/v2/wallet/{wallet}/chart",
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://data.solanatracker.io/v2/wallet/{wallet}/chart"
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://data.solanatracker.io/v2/wallet/{wallet}/chart")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://data.solanatracker.io/v2/wallet/{wallet}/chart")
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{
"wallet": "CN8w8cuh87gZYjhpaPxbD78GTrBmUKmVysqgsC9uYu9i",
"interval": "1d",
"change": {
"24h": {
"usd": -158.388082,
"percent": -0.13
},
"30d": {
"usd": null,
"percent": null
}
},
"points": [
{
"time": 1787011200000,
"usd": 6923.059,
"sol": 91.06526,
"includesPositions": false,
"changePercent": null
},
{
"time": 1795132800000,
"usd": 122629.863201,
"sol": 1781.128012921,
"includesPositions": true,
"changePercent": null
},
{
"time": 1795219200000,
"usd": 122824.201652,
"sol": 1750.387522537,
"includesPositions": true,
"changePercent": 0.16
},
{
"time": 1795305600000,
"usd": 122665.81357,
"sol": 1778.432891944,
"includesPositions": true,
"changePercent": -0.13
}
]
}{
"error": "Invalid sort. Valid options are: value, amount, change24h"
}{
"error": "<string>"
}{
"error": "Wallet data is temporarily unavailable, please retry"
}Wallet
Solana 钱包净值走势 API
按小时或按天获取 Solana 钱包的净值历史,包含 DeFi 仓位,附带 24 小时和 30 天变化。
GET
/
v2
/
wallet
/
{wallet}
/
chart
SDK
import { Client } from '@solana-tracker/data-api';
const client = new Client({ apiKey: 'YOUR_API_KEY' });
const data = await client.getWalletChartV2('CN8w8cuh87gZYjhpaPxbD78GTrBmUKmVysqgsC9uYu9i', {
interval: '1d', // Or '1h', up to 90 days.
timeFrom: Math.floor(Date.now() / 1000) - 30 * 86400, // Unix seconds.
includesPositions: true, // Leaves out the older tokens-only points.
});
console.log(data.change['24h'].percent, data.points.at(-1)?.usd);
curl --request GET \
--url https://data.solanatracker.io/v2/wallet/{wallet}/chart \
--header 'x-api-key: <api-key>'import requests
url = "https://data.solanatracker.io/v2/wallet/{wallet}/chart"
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://data.solanatracker.io/v2/wallet/{wallet}/chart', 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://data.solanatracker.io/v2/wallet/{wallet}/chart",
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://data.solanatracker.io/v2/wallet/{wallet}/chart"
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://data.solanatracker.io/v2/wallet/{wallet}/chart")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://data.solanatracker.io/v2/wallet/{wallet}/chart")
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{
"wallet": "CN8w8cuh87gZYjhpaPxbD78GTrBmUKmVysqgsC9uYu9i",
"interval": "1d",
"change": {
"24h": {
"usd": -158.388082,
"percent": -0.13
},
"30d": {
"usd": null,
"percent": null
}
},
"points": [
{
"time": 1787011200000,
"usd": 6923.059,
"sol": 91.06526,
"includesPositions": false,
"changePercent": null
},
{
"time": 1795132800000,
"usd": 122629.863201,
"sol": 1781.128012921,
"includesPositions": true,
"changePercent": null
},
{
"time": 1795219200000,
"usd": 122824.201652,
"sol": 1750.387522537,
"includesPositions": true,
"changePercent": 0.16
},
{
"time": 1795305600000,
"usd": 122665.81357,
"sol": 1778.432891944,
"includesPositions": true,
"changePercent": -0.13
}
]
}{
"error": "Invalid sort. Valid options are: value, amount, change24h"
}{
"error": "<string>"
}{
"error": "Wallet data is temporarily unavailable, please retry"
}钱包的净值走势,以 USD 和 SOL 计。每个点是该小时或该天(UTC)结束时的净值。
- 通过 Wallet V2 请求过的钱包会记录净值,并在最后一次请求后继续记录 30 天。请求一个尚未记录的钱包会开始记录它。
- 钱包开始记录之前的点只计入代币,不含 DeFi 仓位,
includesPositions为false。传入includesPositions=true可排除这些点。 changePercent是相对前一个点的变化。在从仅含代币的点切换到完整点的位置为null。change将最新的点与 24 小时前和 30 天前比较。30 天变化需要超过 30 天的时间范围。
time 为 Unix 毫秒;time_from 和 time_to 为 Unix 秒。
SDK Example
import { Client } from '@solana-tracker/data-api';
const client = new Client({ apiKey: 'YOUR_API_KEY' });
const data = await client.getWalletChartV2('CN8w8cuh87gZYjhpaPxbD78GTrBmUKmVysqgsC9uYu9i', {
interval: '1d', // Or '1h', up to 90 days.
timeFrom: Math.floor(Date.now() / 1000) - 30 * 86400, // Unix seconds.
includesPositions: true, // Leaves out the older tokens-only points.
});
console.log(data.change['24h'].percent, data.points.at(-1)?.usd);
查询参数
响应
钱包的净值历史。
此页面对您有帮助吗?