Get PnL
curl --request GET \
--url https://relay.bayse.markets/v1/pm/pnlimport requests
url = "https://relay.bayse.markets/v1/pm/pnl"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://relay.bayse.markets/v1/pm/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://relay.bayse.markets/v1/pm/pnl",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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://relay.bayse.markets/v1/pm/pnl"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://relay.bayse.markets/v1/pm/pnl")
.asString();require 'uri'
require 'net/http'
url = URI("https://relay.bayse.markets/v1/pm/pnl")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"realizedPnl": 31.11,
"realizedPnlPercent": 6.03,
"settlementPnl": 24.50,
"tradePnl": 6.61,
"wins": 8,
"losses": 6,
"currency": "USD",
"breakdown": [
{
"eventId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"eventTitle": "Will BTC close above $95k today?",
"realizedPnl": 12.35,
"currency": "USD",
"lastActivity": "2026-03-20T14:30:00Z"
},
{
"eventId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
"eventTitle": "Will Super Eagles qualify for AFCON 2026?",
"realizedPnl": -3.50,
"currency": "USD",
"lastActivity": "2026-03-19T09:15:00Z"
}
]
}
Trading
Get PnL
Get your realized profit and loss over a time period
GET
/
v1
/
pm
/
pnl
Get PnL
curl --request GET \
--url https://relay.bayse.markets/v1/pm/pnlimport requests
url = "https://relay.bayse.markets/v1/pm/pnl"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://relay.bayse.markets/v1/pm/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://relay.bayse.markets/v1/pm/pnl",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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://relay.bayse.markets/v1/pm/pnl"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://relay.bayse.markets/v1/pm/pnl")
.asString();require 'uri'
require 'net/http'
url = URI("https://relay.bayse.markets/v1/pm/pnl")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"realizedPnl": 31.11,
"realizedPnlPercent": 6.03,
"settlementPnl": 24.50,
"tradePnl": 6.61,
"wins": 8,
"losses": 6,
"currency": "USD",
"breakdown": [
{
"eventId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"eventTitle": "Will BTC close above $95k today?",
"realizedPnl": 12.35,
"currency": "USD",
"lastActivity": "2026-03-20T14:30:00Z"
},
{
"eventId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
"eventTitle": "Will Super Eagles qualify for AFCON 2026?",
"realizedPnl": -3.50,
"currency": "USD",
"lastActivity": "2026-03-19T09:15:00Z"
}
]
}
Authentication
Read authentication required —X-Public-Key header. See the Authentication guide.
Query parameters
Predefined time window. If omitted and no custom range is provided, defaults to all time.Rolling windows:
12H, 24H, 1W, 1M, 1Y — relative to current time (e.g. 1M = last 30 days).Calendar windows: THIS_WEEK, THIS_MONTH, THIS_YEAR — from the start of the current week/month/year to now.Currency filter —
USD or NGN. Defaults to USD if omitted. PnL is computed per currency, so if you traded only in NGN and query USD, all values will be zero.Example request
curl "https://relay.bayse.markets/v1/pm/pnl?timePeriod=1M&breakdown=true" \
-H "X-Public-Key: pk_live_abcdef123456"
const response = await fetch(
'https://relay.bayse.markets/v1/pm/pnl?timePeriod=1M&breakdown=true',
{
headers: {
'X-Public-Key': 'pk_live_abcdef123456',
},
}
);
const pnl = await response.json();
import requests
resp = requests.get(
'https://relay.bayse.markets/v1/pm/pnl',
params={'timePeriod': '1M', 'breakdown': 'true'},
headers={'X-Public-Key': 'pk_live_abcdef123456'},
)
pnl = resp.json()
req, _ := http.NewRequest("GET", "https://relay.bayse.markets/v1/pm/pnl?timePeriod=1M&breakdown=true", nil)
req.Header.Set("X-Public-Key", "pk_live_abcdef123456")
resp, _ := http.DefaultClient.Do(req)
Response
Realized PnL as a percentage of total cost basis.
0 when no cost basis exists in the queried period.PnL from resolved markets. Computed as total payouts received minus total cost basis of settled positions.
PnL from selling shares before market resolution. Computed as proceeds minus cost basis for each sell.
{
"realizedPnl": 31.11,
"realizedPnlPercent": 6.03,
"settlementPnl": 24.50,
"tradePnl": 6.61,
"wins": 8,
"losses": 6,
"currency": "USD",
"breakdown": [
{
"eventId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"eventTitle": "Will BTC close above $95k today?",
"realizedPnl": 12.35,
"currency": "USD",
"lastActivity": "2026-03-20T14:30:00Z"
},
{
"eventId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
"eventTitle": "Will Super Eagles qualify for AFCON 2026?",
"realizedPnl": -3.50,
"currency": "USD",
"lastActivity": "2026-03-19T09:15:00Z"
}
]
}