Get Pnl By Token With Historical Breakdown
curl --request POST \
--url https://api.allium.so/api/v1/developer/wallet/pnl-by-token/history \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"addresses": [
{
"address": "125Z6k4ZAxsgdG7JxrKZpwbcS1rxqpAeqM9GSCKd66Wp",
"chain": "solana",
"token_address": "So11111111111111111111111111111111111111112"
}
],
"end_timestamp": "2025-04-10T00:00:00Z",
"granularity": "1h",
"start_timestamp": "2025-04-01T00:00:00Z"
}
'import requests
url = "https://api.allium.so/api/v1/developer/wallet/pnl-by-token/history"
payload = {
"addresses": [
{
"address": "125Z6k4ZAxsgdG7JxrKZpwbcS1rxqpAeqM9GSCKd66Wp",
"chain": "solana",
"token_address": "So11111111111111111111111111111111111111112"
}
],
"end_timestamp": "2025-04-10T00:00:00Z",
"granularity": "1h",
"start_timestamp": "2025-04-01T00:00:00Z"
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
addresses: [
{
address: '125Z6k4ZAxsgdG7JxrKZpwbcS1rxqpAeqM9GSCKd66Wp',
chain: 'solana',
token_address: 'So11111111111111111111111111111111111111112'
}
],
end_timestamp: '2025-04-10T00:00:00Z',
granularity: '1h',
start_timestamp: '2025-04-01T00:00:00Z'
})
};
fetch('https://api.allium.so/api/v1/developer/wallet/pnl-by-token/history', 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.allium.so/api/v1/developer/wallet/pnl-by-token/history",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'addresses' => [
[
'address' => '125Z6k4ZAxsgdG7JxrKZpwbcS1rxqpAeqM9GSCKd66Wp',
'chain' => 'solana',
'token_address' => 'So11111111111111111111111111111111111111112'
]
],
'end_timestamp' => '2025-04-10T00:00:00Z',
'granularity' => '1h',
'start_timestamp' => '2025-04-01T00:00:00Z'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.allium.so/api/v1/developer/wallet/pnl-by-token/history"
payload := strings.NewReader("{\n \"addresses\": [\n {\n \"address\": \"125Z6k4ZAxsgdG7JxrKZpwbcS1rxqpAeqM9GSCKd66Wp\",\n \"chain\": \"solana\",\n \"token_address\": \"So11111111111111111111111111111111111111112\"\n }\n ],\n \"end_timestamp\": \"2025-04-10T00:00:00Z\",\n \"granularity\": \"1h\",\n \"start_timestamp\": \"2025-04-01T00:00:00Z\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.allium.so/api/v1/developer/wallet/pnl-by-token/history")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"addresses\": [\n {\n \"address\": \"125Z6k4ZAxsgdG7JxrKZpwbcS1rxqpAeqM9GSCKd66Wp\",\n \"chain\": \"solana\",\n \"token_address\": \"So11111111111111111111111111111111111111112\"\n }\n ],\n \"end_timestamp\": \"2025-04-10T00:00:00Z\",\n \"granularity\": \"1h\",\n \"start_timestamp\": \"2025-04-01T00:00:00Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.allium.so/api/v1/developer/wallet/pnl-by-token/history")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"addresses\": [\n {\n \"address\": \"125Z6k4ZAxsgdG7JxrKZpwbcS1rxqpAeqM9GSCKd66Wp\",\n \"chain\": \"solana\",\n \"token_address\": \"So11111111111111111111111111111111111111112\"\n }\n ],\n \"end_timestamp\": \"2025-04-10T00:00:00Z\",\n \"granularity\": \"1h\",\n \"start_timestamp\": \"2025-04-01T00:00:00Z\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"chain": "<string>",
"address": "<string>",
"token_address": "<string>",
"pnl": [
{
"timestamp": "2023-11-07T05:31:56Z",
"unrealized_pnl": {
"amount": "<string>",
"currency": "USD"
},
"realized_pnl": {
"amount": "<string>",
"currency": "USD"
}
}
]
},
"items": [
{
"chain": "<string>",
"address": "<string>",
"token_address": "<string>",
"pnl": [
{
"timestamp": "2023-11-07T05:31:56Z",
"unrealized_pnl": {
"amount": "<string>",
"currency": "USD"
},
"realized_pnl": {
"amount": "<string>",
"currency": "USD"
}
}
]
}
],
"error": "<string>",
"cursor": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Holdings
Fetch historical PnL by Wallet & Token
Get the Historical PnL for a given wallet address and token address.
POST
/
api
/
v1
/
developer
/
wallet
/
pnl-by-token
/
history
Get Pnl By Token With Historical Breakdown
curl --request POST \
--url https://api.allium.so/api/v1/developer/wallet/pnl-by-token/history \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"addresses": [
{
"address": "125Z6k4ZAxsgdG7JxrKZpwbcS1rxqpAeqM9GSCKd66Wp",
"chain": "solana",
"token_address": "So11111111111111111111111111111111111111112"
}
],
"end_timestamp": "2025-04-10T00:00:00Z",
"granularity": "1h",
"start_timestamp": "2025-04-01T00:00:00Z"
}
'import requests
url = "https://api.allium.so/api/v1/developer/wallet/pnl-by-token/history"
payload = {
"addresses": [
{
"address": "125Z6k4ZAxsgdG7JxrKZpwbcS1rxqpAeqM9GSCKd66Wp",
"chain": "solana",
"token_address": "So11111111111111111111111111111111111111112"
}
],
"end_timestamp": "2025-04-10T00:00:00Z",
"granularity": "1h",
"start_timestamp": "2025-04-01T00:00:00Z"
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
addresses: [
{
address: '125Z6k4ZAxsgdG7JxrKZpwbcS1rxqpAeqM9GSCKd66Wp',
chain: 'solana',
token_address: 'So11111111111111111111111111111111111111112'
}
],
end_timestamp: '2025-04-10T00:00:00Z',
granularity: '1h',
start_timestamp: '2025-04-01T00:00:00Z'
})
};
fetch('https://api.allium.so/api/v1/developer/wallet/pnl-by-token/history', 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.allium.so/api/v1/developer/wallet/pnl-by-token/history",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'addresses' => [
[
'address' => '125Z6k4ZAxsgdG7JxrKZpwbcS1rxqpAeqM9GSCKd66Wp',
'chain' => 'solana',
'token_address' => 'So11111111111111111111111111111111111111112'
]
],
'end_timestamp' => '2025-04-10T00:00:00Z',
'granularity' => '1h',
'start_timestamp' => '2025-04-01T00:00:00Z'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.allium.so/api/v1/developer/wallet/pnl-by-token/history"
payload := strings.NewReader("{\n \"addresses\": [\n {\n \"address\": \"125Z6k4ZAxsgdG7JxrKZpwbcS1rxqpAeqM9GSCKd66Wp\",\n \"chain\": \"solana\",\n \"token_address\": \"So11111111111111111111111111111111111111112\"\n }\n ],\n \"end_timestamp\": \"2025-04-10T00:00:00Z\",\n \"granularity\": \"1h\",\n \"start_timestamp\": \"2025-04-01T00:00:00Z\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.allium.so/api/v1/developer/wallet/pnl-by-token/history")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"addresses\": [\n {\n \"address\": \"125Z6k4ZAxsgdG7JxrKZpwbcS1rxqpAeqM9GSCKd66Wp\",\n \"chain\": \"solana\",\n \"token_address\": \"So11111111111111111111111111111111111111112\"\n }\n ],\n \"end_timestamp\": \"2025-04-10T00:00:00Z\",\n \"granularity\": \"1h\",\n \"start_timestamp\": \"2025-04-01T00:00:00Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.allium.so/api/v1/developer/wallet/pnl-by-token/history")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"addresses\": [\n {\n \"address\": \"125Z6k4ZAxsgdG7JxrKZpwbcS1rxqpAeqM9GSCKd66Wp\",\n \"chain\": \"solana\",\n \"token_address\": \"So11111111111111111111111111111111111111112\"\n }\n ],\n \"end_timestamp\": \"2025-04-10T00:00:00Z\",\n \"granularity\": \"1h\",\n \"start_timestamp\": \"2025-04-01T00:00:00Z\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"chain": "<string>",
"address": "<string>",
"token_address": "<string>",
"pnl": [
{
"timestamp": "2023-11-07T05:31:56Z",
"unrealized_pnl": {
"amount": "<string>",
"currency": "USD"
},
"realized_pnl": {
"amount": "<string>",
"currency": "USD"
}
}
]
},
"items": [
{
"chain": "<string>",
"address": "<string>",
"token_address": "<string>",
"pnl": [
{
"timestamp": "2023-11-07T05:31:56Z",
"unrealized_pnl": {
"amount": "<string>",
"currency": "USD"
},
"realized_pnl": {
"amount": "<string>",
"currency": "USD"
}
}
]
}
],
"error": "<string>",
"cursor": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}This endpoint provides unrealized and realized PnL for specific wallet and token address combinations at specified time periods and granularities.
Time Range Parameters
start_timestamp- Beginning of the time range (inclusive)end_timestamp- End of the time range (exclusive)- Both timestamps are assumed to be in UTC if no timezone is specified
- All returned data is in UTC
Granularity Options
1d- Daily intervals1h- Hourly intervals
Supported Chains
Body
application/json
Payload for historical PNL by token.
Response
Successful Response
Was this page helpful?