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
}
}
}PnL
Deprecated: Get Wallet PnL
deprecated
已弃用。请改用 PnL V2:GET /v2/pnl/wallets/{wallet} 获取钱包汇总,GET /v2/pnl/wallets/{wallet}/positions 获取各代币仓位。
原接口:返回钱包全部仓位的盈亏数据。
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');
此页面对您有帮助吗?
⌘I