Get trader PnL
curl --request GET \
--url https://perp-api.phoenix.trade/v1/traders/{trader_pubkey}/pnl \
--header 'Authorization: Bearer <token>'import requests
url = "https://perp-api.phoenix.trade/v1/traders/{trader_pubkey}/pnl"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://perp-api.phoenix.trade/v1/traders/{trader_pubkey}/pnl', 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://perp-api.phoenix.trade/v1/traders/{trader_pubkey}/pnl",
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://perp-api.phoenix.trade/v1/traders/{trader_pubkey}/pnl"
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://perp-api.phoenix.trade/v1/traders/{trader_pubkey}/pnl")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://perp-api.phoenix.trade/v1/traders/{trader_pubkey}/pnl")
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[
{
"cumulativeFundingPayment": 123,
"cumulativePnl": 123,
"cumulativeTakerFee": 123,
"endTime": 123,
"startTime": 123,
"timestamp": 123,
"unrealizedPnl": 123
}
]Trader
Get trader PnL
Handles GET /v1/traders/{trader_pubkey}/pnl via get.v1.traders.by_trader_pubkey.pnl.
GET
/
v1
/
traders
/
{trader_pubkey}
/
pnl
Get trader PnL
curl --request GET \
--url https://perp-api.phoenix.trade/v1/traders/{trader_pubkey}/pnl \
--header 'Authorization: Bearer <token>'import requests
url = "https://perp-api.phoenix.trade/v1/traders/{trader_pubkey}/pnl"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://perp-api.phoenix.trade/v1/traders/{trader_pubkey}/pnl', 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://perp-api.phoenix.trade/v1/traders/{trader_pubkey}/pnl",
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://perp-api.phoenix.trade/v1/traders/{trader_pubkey}/pnl"
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://perp-api.phoenix.trade/v1/traders/{trader_pubkey}/pnl")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://perp-api.phoenix.trade/v1/traders/{trader_pubkey}/pnl")
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[
{
"cumulativeFundingPayment": 123,
"cumulativePnl": 123,
"cumulativeTakerFee": 123,
"endTime": 123,
"startTime": 123,
"timestamp": 123,
"unrealizedPnl": 123
}
]Authorizations
Bearer access token issued by /v1/auth/* login endpoints.
Path Parameters
Trader public key (base58 encoded)
Query Parameters
Resolution/timeframe: 1m, 1d
Start time in milliseconds since Unix epoch (max range: 1 year)
End time in milliseconds since Unix epoch (max range: 1 year)
Max number of data points (default: 1000, max: 1440)
Response
200 - application/json
Cumulative funding payment up to this point
Cumulative realized PnL up to this point
Cumulative taker fees paid up to this point
End time in seconds since Unix epoch
Start time in seconds since Unix epoch
Deprecated: Unix timestamp in seconds.
unrealized PnL up to this point