curl --request GET \
--url https://sandbox.api.btdx.io/trades/historical \
--header 'authorization: <authorization>'import requests
url = "https://sandbox.api.btdx.io/trades/historical"
headers = {"authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {authorization: '<authorization>'}};
fetch('https://sandbox.api.btdx.io/trades/historical', 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://sandbox.api.btdx.io/trades/historical",
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: <authorization>"
],
]);
$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://sandbox.api.btdx.io/trades/historical"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://sandbox.api.btdx.io/trades/historical")
.header("authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.api.btdx.io/trades/historical")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"_meta": {
"_primary_document": "apiKeys",
"_count": 123,
"_offset": {
"offset": "2023-11-07T05:31:56Z",
"secondaryOffset": 123,
"limit": 123,
"sort": "ASC"
},
"_next_offset": {
"offset": "2023-11-07T05:31:56Z",
"secondaryOffset": 123,
"limit": 123,
"sort": "ASC"
}
},
"documents": {
"trades": [
{
"id": "<string>",
"walletId": "<string>",
"market": {
"_ref": "<string>",
"_ids": [
"<string>"
]
},
"order": {
"_ref": "<string>",
"_ids": [
"<string>"
]
},
"side": "For",
"outcomeId": "<string>",
"price": 123,
"stake": 123,
"profitLoss": 123,
"createdAt": "2023-11-07T05:31:56Z",
"modifiedAt": "2023-11-07T05:31:56Z",
"settledAt": "2023-11-07T05:31:56Z",
"eventExpectedStartTime": "2023-11-07T05:31:56Z"
}
],
"orders": [
{
"id": "<string>",
"market": {
"_ref": "<string>",
"_ids": [
"<string>"
]
},
"side": "For",
"outcomeId": "<string>",
"outcomeTitle": "<string>",
"price": 123,
"stake": 123,
"stakeUnmatched": 123,
"stakeVoided": 123,
"status": "Cancelled",
"reference": "<string>"
}
],
"markets": [
{
"id": "<string>",
"name": "<string>",
"inPlayStatus": "NotApplicable",
"published": true,
"suspended": true,
"status": "Initializing",
"lockAt": "2023-11-07T05:31:56Z",
"settledAt": "2023-11-07T05:31:56Z",
"event": {
"_ref": "<string>",
"_ids": [
"<string>"
]
}
}
],
"events": [
{
"id": "<string>",
"eventGroup": {
"_ref": "<string>",
"_ids": [
"<string>"
]
},
"name": "<string>",
"code": "<string>",
"expectedStartTime": "2023-11-07T05:31:56Z",
"active": true
}
],
"eventGroups": [
{
"id": "<string>",
"name": "<string>",
"subcategory": {
"_ref": "<string>",
"_ids": [
"<string>"
]
}
}
],
"subcategories": [
{
"id": "<string>",
"name": "<string>",
"category": {
"_ref": "<string>",
"_ids": [
"<string>"
]
}
}
],
"categories": [
{
"id": "<string>",
"name": "<string>"
}
]
}
}{
"_meta": {
"_primary_document": "apiKeys",
"_count": 123,
"_offset": {
"offset": "2023-11-07T05:31:56Z",
"secondaryOffset": 123,
"limit": 123,
"sort": "ASC"
},
"_next_offset": {
"offset": "2023-11-07T05:31:56Z",
"secondaryOffset": 123,
"limit": 123,
"sort": "ASC"
}
},
"documents": {
"trades": [
{
"id": "<string>",
"walletId": "<string>",
"market": {
"_ref": "<string>",
"_ids": [
"<string>"
]
},
"order": {
"_ref": "<string>",
"_ids": [
"<string>"
]
},
"side": "For",
"outcomeId": "<string>",
"price": 123,
"stake": 123,
"profitLoss": 123,
"createdAt": "2023-11-07T05:31:56Z",
"modifiedAt": "2023-11-07T05:31:56Z",
"settledAt": "2023-11-07T05:31:56Z",
"eventExpectedStartTime": "2023-11-07T05:31:56Z"
}
],
"orders": [
{
"id": "<string>",
"market": {
"_ref": "<string>",
"_ids": [
"<string>"
]
},
"side": "For",
"outcomeId": "<string>",
"outcomeTitle": "<string>",
"price": 123,
"stake": 123,
"stakeUnmatched": 123,
"stakeVoided": 123,
"status": "Cancelled",
"reference": "<string>"
}
],
"markets": [
{
"id": "<string>",
"name": "<string>",
"inPlayStatus": "NotApplicable",
"published": true,
"suspended": true,
"status": "Initializing",
"lockAt": "2023-11-07T05:31:56Z",
"settledAt": "2023-11-07T05:31:56Z",
"event": {
"_ref": "<string>",
"_ids": [
"<string>"
]
}
}
],
"events": [
{
"id": "<string>",
"eventGroup": {
"_ref": "<string>",
"_ids": [
"<string>"
]
},
"name": "<string>",
"code": "<string>",
"expectedStartTime": "2023-11-07T05:31:56Z",
"active": true
}
],
"eventGroups": [
{
"id": "<string>",
"name": "<string>",
"subcategory": {
"_ref": "<string>",
"_ids": [
"<string>"
]
}
}
],
"subcategories": [
{
"id": "<string>",
"name": "<string>",
"category": {
"_ref": "<string>",
"_ids": [
"<string>"
]
}
}
],
"categories": [
{
"id": "<string>",
"name": "<string>"
}
]
}
}Fetch historical won, lost or voided trades by wallet
Fetch historical (won, lost or voided) trades for the given wallet, filtered by query type (settlement date or event start date). Optionally filter by market. Pagination is by offset using the selected queryType timestamp (settledAt or eventExpectedStartTime) and id as the primary and secondary offsets. Fetch the initial page without any offsets set, and use returned _next_offset values iteratively until _next_offset is null, or _count is 0.
curl --request GET \
--url https://sandbox.api.btdx.io/trades/historical \
--header 'authorization: <authorization>'import requests
url = "https://sandbox.api.btdx.io/trades/historical"
headers = {"authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {authorization: '<authorization>'}};
fetch('https://sandbox.api.btdx.io/trades/historical', 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://sandbox.api.btdx.io/trades/historical",
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: <authorization>"
],
]);
$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://sandbox.api.btdx.io/trades/historical"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://sandbox.api.btdx.io/trades/historical")
.header("authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.api.btdx.io/trades/historical")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"_meta": {
"_primary_document": "apiKeys",
"_count": 123,
"_offset": {
"offset": "2023-11-07T05:31:56Z",
"secondaryOffset": 123,
"limit": 123,
"sort": "ASC"
},
"_next_offset": {
"offset": "2023-11-07T05:31:56Z",
"secondaryOffset": 123,
"limit": 123,
"sort": "ASC"
}
},
"documents": {
"trades": [
{
"id": "<string>",
"walletId": "<string>",
"market": {
"_ref": "<string>",
"_ids": [
"<string>"
]
},
"order": {
"_ref": "<string>",
"_ids": [
"<string>"
]
},
"side": "For",
"outcomeId": "<string>",
"price": 123,
"stake": 123,
"profitLoss": 123,
"createdAt": "2023-11-07T05:31:56Z",
"modifiedAt": "2023-11-07T05:31:56Z",
"settledAt": "2023-11-07T05:31:56Z",
"eventExpectedStartTime": "2023-11-07T05:31:56Z"
}
],
"orders": [
{
"id": "<string>",
"market": {
"_ref": "<string>",
"_ids": [
"<string>"
]
},
"side": "For",
"outcomeId": "<string>",
"outcomeTitle": "<string>",
"price": 123,
"stake": 123,
"stakeUnmatched": 123,
"stakeVoided": 123,
"status": "Cancelled",
"reference": "<string>"
}
],
"markets": [
{
"id": "<string>",
"name": "<string>",
"inPlayStatus": "NotApplicable",
"published": true,
"suspended": true,
"status": "Initializing",
"lockAt": "2023-11-07T05:31:56Z",
"settledAt": "2023-11-07T05:31:56Z",
"event": {
"_ref": "<string>",
"_ids": [
"<string>"
]
}
}
],
"events": [
{
"id": "<string>",
"eventGroup": {
"_ref": "<string>",
"_ids": [
"<string>"
]
},
"name": "<string>",
"code": "<string>",
"expectedStartTime": "2023-11-07T05:31:56Z",
"active": true
}
],
"eventGroups": [
{
"id": "<string>",
"name": "<string>",
"subcategory": {
"_ref": "<string>",
"_ids": [
"<string>"
]
}
}
],
"subcategories": [
{
"id": "<string>",
"name": "<string>",
"category": {
"_ref": "<string>",
"_ids": [
"<string>"
]
}
}
],
"categories": [
{
"id": "<string>",
"name": "<string>"
}
]
}
}{
"_meta": {
"_primary_document": "apiKeys",
"_count": 123,
"_offset": {
"offset": "2023-11-07T05:31:56Z",
"secondaryOffset": 123,
"limit": 123,
"sort": "ASC"
},
"_next_offset": {
"offset": "2023-11-07T05:31:56Z",
"secondaryOffset": 123,
"limit": 123,
"sort": "ASC"
}
},
"documents": {
"trades": [
{
"id": "<string>",
"walletId": "<string>",
"market": {
"_ref": "<string>",
"_ids": [
"<string>"
]
},
"order": {
"_ref": "<string>",
"_ids": [
"<string>"
]
},
"side": "For",
"outcomeId": "<string>",
"price": 123,
"stake": 123,
"profitLoss": 123,
"createdAt": "2023-11-07T05:31:56Z",
"modifiedAt": "2023-11-07T05:31:56Z",
"settledAt": "2023-11-07T05:31:56Z",
"eventExpectedStartTime": "2023-11-07T05:31:56Z"
}
],
"orders": [
{
"id": "<string>",
"market": {
"_ref": "<string>",
"_ids": [
"<string>"
]
},
"side": "For",
"outcomeId": "<string>",
"outcomeTitle": "<string>",
"price": 123,
"stake": 123,
"stakeUnmatched": 123,
"stakeVoided": 123,
"status": "Cancelled",
"reference": "<string>"
}
],
"markets": [
{
"id": "<string>",
"name": "<string>",
"inPlayStatus": "NotApplicable",
"published": true,
"suspended": true,
"status": "Initializing",
"lockAt": "2023-11-07T05:31:56Z",
"settledAt": "2023-11-07T05:31:56Z",
"event": {
"_ref": "<string>",
"_ids": [
"<string>"
]
}
}
],
"events": [
{
"id": "<string>",
"eventGroup": {
"_ref": "<string>",
"_ids": [
"<string>"
]
},
"name": "<string>",
"code": "<string>",
"expectedStartTime": "2023-11-07T05:31:56Z",
"active": true
}
],
"eventGroups": [
{
"id": "<string>",
"name": "<string>",
"subcategory": {
"_ref": "<string>",
"_ids": [
"<string>"
]
}
}
],
"subcategories": [
{
"id": "<string>",
"name": "<string>",
"category": {
"_ref": "<string>",
"_ids": [
"<string>"
]
}
}
],
"categories": [
{
"id": "<string>",
"name": "<string>"
}
]
}
}Headers
Header with the accessToken for the current session
Query Parameters
wallet id
which timestamp to query by - settlement date or event start date
SettledDate, EventStartDate start of the date range, per queryType
end of the date range, per queryType
market id
Value to offset the current page request by (inclusive)
Secondary offset value, i.e., if offset value is non-unique (exclusive)
Maximum number of elements to retrieve
Sorting criteria in the format: asc|desc. "
Default sort order is ascending.