SDK
import { Client } from '@solana-tracker/data-api';
const client = new Client({ apiKey: 'YOUR_API_KEY' });
const data = await client.getWalletPositionsV2('CN8w8cuh87gZYjhpaPxbD78GTrBmUKmVysqgsC9uYu9i', {
category: 'lending', // Or liquidity, staking, leverage, orders, rewards, other.
// platform: 'kamino', // An id from client.getPortfolioPlatformsV2().
limit: 50,
});
for (const position of data.positions) {
console.log(position.name, position.usd, position.apy, position.healthPercent, position.claimableUsd);
}
// client.iterateWalletPositionsV2() walks every page.
curl --request GET \
--url https://data.solanatracker.io/v2/wallet/{wallet}/positions \
--header 'x-api-key: <api-key>'import requests
url = "https://data.solanatracker.io/v2/wallet/{wallet}/positions"
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}/positions', 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}/positions",
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}/positions"
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}/positions")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://data.solanatracker.io/v2/wallet/{wallet}/positions")
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",
"slot": 475880664,
"updatedAt": 1796067128569,
"positions": [
{
"id": "kamino-vault-LnBhqBJEA4T8JpTSZBrWTFCL4Qa6nWJ6H72ukHkE729",
"platform": "kamino",
"service": "vault",
"category": "liquidity",
"name": "Kamino Vault",
"address": "LnBhqBJEA4T8JpTSZBrWTFCL4Qa6nWJ6H72ukHkE729",
"usd": 26010.10554,
"apy": 8.77,
"yearlyUsd": 2280.462624,
"claimableUsd": 83.651952,
"healthPercent": null,
"inRange": null,
"assets": [
{
"mint": "2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo",
"role": "supplied",
"amount": 26005.642935,
"priceUsd": 1.0001716013994661,
"usd": 26010.10554,
"apy": null,
"yearlyUsd": null
}
],
"claimable": [
{
"mint": "2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo",
"amount": 83.6376,
"priceUsd": 1.0001716013994661,
"usd": 83.651952
}
],
"image": "https://image.solanatracker.io/proxy?url=https%3A%2F%2Fplatform-images.solanatracker.io%2Fkamino.webp"
},
{
"id": "kamino-vault-ADietbkvGfEL5gYFzQN6wzazp4f221tEhZRPUGPck2Sy",
"platform": "kamino",
"service": "vault",
"category": "liquidity",
"name": "Kamino Vault",
"address": "ADietbkvGfEL5gYFzQN6wzazp4f221tEhZRPUGPck2Sy",
"usd": 21154.671999,
"apy": 8,
"yearlyUsd": 1693.263872,
"claimableUsd": 0,
"healthPercent": null,
"inRange": null,
"assets": [
{
"mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"role": "supplied",
"amount": 21154.671999,
"priceUsd": 1,
"usd": 21154.671999,
"apy": null,
"yearlyUsd": null
}
],
"claimable": [],
"image": "https://image.solanatracker.io/proxy?url=https%3A%2F%2Fplatform-images.solanatracker.io%2Fkamino.webp"
}
],
"tokens": {
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v": {
"name": "USD Coin",
"symbol": "USDC",
"decimals": 6,
"image": "https://image.solanatracker.io/proxy?url=https://static.datapi.jup.ag/token-icons/6c4e5669d2a438653105399865445682e4a6cb51e19e1e61dc97578cd27bb9b2.webp",
"supply": 8121434516.222706,
"uri": null,
"description": null,
"creator": null,
"createdOn": null,
"twitter": "https://twitter.com/circle",
"telegram": null,
"website": "https://www.circle.com/en/usdc"
},
"2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo": {
"name": "PayPal USD",
"symbol": "PYUSD",
"decimals": 6,
"image": "https://image.solanatracker.io/proxy?url=https://static.datapi.jup.ag/token-icons/0817b3345e648b1663385bac48eb086877635ee27639c3d5da2a4d9dfd8603b1.webp",
"supply": 688682738.280124,
"uri": "https://token-metadata.paxos.com/pyusd_metadata/prod/solana/pyusd_metadata.json",
"description": "PayPal USD is designed to contribute to the opportunity stablecoins offer for payments and is 100% backed by U.S. dollar deposits, short-term U.S Treasuries and similar cash equivalents. PayPal USD is redeemable 1:1 for U.S. dollars and is issued by Paxos Trust Company.",
"creator": null,
"createdOn": null,
"twitter": null,
"telegram": null,
"website": null
}
},
"nextCursor": "eyJ2IjoyLCJhdCI6MTc5NjA2NzEyODU2OSwicyI6MjExNTQuNjcxOTk5LCJ0Ijoia2FtaW5vLXZhdWx0LUFEaWV0Ymt2R2ZFTDVnWUZ6UU42d3phenA0ZjIyMXRFaFpSUFVHUGNrMlN5IiwicSI6InB8ZHx8In0",
"hasNextPage": true
}{
"error": "Invalid sort. Valid options are: value, amount, change24h"
}{
"error": "<string>"
}{
"error": "Wallet data is temporarily unavailable, please retry"
}Wallet
Solana 钱包 DeFi 仓位 API
获取 Solana 钱包在借贷、流动性、质押、杠杆和挂单上的 DeFi 仓位,附带价值、APY、健康度和可领取奖励。
GET
/
v2
/
wallet
/
{wallet}
/
positions
SDK
import { Client } from '@solana-tracker/data-api';
const client = new Client({ apiKey: 'YOUR_API_KEY' });
const data = await client.getWalletPositionsV2('CN8w8cuh87gZYjhpaPxbD78GTrBmUKmVysqgsC9uYu9i', {
category: 'lending', // Or liquidity, staking, leverage, orders, rewards, other.
// platform: 'kamino', // An id from client.getPortfolioPlatformsV2().
limit: 50,
});
for (const position of data.positions) {
console.log(position.name, position.usd, position.apy, position.healthPercent, position.claimableUsd);
}
// client.iterateWalletPositionsV2() walks every page.
curl --request GET \
--url https://data.solanatracker.io/v2/wallet/{wallet}/positions \
--header 'x-api-key: <api-key>'import requests
url = "https://data.solanatracker.io/v2/wallet/{wallet}/positions"
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}/positions', 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}/positions",
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}/positions"
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}/positions")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://data.solanatracker.io/v2/wallet/{wallet}/positions")
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",
"slot": 475880664,
"updatedAt": 1796067128569,
"positions": [
{
"id": "kamino-vault-LnBhqBJEA4T8JpTSZBrWTFCL4Qa6nWJ6H72ukHkE729",
"platform": "kamino",
"service": "vault",
"category": "liquidity",
"name": "Kamino Vault",
"address": "LnBhqBJEA4T8JpTSZBrWTFCL4Qa6nWJ6H72ukHkE729",
"usd": 26010.10554,
"apy": 8.77,
"yearlyUsd": 2280.462624,
"claimableUsd": 83.651952,
"healthPercent": null,
"inRange": null,
"assets": [
{
"mint": "2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo",
"role": "supplied",
"amount": 26005.642935,
"priceUsd": 1.0001716013994661,
"usd": 26010.10554,
"apy": null,
"yearlyUsd": null
}
],
"claimable": [
{
"mint": "2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo",
"amount": 83.6376,
"priceUsd": 1.0001716013994661,
"usd": 83.651952
}
],
"image": "https://image.solanatracker.io/proxy?url=https%3A%2F%2Fplatform-images.solanatracker.io%2Fkamino.webp"
},
{
"id": "kamino-vault-ADietbkvGfEL5gYFzQN6wzazp4f221tEhZRPUGPck2Sy",
"platform": "kamino",
"service": "vault",
"category": "liquidity",
"name": "Kamino Vault",
"address": "ADietbkvGfEL5gYFzQN6wzazp4f221tEhZRPUGPck2Sy",
"usd": 21154.671999,
"apy": 8,
"yearlyUsd": 1693.263872,
"claimableUsd": 0,
"healthPercent": null,
"inRange": null,
"assets": [
{
"mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"role": "supplied",
"amount": 21154.671999,
"priceUsd": 1,
"usd": 21154.671999,
"apy": null,
"yearlyUsd": null
}
],
"claimable": [],
"image": "https://image.solanatracker.io/proxy?url=https%3A%2F%2Fplatform-images.solanatracker.io%2Fkamino.webp"
}
],
"tokens": {
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v": {
"name": "USD Coin",
"symbol": "USDC",
"decimals": 6,
"image": "https://image.solanatracker.io/proxy?url=https://static.datapi.jup.ag/token-icons/6c4e5669d2a438653105399865445682e4a6cb51e19e1e61dc97578cd27bb9b2.webp",
"supply": 8121434516.222706,
"uri": null,
"description": null,
"creator": null,
"createdOn": null,
"twitter": "https://twitter.com/circle",
"telegram": null,
"website": "https://www.circle.com/en/usdc"
},
"2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo": {
"name": "PayPal USD",
"symbol": "PYUSD",
"decimals": 6,
"image": "https://image.solanatracker.io/proxy?url=https://static.datapi.jup.ag/token-icons/0817b3345e648b1663385bac48eb086877635ee27639c3d5da2a4d9dfd8603b1.webp",
"supply": 688682738.280124,
"uri": "https://token-metadata.paxos.com/pyusd_metadata/prod/solana/pyusd_metadata.json",
"description": "PayPal USD is designed to contribute to the opportunity stablecoins offer for payments and is 100% backed by U.S. dollar deposits, short-term U.S Treasuries and similar cash equivalents. PayPal USD is redeemable 1:1 for U.S. dollars and is issued by Paxos Trust Company.",
"creator": null,
"createdOn": null,
"twitter": null,
"telegram": null,
"website": null
}
},
"nextCursor": "eyJ2IjoyLCJhdCI6MTc5NjA2NzEyODU2OSwicyI6MjExNTQuNjcxOTk5LCJ0Ijoia2FtaW5vLXZhdWx0LUFEaWV0Ymt2R2ZFTDVnWUZ6UU42d3phenA0ZjIyMXRFaFpSUFVHUGNrMlN5IiwicSI6InB8ZHx8In0",
"hasNextPage": true
}{
"error": "Invalid sort. Valid options are: value, amount, change24h"
}{
"error": "<string>"
}{
"error": "Wallet data is temporarily unavailable, please retry"
}钱包的 DeFi 仓位,按价值从大到小排列。可按
platform 或 category 筛选。
每个仓位包含:
assets:仓位中的代币及其角色(supplied、borrowed、liquidity或staked)、数量、价格和价值。借入代币的usd为负数,因此各代币之和等于仓位的usd。apy和yearlyUsd:按当前利率,仓位一年能赚多少,已扣除借款成本。杠杆仓位的apy可能是很大的负数。healthPercent(借款仓位):100 表示没有债务,0 表示清算。inRange(集中流动性):当前价格是否在仓位区间内。claimable:现在就能领取的奖励和手续费,价值见claimableUsd,不计入usd。
id 在仓位存续期间保持不变。代币名称、符号和 logo 在 tokens 中。
想查看按代币的交易盈亏?请使用 PnL V2 中的 Get Wallet Positions。
分页。 将 nextCursor 作为 cursor 传入,直到 hasNextPage 为 false,并保持筛选条件和 sortDirection 不变。
SDK Example
import { Client } from '@solana-tracker/data-api';
const client = new Client({ apiKey: 'YOUR_API_KEY' });
const data = await client.getWalletPositionsV2('CN8w8cuh87gZYjhpaPxbD78GTrBmUKmVysqgsC9uYu9i', {
category: 'lending', // Or liquidity, staking, leverage, orders, rewards, other.
// platform: 'kamino', // An id from client.getPortfolioPlatformsV2().
limit: 50,
});
for (const position of data.positions) {
console.log(position.name, position.usd, position.apy, position.healthPercent, position.claimableUsd);
}
// client.iterateWalletPositionsV2() walks every page.
查询参数
只返回该平台的仓位。使用 Get Portfolio Platforms 中的 id。
示例:
"kamino"
响应
一页钱包 DeFi 仓位。
此页面对您有帮助吗?