GET
/
spot
/
order-book-events
/
{instrument}
Events/Updates Historical
curl --request GET \
  --url https://api.amberdata.com/markets/spot/order-book-events/{instrument} \
  --compressed \
  --header 'Accept-Encoding: <accept-encoding>' \
  --header 'x-api-key: <api-key>'
{
  "status": 200,
  "title": "OK",
  "description": "Successful request",
  "payload": {
    "metadata": {
      "requestedStartDate": "2024-03-01 00:00:00 000",
      "returnedStartDate": "2024-03-01 00:00:00 005",
      "returnedEndDate": "2024-03-01 00:00:42 218",
      "next": "https://api.amberdata.com/markets/spot/order-book-events/btc_usd?cursor=N4IgxgrgTgzg9lEAuAdhANugNCGAXAQyjwBEC8BTZARgHYAGATgCYBWa5gFmeeoA4cFFABMylGgxatOfenLk48ASwC2FAGIIV5ZCAAWEbSgBKFAsIIAjdFUWqKASRSUoANwLpkoFATW6AnmawIDgwAI7oAHK%2BVEgggUQhuBHRagAK6NAeAUHo-knCFABmBBh4yHwAbJzyCiDaAB7IlQDMXDK19DjocHAA1pYEYH1pFFBKcMLIaJgAvjhFWjpxAFbwKEkUDWB6BCgA5rEg%2BxZNOEooYJmFAKooMBAADo8IlMIAotu7BxQwyCXoGAUUKEYjRFBwIFgOAiP5IRjyboEfAAcSgcCeXhAF3wUEMQnKcUseDAAH0IDApoIvntDroTgQziAtjtaRQACr2fC%2BR66Zj0LgAWnoLWF1AABHIkFLuOLeHxNjSfpy1NyVI9wZCKNDYcgEXUgWEIEIwEdOLQ%2BMxKsxaC1aPLLYwksi%2BsgANqgR7jU3NDjURgAOk4rBwrjgmT80pwaBUAHkoIVgqgMOhZgBdHCWJRTJButOzWZAA",
      "api-version": "2023-09-30"
    },
    "data": [
      {
        "instrument": "btc_usd",
        "exchange": "gdax",
        "exchangeTimestamp": "2024-03-01 00:00:00 005",
        "exchangeTimestampNanoseconds": 174000,
        "sequence": "478262695005780",
        "ask": [],
        "bid": [
          {
            "price": 61141.86,
            "volume": 0,
            "numOrders": null
          }
        ]
      },
      {
        "instrument": "btc_usd",
        "exchange": "gdax",
        "exchangeTimestamp": "2024-03-01 00:00:00 005",
        "exchangeTimestampNanoseconds": 174000,
        "sequence": "478262695005781",
        "ask": [],
        "bid": [
          {
            "price": 61099.03,
            "volume": 0,
            "numOrders": null
          }
        ]
      }
    ]
  }
}
To ensure optimal performance and system reliability, historical data for Order Book Snapshots and Order Book Events via REST API is available for the past 18 months only.If you require access to deeper historical data—for use cases such as machine learning model training, backtesting strategies, or conducting long-term research—we strongly recommend using our bulk file delivery options. These solutions are designed to efficiently handle large-scale data access and offer full historical coverage across all supported exchanges and instruments.Why this limitation?
  • REST APIs are optimized for recent, low-latency access to granular data. Using them for deep historical queries can lead to performance degradation, rate limiting, and an inconsistent experience. Bulk delivery options are purpose-built for large data pulls and are the best fit for these needs.
BitMEX’s volume field represents the number of contracts traded, not the volume in the base asset.To obtain the correct volume, users must adjust for contract size using the underlyingToPositionMultiplier from our Reference endpoint.For details on this calculation and how to retrieve the correct values, see our Changelog Update.
The maximum time range (difference between startDate and endDate) is 18 months.
If the startDate and endDate query parameters are not provided, the API will return the data from the previous 24 hours.

Authorizations

x-api-key
string
header
required

Headers

Accept-Encoding
string
default:gzip, deflate, br
required
api-version
string

Path Parameters

instrument
string
default:btc_usd
required

The spot instrument for which data will be retrieved.

Query Parameters

exchange
string
default:gdax
required

The exchange for which data should be retrieved. Only 1 exchange is allowed.

startDate
string<date-time>
default:2024-03-01T00:00:00

[Optional] Payload only includes data after this date (inclusive). [Formats] seconds | milliseconds | iso8601 [Examples] 1578531600 | 1578531600000 | 2020-09-01T01:00:00

endDate
string<date-time>
default:2024-03-01T01:00:00

[Optional] Payload only includes data before this date (exclusive). [Formats] seconds | milliseconds | iso8601 [Examples] 1578531600 | 1578531600000 | 2020-09-01T01:00:00

timeFormat
enum<string>
default:hr

[Optional] Time format of the timestamps in the response.

Available options:
milliseconds,
ms*,
iso,
iso8601,
hr,
human_readable
sortDirection
string

[Optional] Specifies the direction in which the data is sorted (by timestamp). [Defaults] asc (ascending order). [Usage Conditions] This parameter can only be used if the startDate and endDate timeframe is within the most recent 24 hours, or if the startDate and endDate parameters are not used at all. [Examples] ascending | descending | asc | desc

Response

200 - application/json

200

status
integer
title
string
description
string
payload
object