跳转到主要内容
GET
/
pnl
/
{wallet}
SDK
import { Client } from '@solana-tracker/data-api';

const client = new Client({ apiKey: 'YOUR_API_KEY' });

const data = await client.getWalletPnL('FbMxP3GVq8TQ36nbYgx4NP9iygMpwAwFWJwW81ioCiSF');
curl --request GET \
--url https://data.solanatracker.io/pnl/{wallet} \
--header 'x-api-key: <api-key>'
import requests

url = "https://data.solanatracker.io/pnl/{wallet}"

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/pnl/{wallet}', 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/pnl/{wallet}",
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/pnl/{wallet}"

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/pnl/{wallet}")
.header("x-api-key", "<api-key>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://data.solanatracker.io/pnl/{wallet}")

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
{
  "tokens": {
    "DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263": {
      "holding": 34587.83040999995,
      "held": 569619.4014500001,
      "sold": 569619.4014500001,
      "sold_usd": 8.848779535217,
      "realized": 4.101715619389,
      "unrealized": -0.698268859628,
      "total": 3.403446759761,
      "total_sold": 8.848779535217,
      "total_invested": 5.919909387386,
      "average_buy_amount": 0.227688822592,
      "current_value": 0.474576611914,
      "cost_basis": 0.000033909195,
      "first_buy_time": 1750435283197,
      "last_buy_time": 1753194281458,
      "last_sell_time": 1754205433802,
      "last_trade_time": 1754205433802,
      "buy_transactions": 26,
      "sell_transactions": 23,
      "total_transactions": 49
    }
  }
}

SDK Example

import { Client } from '@solana-tracker/data-api';

const client = new Client({ apiKey: 'YOUR_API_KEY' });

const data = await client.getWalletPnL('FbMxP3GVq8TQ36nbYgx4NP9iygMpwAwFWJwW81ioCiSF');

授权

x-api-key
string
header
必填

用于鉴权的 API Key

路径参数

wallet
string
必填

查询参数

showHistoricPnL
boolean

附加 1 日、7 日、30 日区间的盈亏(测试版)。

holdingCheck
boolean

额外校验钱包内当前持仓估值。

hideDetails
boolean

仅返回汇总,不包含各代币明细。

响应

200 - application/json

Successful response

tokens
object
summary
object