Wallet - PnL Details
Get per-token PnL breakdown for a wallet
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="
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
A chain name listed in supported networks Supported blockchain chains
sol, eth, bsc An address of a wallet
Query Parameters
Pagination cursor
Number of results per page
Pagination direction
next, prev Time resolution for PnL aggregation PnL resolution period
1d, 7d, 30d, all Filter by position state (open or closed) Filter for PnL position state
open, all, closed Sort field for PnL detail results Sort field for PnL details query
totalPnl, realizedPnl, unrealizedPnl Response
Successful response
Full PnL details result with cursor pagination.
List of per-token PnL details
Show child attributes
Show child attributes
Aggregated PnL summary
Show child attributes
Show child attributes
Cursor for the end of current page
"eyJpZCI6ImVuZCJ9"
Whether there is a next page
false
Whether there is a previous page
false
Cursor for the start of current page
"eyJpZCI6InN0YXJ0In0="
Was this page helpful?
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="
}
