curl --request GET \
--url https://api.engine.usesophic.com/positions/{position_id}/earnings \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.engine.usesophic.com/positions/{position_id}/earnings"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.engine.usesophic.com/positions/{position_id}/earnings', 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.engine.usesophic.com/positions/{position_id}/earnings",
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.engine.usesophic.com/positions/{position_id}/earnings"
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.engine.usesophic.com/positions/{position_id}/earnings")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.engine.usesophic.com/positions/{position_id}/earnings")
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{
"account": "<string>",
"period_end": "2026-03-31T23:59:59Z",
"period_start": "2026-01-01T00:00:00Z",
"position": "<string>",
"reporting": {
"attribution": {
"currency": {
"realized": {
"capital": "<string>",
"income": "<string>"
},
"total": "<string>",
"unrealized": {
"capital": "<string>",
"income": "<string>"
}
},
"investment": {
"realized": {
"capital": "<string>",
"income": "<string>"
},
"total": "<string>",
"unrealized": {
"capital": "<string>",
"income": "<string>"
}
}
},
"cost_basis": "<string>",
"currency": "EUR",
"gross": "<string>"
},
"trading": {
"attribution": {
"investment": {
"realized": {
"capital": "<string>",
"income": "<string>"
},
"total": "<string>",
"unrealized": {
"capital": "<string>",
"income": "<string>"
}
}
},
"cost_basis": "<string>",
"currency": "EUR",
"gross": "<string>",
"unrealized_percentage": "<string>"
}
}{
"code": "<string>",
"detail": "<string>",
"context": {},
"docs": "<string>",
"params": [
{
"code": "<string>",
"detail": "<string>",
"path": [
123
]
}
]
}Retrieve position earnings (P&L)
Retrieve a position’s earnings (P&L) for the requested period. Note the period supports full date-times, with timezone information.
curl --request GET \
--url https://api.engine.usesophic.com/positions/{position_id}/earnings \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.engine.usesophic.com/positions/{position_id}/earnings"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.engine.usesophic.com/positions/{position_id}/earnings', 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.engine.usesophic.com/positions/{position_id}/earnings",
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.engine.usesophic.com/positions/{position_id}/earnings"
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.engine.usesophic.com/positions/{position_id}/earnings")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.engine.usesophic.com/positions/{position_id}/earnings")
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{
"account": "<string>",
"period_end": "2026-03-31T23:59:59Z",
"period_start": "2026-01-01T00:00:00Z",
"position": "<string>",
"reporting": {
"attribution": {
"currency": {
"realized": {
"capital": "<string>",
"income": "<string>"
},
"total": "<string>",
"unrealized": {
"capital": "<string>",
"income": "<string>"
}
},
"investment": {
"realized": {
"capital": "<string>",
"income": "<string>"
},
"total": "<string>",
"unrealized": {
"capital": "<string>",
"income": "<string>"
}
}
},
"cost_basis": "<string>",
"currency": "EUR",
"gross": "<string>"
},
"trading": {
"attribution": {
"investment": {
"realized": {
"capital": "<string>",
"income": "<string>"
},
"total": "<string>",
"unrealized": {
"capital": "<string>",
"income": "<string>"
}
}
},
"cost_basis": "<string>",
"currency": "EUR",
"gross": "<string>",
"unrealized_percentage": "<string>"
}
}{
"code": "<string>",
"detail": "<string>",
"context": {},
"docs": "<string>",
"params": [
{
"code": "<string>",
"detail": "<string>",
"path": [
123
]
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Query Parameters
Predefined period over which earnings are computed. Takes precedence over period_start/period_end when provided.
1d, 1w, 1m, this-month, 3m, 6m, ytd, 1y, all The period start (in ISO 8601 format). If omitted, it defaults to the position opening date/time. Note that the period is interpreted as a half-open interval with period_start included and period_end excluded.
"period_start=2025-11-12T00:00:00Z"
"period_start=2025-11-12"
Response
Successful Response
ID of the account holding the position.
End date and time of the earnings period.
"2026-03-31T23:59:59Z"
Start date and time of the earnings period.
"2026-01-01T00:00:00Z"
ID of the position the earnings were computed for.
The position's earnings in the account's base currency, with a breakdown into what the investment earned and what exchange-rate movements added or took away. Summed over all positions, these give the account's positions figures.
Show child attributes
Show child attributes
The position's earnings in the instrument's own currency.
Show child attributes
Show child attributes