curl --request GET \
--url https://testnet.edel-api.xyz/v1/accounts/{accountId}/positions/history \
--header 'Authorization: Bearer <token>'import requests
url = "https://testnet.edel-api.xyz/v1/accounts/{accountId}/positions/history"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://testnet.edel-api.xyz/v1/accounts/{accountId}/positions/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://testnet.edel-api.xyz/v1/accounts/{accountId}/positions/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 => [
"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://testnet.edel-api.xyz/v1/accounts/{accountId}/positions/history"
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://testnet.edel-api.xyz/v1/accounts/{accountId}/positions/history")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://testnet.edel-api.xyz/v1/accounts/{accountId}/positions/history")
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{
"version": "external-position-history/v1",
"accountId": "<string>",
"episodes": [
{
"positionId": "<string>",
"accountId": "<string>",
"marketId": "<string>",
"side": "long",
"status": "open",
"openedAtEpochMs": 1,
"closedAtEpochMs": 1,
"maxQuantityAtoms": "<string>",
"maxQuantity": "<string>",
"currentQuantityAtoms": "<string>",
"currentQuantity": "<string>",
"avgEntryPriceAtoms": "<string>",
"avgEntryPrice": "<string>",
"avgExitPriceAtoms": "<string>",
"avgExitPrice": "<string>",
"realizedPnlAtoms": "<string>",
"realizedPnl": "<string>",
"feesPaidAtoms": "<string>",
"feesPaid": "<string>",
"fundingPaidAtoms": "<string>",
"fundingPaid": "<string>",
"closeReason": "user_close",
"lastSequence": 1
}
],
"nextCursor": "<string>",
"freshness": {
"status": "fresh",
"degradedState": "none",
"journalSequence": 1,
"asOfEpochMs": 1,
"projectorLagMs": 1,
"dbReplicaLagMs": 1,
"backfillStatus": "live"
},
"marketId": "<string>",
"status": "open"
}{
"version": "external-rest-error/v1",
"requestId": "<string>",
"code": "invalid_request",
"safeMessage": "<string>",
"retryable": true,
"recoveryActions": [
"none"
],
"occurredAtEpochMs": 1,
"realtimeTicketFailure": "invalid",
"apiKeyRejection": "malformed",
"rejectionGuard": "amount_atoms_invalid",
"withdrawalFailure": "requested",
"dependency": "dfns"
}{
"version": "external-rest-error/v1",
"requestId": "<string>",
"code": "invalid_request",
"safeMessage": "<string>",
"retryable": true,
"recoveryActions": [
"none"
],
"occurredAtEpochMs": 1,
"realtimeTicketFailure": "invalid",
"apiKeyRejection": "malformed",
"rejectionGuard": "amount_atoms_invalid",
"withdrawalFailure": "requested",
"dependency": "dfns"
}{
"version": "external-rest-error/v1",
"requestId": "<string>",
"code": "invalid_request",
"safeMessage": "<string>",
"retryable": true,
"recoveryActions": [
"none"
],
"occurredAtEpochMs": 1,
"realtimeTicketFailure": "invalid",
"apiKeyRejection": "malformed",
"rejectionGuard": "amount_atoms_invalid",
"withdrawalFailure": "requested",
"dependency": "dfns"
}{
"version": "external-rest-error/v1",
"requestId": "<string>",
"code": "invalid_request",
"safeMessage": "<string>",
"retryable": true,
"recoveryActions": [
"none"
],
"occurredAtEpochMs": 1,
"realtimeTicketFailure": "invalid",
"apiKeyRejection": "malformed",
"rejectionGuard": "amount_atoms_invalid",
"withdrawalFailure": "requested",
"dependency": "dfns"
}Get account position history
Returns paginated position episodes for an account from the lagging projection, newest close first with open episodes leading, newest opened first inside one close sequence. An unknown account is refused with invalid_request. The cursor is a base64url JSON object containing closeSequence (null for an open episode), openedAtEpochMs and positionId. A cursor issued before close-sequence paging (openedAtEpochMs and positionId only) is refused once with invalid_request; restart from the first page.
Method and path: GET /v1/accounts//positions/history
Authentication: DFNS trader bearer required.
Request schema: none.
Response schema: ExternalPositionHistoryResponse.
Error envelope: ExternalRestError (external-rest-error/v1).
curl --request GET \
--url https://testnet.edel-api.xyz/v1/accounts/{accountId}/positions/history \
--header 'Authorization: Bearer <token>'import requests
url = "https://testnet.edel-api.xyz/v1/accounts/{accountId}/positions/history"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://testnet.edel-api.xyz/v1/accounts/{accountId}/positions/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://testnet.edel-api.xyz/v1/accounts/{accountId}/positions/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 => [
"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://testnet.edel-api.xyz/v1/accounts/{accountId}/positions/history"
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://testnet.edel-api.xyz/v1/accounts/{accountId}/positions/history")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://testnet.edel-api.xyz/v1/accounts/{accountId}/positions/history")
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{
"version": "external-position-history/v1",
"accountId": "<string>",
"episodes": [
{
"positionId": "<string>",
"accountId": "<string>",
"marketId": "<string>",
"side": "long",
"status": "open",
"openedAtEpochMs": 1,
"closedAtEpochMs": 1,
"maxQuantityAtoms": "<string>",
"maxQuantity": "<string>",
"currentQuantityAtoms": "<string>",
"currentQuantity": "<string>",
"avgEntryPriceAtoms": "<string>",
"avgEntryPrice": "<string>",
"avgExitPriceAtoms": "<string>",
"avgExitPrice": "<string>",
"realizedPnlAtoms": "<string>",
"realizedPnl": "<string>",
"feesPaidAtoms": "<string>",
"feesPaid": "<string>",
"fundingPaidAtoms": "<string>",
"fundingPaid": "<string>",
"closeReason": "user_close",
"lastSequence": 1
}
],
"nextCursor": "<string>",
"freshness": {
"status": "fresh",
"degradedState": "none",
"journalSequence": 1,
"asOfEpochMs": 1,
"projectorLagMs": 1,
"dbReplicaLagMs": 1,
"backfillStatus": "live"
},
"marketId": "<string>",
"status": "open"
}{
"version": "external-rest-error/v1",
"requestId": "<string>",
"code": "invalid_request",
"safeMessage": "<string>",
"retryable": true,
"recoveryActions": [
"none"
],
"occurredAtEpochMs": 1,
"realtimeTicketFailure": "invalid",
"apiKeyRejection": "malformed",
"rejectionGuard": "amount_atoms_invalid",
"withdrawalFailure": "requested",
"dependency": "dfns"
}{
"version": "external-rest-error/v1",
"requestId": "<string>",
"code": "invalid_request",
"safeMessage": "<string>",
"retryable": true,
"recoveryActions": [
"none"
],
"occurredAtEpochMs": 1,
"realtimeTicketFailure": "invalid",
"apiKeyRejection": "malformed",
"rejectionGuard": "amount_atoms_invalid",
"withdrawalFailure": "requested",
"dependency": "dfns"
}{
"version": "external-rest-error/v1",
"requestId": "<string>",
"code": "invalid_request",
"safeMessage": "<string>",
"retryable": true,
"recoveryActions": [
"none"
],
"occurredAtEpochMs": 1,
"realtimeTicketFailure": "invalid",
"apiKeyRejection": "malformed",
"rejectionGuard": "amount_atoms_invalid",
"withdrawalFailure": "requested",
"dependency": "dfns"
}{
"version": "external-rest-error/v1",
"requestId": "<string>",
"code": "invalid_request",
"safeMessage": "<string>",
"retryable": true,
"recoveryActions": [
"none"
],
"occurredAtEpochMs": 1,
"realtimeTicketFailure": "invalid",
"apiKeyRejection": "malformed",
"rejectionGuard": "amount_atoms_invalid",
"withdrawalFailure": "requested",
"dependency": "dfns"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
1Query Parameters
Optional market filter.
1Optional episode status filter.
open, closed, liquidated Page size, from 1 to 100. Defaults to 50.
x <= 100Base64url JSON cursor with closeSequence, openedAtEpochMs and positionId.
1Response
Success
"external-position-history/v1"1Show child attributes
Show child attributes
1Show child attributes
Show child attributes
1open, closed, liquidated