> ## Documentation Index
> Fetch the complete documentation index at: https://docs.amberdata.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Historical

> Delivers historical ticker data for Spot market trading pairs, providing bid, ask, mid, and last prices, along with respective volumes, timestamps, and sequencing for tracking market price changes over time.

<Warning>
  The maximum time range (difference between `startDate` and `endDate`) is **731 days (2 years)**.
</Warning>

<Note>
  If the `startDate` and `endDate` query parameters are not provided, the API will return the data from the previous 24 hours.
</Note>


## OpenAPI

````yaml get /spot/tickers/{instrument}
openapi: 3.1.0
info:
  title: market-api
  version: '2'
servers:
  - url: https://api.amberdata.com/markets
security:
  - ApiKeyAuth: []
paths:
  /spot/tickers/{instrument}:
    get:
      summary: Historical
      description: >-
        Delivers historical ticker data for Spot market trading pairs, providing
        bid, ask, mid, and last prices, along with respective volumes,
        timestamps, and sequencing for tracking market price changes over time.
      operationId: spot-tickers-historical
      parameters:
        - name: instrument
          in: path
          description: The spot instrument for which data will be retrieved.
          schema:
            type: string
            default: eth_usdt
          required: true
        - name: exchange
          in: query
          description: >-
            The exchange for which data should be retrieved. Only **1** exchange
            is allowed.
          required: true
          schema:
            type: string
            default: binance
        - name: startDate
          in: query
          description: >-
            **[Optional]** Payload only includes data after this date
            (inclusive). **[Defaults]** Beginning of the current hour (max time
            range is 1 hour). **[Formats]** `seconds | milliseconds | iso8601`
            **[Examples]** `1578531600 | 1578531600000 | 2020-09-01T01:00:00`
          schema:
            type: string
            format: date-time
        - name: endDate
          in: query
          description: >-
            **[Optional]** Payload only includes data before this date
            (exclusive). **[Defaults]** One hour after the beginning of the
            current hour (max time range is 1 hour). **[Formats]** `seconds |
            milliseconds | iso8601` **[Examples]** `1578531600 | 1578531600000 |
            2020-09-01T01:00:00`
          schema:
            type: string
            format: date-time
        - name: timeFormat
          in: query
          description: '**[Optional]** Time format of the timestamps in the return payload.'
          schema:
            type: string
            enum:
              - milliseconds
              - ms*
              - iso
              - iso8601
              - hr
              - human_readable
            default: hr
        - name: sortDirection
          in: query
          description: >-
            **[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
          schema:
            type: string
        - name: Accept-Encoding
          in: header
          required: true
          description: ''
          schema:
            type: string
            default: gzip, deflate, br
        - name: api-version
          in: header
          schema:
            type: string
      responses:
        '200':
          description: '200'
          content:
            application/json:
              examples:
                Result:
                  value:
                    status: 200
                    title: OK
                    description: Successful request
                    payload:
                      metadata:
                        next: >-
                          https://api.amberdata.com/markets/spot/tickers/eth_usdt?cursor=N4IgpgHgxgFghgOwOZhALhAIwJYMVVAGhCgFcAnAZwHtz0FSAbR4ygFznLYBE43U0ARgDsIgKyCxYgMwAOAJwAWWcTAIAJr37oRIgGwAGQfIBMJ6YeK4ojUurABVBJVIAHV7X7qAotHjIwSnQAMzhGSjBiNmwAWzAAMVoYvnQQGOxmbAioag0g4mCklIwAKxoEEFZPAGkwAE9U3WEJKTklWQB9QVlBA0VpDpw8BAIO6WkReVFBQz0OsDYYDtJKdTYQAF8gA
                        api-version: '2023-09-30'
                      data:
                        - instrument: eth_usdt
                          exchange: binance
                          exchangeTimestamp: 1717515522361
                          exchangeTimestampNanoseconds: 21307
                          bid: 3797.2
                          ask: 3797.21
                          mid: 3797.205
                          last: null
                          bidVolume: 38.2898
                          askVolume: 13.422
                          sequence: '33179708313'
                          askTimestamp: null
                          bidTimestamp: null
                          askTimestampNanoseconds: null
                          bidTimestampNanoseconds: null
                        - instrument: eth_usdt
                          exchange: binance
                          exchangeTimestamp: 1717515522361
                          exchangeTimestampNanoseconds: 169012
                          bid: 3797.2
                          ask: 3797.21
                          mid: 3797.205
                          last: null
                          bidVolume: 38.2898
                          askVolume: 11.8419
                          sequence: '33179708314'
                          askTimestamp: null
                          bidTimestamp: null
                          askTimestampNanoseconds: null
                          bidTimestampNanoseconds: null
              schema:
                type: object
                properties:
                  status:
                    type: integer
                  title:
                    type: string
                  description:
                    type: string
                  payload:
                    type: object
                    properties:
                      metadata:
                        type: object
                        properties:
                          next:
                            type: string
                          api-version:
                            type: string
                      data:
                        type: array
                        items:
                          type: object
                          properties:
                            instrument:
                              type: string
                            exchange:
                              type: string
                            exchangeTimestamp:
                              type: integer
                            exchangeTimestampNanoseconds:
                              type: integer
                            bid:
                              type: number
                            ask:
                              type: number
                            mid:
                              type: number
                            last:
                              type: string
                            bidVolume:
                              type: number
                            askVolume:
                              type: number
                            sequence:
                              type: string
                            askTimestamp:
                              type: number
                            bidTimestamp:
                              type: number
                            askTimestampNanoseconds:
                              type: number
                            bidTimestampNanoseconds:
                              type: number
      deprecated: false
      security:
        - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````