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{
"cost_basis": "2000.00",
"currency": "EUR",
"gross_capital": "175.00",
"gross_income": "34.75",
"gross_realized": "125.50",
"gross_total": "209.75",
"gross_unrealized": "84.25",
"gross_unrealized_percentage": "0.0421",
"period_end": "2026-03-31T23:59:59Z",
"period_start": "2026-01-01T00:00:00Z",
"position": "<string>",
"realized_capital": "100.00",
"realized_income": "25.50",
"unrealized_capital": "75.00",
"unrealized_income": "9.25"
}{
"code": "<string>",
"detail": "<string>",
"context": {},
"docs": "<string>",
"params": [
{
"code": "<string>",
"detail": "<string>",
"path": [
123
]
}
]
}Retrieve 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{
"cost_basis": "2000.00",
"currency": "EUR",
"gross_capital": "175.00",
"gross_income": "34.75",
"gross_realized": "125.50",
"gross_total": "209.75",
"gross_unrealized": "84.25",
"gross_unrealized_percentage": "0.0421",
"period_end": "2026-03-31T23:59:59Z",
"period_start": "2026-01-01T00:00:00Z",
"position": "<string>",
"realized_capital": "100.00",
"realized_income": "25.50",
"unrealized_capital": "75.00",
"unrealized_income": "9.25"
}{
"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
OK
Total acquisition cost of the position.
"2000.00"
Currency of the earnings amounts.
EUR, USD, GBP Capital earnings before fees and taxes.
"175.00"
Income earnings before fees and taxes.
"34.75"
Realized earnings before fees and taxes.
"125.50"
Total realized and unrealized gross earnings.
"209.75"
Unrealized earnings before fees and taxes.
"84.25"
Unrealized gross earnings as a proportion of cost basis.
"0.0421"
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.
Realized earnings from capital appreciation.
"100.00"
Realized earnings from income.
"25.50"
Unrealized earnings from capital appreciation.
"75.00"
Unrealized earnings from income.
"9.25"