跳轉到主要內容
GET
/
v2
/
wallet
/
{chain}
/
{walletAddress}
/
pnl-details
錢包 - 盈虧明細
curl --request GET \
  --url https://api.chainstream.io/v2/wallet/{chain}/{walletAddress}/pnl-details \
  --header 'Authorization: Bearer <token>'
import requests

url = "https://api.chainstream.io/v2/wallet/{chain}/{walletAddress}/pnl-details"

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

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/wallet/{chain}/{walletAddress}/pnl-details")
.header("Authorization", "Bearer <token>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.chainstream.io/v2/wallet/{chain}/{walletAddress}/pnl-details")

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
{
  "data": [
    {
      "avgBuyPriceInUsd": "0.00003324391014165111",
      "avgProfitPerTradeInUsd": "3206068.5728287027967835484926836364",
      "avgSellPriceInUsd": "0.00003185807445122603",
      "balance": "1254982158.7106050000000000",
      "buyAmount": "1457986404.2130240000000000",
      "buyAmountInUsd": "48469.1690094067802589",
      "buys": "275",
      "currentValue": "1062513957.429816153652557077014",
      "isClosed": true,
      "priceInUsd": "0.8466367032033868",
      "realizedProfitInUsd": "67.1297848453256596",
      "realizedProfitRatio": "0.00138499970635554473",
      "sellAmount": "203004245.5024190000000000",
      "sellAmountInUsd": "6467.3243671310312402",
      "sells": "110",
      "tokenAddress": "4MbgMQGvXBWyxKsTfrvkcRgh5FNLg1VxLnzWqbsdPh7p",
      "totalProfitInUsd": "1234336400.539050576761666169683200000000",
      "totalProfitRatio": "25466.423827061972608618047859693225",
      "totalTrades": "385",
      "unrealizedProfitInUsd": "1234336333.409265731436006569683200000000",
      "unrealizedProfitRatio": "25466.422442062266253073315832775971",
      "walletAddress": "54Pz1e35z9uoFdnxtzjp7xZQoFiofqhdayQWBMN7dsuy",
      "decimals": 6,
      "firstBuyAt": 123,
      "lastSellAt": 123,
      "logoUri": "https://s1.chainstream.io/tokens/images/example.webp",
      "losses": "5",
      "name": "The Real World",
      "symbol": "TRW",
      "totalCostInUsd": "48469.17",
      "transferInAmountInUsd": "150.00",
      "transferInCount": "3",
      "transferOutAmountInUsd": "29.40",
      "transferOutCount": "1",
      "wins": "12"
    }
  ],
  "summary": {
    "avgProfitPerTradeInUsd": "3206068.5728287027967835484926836364",
    "buyAmountInUsd": "48469.1690094067802589",
    "buys": "275",
    "currentValue": "1062513957.429816153652557077014",
    "losses": "69",
    "realizedProfitInUsd": "67.1297848453256596",
    "realizedProfitRatio": "0.0013849997063555447320269173",
    "sellAmountInUsd": "6467.3243671310312402",
    "sells": "110",
    "tokens": "1",
    "totalCostInUsd": "48469.1690094067802589",
    "totalProfitInUsd": "1234336400.5390505767616661696832",
    "totalTrades": "385",
    "unrealizedProfitInUsd": "1234336333.4092657314360065696832",
    "winRate": "0.5688",
    "wins": "91",
    "transferInAmountInUsd": "350.00",
    "transferInCount": "5",
    "transferOutAmountInUsd": "29.40",
    "transferOutCount": "2"
  },
  "endCursor": "eyJpZCI6ImVuZCJ9",
  "hasNext": false,
  "hasPrev": false,
  "startCursor": "eyJpZCI6InN0YXJ0In0="
}

授權

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
walletAddress
string
必填

錢包地址

查詢參數

cursor
string

分頁游標

limit
integer<int64>
預設值:20

每頁回傳結果數量

direction
enum<string>
預設值:next

分頁方向(next 或 prev) Pagination direction

可用選項:
next,
prev
resolution
enum<string>
必填

盈虧聚合的時間粒度 PnL resolution period

可用選項:
1d,
7d,
30d,
all
positionState
enum<string>

依持倉狀態篩選(持倉中或已平倉) Filter for PnL position state

可用選項:
open,
all,
closed
sortBy
enum<string>

盈虧明細結果的排序欄位 Sort field for PnL details query

可用選項:
totalPnl,
realizedPnl,
unrealizedPnl

回應

200 - application/json

成功回應

Full PnL details result with cursor pagination.

data
object[]
必填

按代幣分類的盈虧明細列表

summary
object
必填

彙總盈虧摘要

endCursor
string | null

目前頁結束游標

範例:

"eyJpZCI6ImVuZCJ9"

hasNext
boolean

是否有下一頁

範例:

false

hasPrev
boolean

是否有上一頁

範例:

false

startCursor
string | null

目前頁起始游標

範例:

"eyJpZCI6InN0YXJ0In0="