curl --request GET \
--url https://api.zerion.io/v1/wallets/{address}/pnl \
--header 'Authorization: Basic <encoded-value>'import requests
url = "https://api.zerion.io/v1/wallets/{address}/pnl"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('https://api.zerion.io/v1/wallets/{address}/pnl', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.zerion.io/v1/wallets/{address}/pnl"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"links": {
"self": "https://api.zerion.io/v1/wallets/0x42b9df65b219b3dd36ff330a4dd8f327a6ada990/pnl"
},
"data": {
"type": "pnl",
"id": "0x42b9df65b219b3dd36ff330a4dd8f327a6ada990",
"attributes": {
"total_gain": -637.8173517,
"realized_gain": -655.3618983,
"unrealized_gain": 17.5445466,
"relative_total_gain_percentage": -11.38,
"relative_realized_gain_percentage": -15.15,
"relative_unrealized_gain_percentage": -0.19,
"total_fee": 281.9088917,
"total_invested": 701.2,
"realized_cost_basis": 655.36,
"net_invested": 45.84218703,
"received_external": 133971.2931,
"sent_external": 133270.089,
"sent_for_nfts": 133971.2931,
"received_for_nfts": 133971.2931,
"breakdown": {
"by_id": {
"eth": {
"average_buy_price": 1258.8,
"average_sell_price": 1224.96,
"total_gain": -6900.85,
"realized_gain": -6871.21,
"unrealized_gain": -29.64,
"relative_total_gain_percentage": -11.38,
"relative_realized_gain_percentage": -15.15,
"relative_unrealized_gain_percentage": -0.19,
"total_fee": 4679.93,
"total_invested": 60643.33,
"realized_cost_basis": 45363.2,
"net_invested": 15280.13,
"received_external": 35402.73,
"sent_external": 22213.21,
"sent_for_nfts": 1713.23,
"received_for_nfts": 1635.05
}
},
"by_implementation": {
"ethereum:0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48": {
"average_buy_price": 1,
"average_sell_price": 1,
"total_gain": 0,
"realized_gain": 0,
"unrealized_gain": 0,
"relative_total_gain_percentage": 0,
"relative_realized_gain_percentage": 0,
"relative_unrealized_gain_percentage": 0,
"total_fee": 12.5,
"total_invested": 5000,
"realized_cost_basis": 3000,
"net_invested": 2000,
"received_external": 1000,
"sent_external": 500,
"sent_for_nfts": 0,
"received_for_nfts": 0
}
}
}
}
},
"meta": {
"excluded_fungible_ids": [
"4a702a34-5cfd-41af-96ad-bd1c45c3672e"
],
"excluded_fungible_implementations": [
"ethereum:0x6b175474e89094c44da98b954eedeac495271d0f",
"ethereum:"
]
}
}{
"errors": [
{
"title": "Parameter is malformed",
"detail": "Some validation errors will be described here"
}
]
}{
"errors": [
{
"title": "Unauthorized Error",
"detail": "The API key is invalid, please, make sure that you are using a valid key"
}
]
}{
"errors": [
{
"title": "This request is not supported",
"detail": "This request cannot be processed, and retrying will not help. Please contact support if you need it enabled."
}
]
}{
"errors": [
{
"title": "Too many requests",
"detail": "Your request had been throttled"
}
]
}{
"errors": [
{
"title": "Service is temporarily unavailable",
"detail": "Please, retry later (check the Retry-After header)"
}
]
}Get wallet PnL
Realized and unrealized PnL for a wallet, FIFO-based, with net invested and per-asset-category filters.
curl --request GET \
--url https://api.zerion.io/v1/wallets/{address}/pnl \
--header 'Authorization: Basic <encoded-value>'import requests
url = "https://api.zerion.io/v1/wallets/{address}/pnl"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('https://api.zerion.io/v1/wallets/{address}/pnl', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.zerion.io/v1/wallets/{address}/pnl"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"links": {
"self": "https://api.zerion.io/v1/wallets/0x42b9df65b219b3dd36ff330a4dd8f327a6ada990/pnl"
},
"data": {
"type": "pnl",
"id": "0x42b9df65b219b3dd36ff330a4dd8f327a6ada990",
"attributes": {
"total_gain": -637.8173517,
"realized_gain": -655.3618983,
"unrealized_gain": 17.5445466,
"relative_total_gain_percentage": -11.38,
"relative_realized_gain_percentage": -15.15,
"relative_unrealized_gain_percentage": -0.19,
"total_fee": 281.9088917,
"total_invested": 701.2,
"realized_cost_basis": 655.36,
"net_invested": 45.84218703,
"received_external": 133971.2931,
"sent_external": 133270.089,
"sent_for_nfts": 133971.2931,
"received_for_nfts": 133971.2931,
"breakdown": {
"by_id": {
"eth": {
"average_buy_price": 1258.8,
"average_sell_price": 1224.96,
"total_gain": -6900.85,
"realized_gain": -6871.21,
"unrealized_gain": -29.64,
"relative_total_gain_percentage": -11.38,
"relative_realized_gain_percentage": -15.15,
"relative_unrealized_gain_percentage": -0.19,
"total_fee": 4679.93,
"total_invested": 60643.33,
"realized_cost_basis": 45363.2,
"net_invested": 15280.13,
"received_external": 35402.73,
"sent_external": 22213.21,
"sent_for_nfts": 1713.23,
"received_for_nfts": 1635.05
}
},
"by_implementation": {
"ethereum:0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48": {
"average_buy_price": 1,
"average_sell_price": 1,
"total_gain": 0,
"realized_gain": 0,
"unrealized_gain": 0,
"relative_total_gain_percentage": 0,
"relative_realized_gain_percentage": 0,
"relative_unrealized_gain_percentage": 0,
"total_fee": 12.5,
"total_invested": 5000,
"realized_cost_basis": 3000,
"net_invested": 2000,
"received_external": 1000,
"sent_external": 500,
"sent_for_nfts": 0,
"received_for_nfts": 0
}
}
}
}
},
"meta": {
"excluded_fungible_ids": [
"4a702a34-5cfd-41af-96ad-bd1c45c3672e"
],
"excluded_fungible_implementations": [
"ethereum:0x6b175474e89094c44da98b954eedeac495271d0f",
"ethereum:"
]
}
}{
"errors": [
{
"title": "Parameter is malformed",
"detail": "Some validation errors will be described here"
}
]
}{
"errors": [
{
"title": "Unauthorized Error",
"detail": "The API key is invalid, please, make sure that you are using a valid key"
}
]
}{
"errors": [
{
"title": "This request is not supported",
"detail": "This request cannot be processed, and retrying will not help. Please contact support if you need it enabled."
}
]
}{
"errors": [
{
"title": "Too many requests",
"detail": "Your request had been throttled"
}
]
}{
"errors": [
{
"title": "Service is temporarily unavailable",
"detail": "Please, retry later (check the Retry-After header)"
}
]
}Authorizations
Path Parameters
The web3 wallet address. Must be a valid EVM or Solana address. The PnL endpoint additionally requires an address Zerion tracks, and returns 400 otherwise; see that endpoint's description for what that excludes. A wallet address, which can be either an EVM or Solana address
^0x[a-fA-F0-9]{40}$"0x42b9df65b219b3dd36ff330a4dd8f327a6ada990"
Query Parameters
Denominated currency value of returned prices
eth, btc, usd, eur, krw, rub, gbp, aud, cad, inr, jpy, nzd, try, zar, cny, chf Calculate PnL only for specified chains (comma-separated list).
25["ethereum", "polygon"]
Account only for PnL related to given fungible assets (comma-separated list). Maximum of 100 fungible IDs allowed.
When filtering by fungible_ids or fungible_implementations, assets without available prices are automatically excluded from calculations instead of causing an error. Excluded assets are returned in the response metadata for transparency.
10044Account only for PnL related to given fungible asset implementations (comma-separated list of chain:address pairs). Maximum of 100 implementations allowed. example: "base:0xae16c445d8a4082cecb49a9465e4dd5499df947d,ethereum:0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
When filtering by fungible_ids or fungible_implementations, assets without available prices are automatically excluded from calculations instead of causing an error. Excluded assets are returned in the response metadata for transparency.
100Only account sales since the given date.
A unix timestamp in milliseconds.
Note: PnL is pre-computed at standard marks (now, 1 day ago, 1 week ago, 1 month ago, 1 year ago, beginning of the year). Other values are supported only if fewer than 3,000 transactions sit between your timestamp and the nearest mark — otherwise the request errors out.
13"1688842525735"
Only account sales till the given date.
A unix timestamp in milliseconds.
Note: PnL is pre-computed at standard marks (now, 1 day ago, 1 week ago, 1 month ago, 1 year ago, beginning of the year). Other values are supported only if fewer than 3,000 transactions sit between your timestamp and the nearest mark — otherwise the request errors out.
13"1688842525735"
Response
Response for requested wallet's pnl
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Metadata about the PnL calculation (only present when assets were excluded from the calculation). The structure matches the filter type used in the request:
- When filtering by
fungible_ids, the meta contains anexcluded_fungible_idsarray - When filtering by
fungible_implementations, the meta contains anexcluded_fungible_implementationsarray - If both filters are used, both fields may appear in the meta
Show child attributes
Show child attributes
Was this page helpful?