curl --request GET \
--url https://public-api.etoro.com/api/v1/data/positions/closed-events/history \
--header 'x-api-key: <api-key>' \
--header 'x-request-id: <x-request-id>' \
--header 'x-user-key: <api-key>'import requests
url = "https://public-api.etoro.com/api/v1/data/positions/closed-events/history"
headers = {
"x-request-id": "<x-request-id>",
"x-api-key": "<api-key>",
"x-user-key": "<api-key>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {
'x-request-id': '<x-request-id>',
'x-api-key': '<api-key>',
'x-user-key': '<api-key>'
}
};
fetch('https://public-api.etoro.com/api/v1/data/positions/closed-events/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://public-api.etoro.com/api/v1/data/positions/closed-events/history",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>",
"x-request-id: <x-request-id>",
"x-user-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"
"net/http"
"io"
)
func main() {
url := "https://public-api.etoro.com/api/v1/data/positions/closed-events/history"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-request-id", "<x-request-id>")
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("x-user-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://public-api.etoro.com/api/v1/data/positions/closed-events/history")
.header("x-request-id", "<x-request-id>")
.header("x-api-key", "<api-key>")
.header("x-user-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://public-api.etoro.com/api/v1/data/positions/closed-events/history")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-request-id"] = '<x-request-id>'
request["x-api-key"] = '<api-key>'
request["x-user-key"] = '<api-key>'
response = http.request(request)
puts response.read_body[
{
"closeYear": 2023,
"assetType": "Stocks",
"closedPositionEvents": 4
},
{
"closeYear": 2024,
"assetType": "Crypto",
"closedPositionEvents": 2
}
]{
"error": {
"code": "gcid_required",
"message": "This endpoint requires a gateway-issued GCID"
},
"requestId": "3f6c1b7e-9a41-4c2e-8f0d-1b2a3c4d5e6f"
}{
"error": {
"code": "dependency_unavailable",
"message": "The requested resource is temporarily unavailable"
},
"requestId": "3f6c1b7e-9a41-4c2e-8f0d-1b2a3c4d5e6f"
}Get the caller's closed position event history counts
Rate limit: 60 requests per 60 seconds. This is the default shared quota — it is shared with every other endpoint that has no dedicated limit, so requests across those endpoints all draw from the same budget.
Returns the calling customer’s historical count of closed position events, broken down by close year and asset type, one entry per (closeYear, assetType) combination sorted ascending by year then asset type. This is user-scoped: the caller is identified by their own gateway-issued GCID, not a path or query parameter, so it always answers for ‘me’. A customer with no closed-position history returns 200 with an empty array, not 404 - there is no distinguishable ‘not found’ state for this endpoint.
curl --request GET \
--url https://public-api.etoro.com/api/v1/data/positions/closed-events/history \
--header 'x-api-key: <api-key>' \
--header 'x-request-id: <x-request-id>' \
--header 'x-user-key: <api-key>'import requests
url = "https://public-api.etoro.com/api/v1/data/positions/closed-events/history"
headers = {
"x-request-id": "<x-request-id>",
"x-api-key": "<api-key>",
"x-user-key": "<api-key>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {
'x-request-id': '<x-request-id>',
'x-api-key': '<api-key>',
'x-user-key': '<api-key>'
}
};
fetch('https://public-api.etoro.com/api/v1/data/positions/closed-events/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://public-api.etoro.com/api/v1/data/positions/closed-events/history",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>",
"x-request-id: <x-request-id>",
"x-user-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"
"net/http"
"io"
)
func main() {
url := "https://public-api.etoro.com/api/v1/data/positions/closed-events/history"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-request-id", "<x-request-id>")
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("x-user-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://public-api.etoro.com/api/v1/data/positions/closed-events/history")
.header("x-request-id", "<x-request-id>")
.header("x-api-key", "<api-key>")
.header("x-user-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://public-api.etoro.com/api/v1/data/positions/closed-events/history")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-request-id"] = '<x-request-id>'
request["x-api-key"] = '<api-key>'
request["x-user-key"] = '<api-key>'
response = http.request(request)
puts response.read_body[
{
"closeYear": 2023,
"assetType": "Stocks",
"closedPositionEvents": 4
},
{
"closeYear": 2024,
"assetType": "Crypto",
"closedPositionEvents": 2
}
]{
"error": {
"code": "gcid_required",
"message": "This endpoint requires a gateway-issued GCID"
},
"requestId": "3f6c1b7e-9a41-4c2e-8f0d-1b2a3c4d5e6f"
}{
"error": {
"code": "dependency_unavailable",
"message": "The requested resource is temporarily unavailable"
},
"requestId": "3f6c1b7e-9a41-4c2e-8f0d-1b2a3c4d5e6f"
}Authorizations
API key of the application. Only valid together with the x-user-key header — the pair is an alternative to OAuth bearer authentication, never sent alongside it. The pair is granted the same permissions the operation's OAuth scopes describe.
Demo credential for trying the API from these docs: lhgfaslk21490FAScVPkdsb53F9dNkfHG4faZSG5vfjndfcfgdssdgsdHF4663
User-specific authentication key. Only valid together with the x-api-key header — the pair is an alternative to OAuth bearer authentication, never sent alongside it.
Demo credential for trying the API from these docs: eyJlYW4iOiJVbnJlZ2lzdGVyZWRBcHBsaWNhdGlvbiIsImVrIjoiOE5sZ2cwcW5EUVdROUFNWGpXT2lmOWktZnpidG5KcUlqWGJ3WHJZZkpZcldrbG90ZEhvLVBjSWhQaU8xU1ZtMW84aU1WZGZqN2xWNzFjLXFxLmcybXE1dnh4Q1hUT25xaWRUaTFlcEhmVk1fIn0_
Headers
A unique request identifier.
"87b0f8d3-75dd-4fe1-8b24-ca2fd9881623"
Response
The caller's closed position event history counts, oldest year first.
Calendar year the position events closed in.
2023
Asset type of the closed positions counted in this entry.
"Stocks"
Count of closed position events for this close year and asset type.
4