> ## 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

> Provides historical OHLCV (Open, High, Low, Close, Volume) data for options contracts, enabling analysis of price movements and trading volumes over time for specific contracts across supported exchanges.

<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 12 months of daily data.
</Note>

<Tip>
  Block trades are included in the calculation of OHLCV for Deribit.
</Tip>


## OpenAPI

````yaml get /options/ohlcv/{instrument}
openapi: 3.1.0
info:
  title: market-api
  version: '2'
servers:
  - url: https://api.amberdata.com/markets
security:
  - ApiKeyAuth: []
paths:
  /options/ohlcv/{instrument}:
    get:
      summary: Historical
      description: >-
        Provides historical OHLCV (Open, High, Low, Close, Volume) data for
        options contracts, enabling analysis of price movements and trading
        volumes over time for specific contracts across supported exchanges.
      operationId: options-ohlcv-historical
      parameters:
        - name: instrument
          in: path
          description: The instrument for which to retrieve the requested data.
          schema:
            type: string
            default: BTC-27DEC24-100000-C
          required: true
        - name: exchange
          in: query
          description: '**[Default]** All available exchanges.'
          required: true
          schema:
            type: string
            default: deribit
        - name: startDate
          in: query
          description: >-
            **[Optional]** Payload only includes data after this date
            (inclusive). **[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). **[Formats]** `seconds | milliseconds | iso8601`
            **[Examples]** `1578531600 | 1578531600000 | 2020-09-01T01:00:00`
          schema:
            type: string
            format: date-time
        - name: timeInterval
          in: query
          description: >-
            Time interval to return the historical data in ("days" | "hours" |
            "minutes")
          schema:
            type: string
        - name: timeFormat
          in: query
          description: >-
            **[Optional]** Time format of the timestamps in the return payload.
            **[Defaults]** `milliseconds | ms* | iso | iso8601 | hr |
            human_readable`
          schema:
            type: string
        - 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:
                Success:
                  value:
                    status: 200
                    title: OK
                    description: Successful request
                    payload:
                      metadata:
                        next: >-
                          https://api.amberdata.com/markets/options/ohlcv/BTC-29DEC23-30000-C?cursor=N4IgpgHgxgFghgOwOZhALhAEzAJwJYBGeALiADQhQCuOAzgPY7oJUA2rFtxcOxAInGKo0ARgBsATgDsADikBWAEwAGVaopgEmAUPQipi-fIAsYmTMNiKxPAFswASQRCcANzit0oBHHvoscACetOQgtACOrAByvsIBgaER0bEACqw0Hv6YcHisCRTYAGZwbKRoAMziiorGauogtnAQ6GLlNcYydcoUrPT0ANYEcFD9Kbh49JjoKgC%2BFHgIUOnYAKoItFQADpuMQpgAotDwyGAhaMWstGDWdmAAYoyNZQ25rHhXUPRaIRSFj4L%2BABWDAQoVYcC4AHEcPQtl4sOMiGVQDZ7FxfJs9JJZAoVHUbmjuLZNjEEPQPl9MGduiAFthmmhlDNmUA
                        api-version: '2023-09-30'
                      data:
                        - instrument: BTC-29DEC23-30000-C
                          exchange: deribit
                          exchangeTimestamp: 1690185600000
                          open: 0.128
                          high: 0.128
                          low: 0.1145
                          close: 0.1155
                          volume: 28.5
              schema:
                oneOf:
                  - title: Success
                    type: object
                    properties:
                      status:
                        type: integer
                        example: 200
                        default: 0
                      title:
                        type: string
                        example: OK
                      description:
                        type: string
                        example: Successful request
                      payload:
                        type: object
                        properties:
                          metadata:
                            type: object
                            properties:
                              next:
                                type: string
                                example: >-
                                  https://api.amberdata.com/markets/options/ohlcv/BTC-29DEC23-30000-C?cursor=N4IgpgHgxgFghgOwOZhALhAEzAJwJYBGeALiADQhQCuOAzgPY7oJUA2rFtxcOxAInGKo0ARgBsATgDsADikBWAEwAGVaopgEmAUPQipi-fIAsYmTMNiKxPAFswASQRCcANzit0oBHHvoscACetOQgtACOrAByvsIBgaER0bEACqw0Hv6YcHisCRTYAGZwbKRoAMziiorGauogtnAQ6GLlNcYydcoUrPT0ANYEcFD9Kbh49JjoKgC%2BFHgIUOnYAKoItFQADpuMQpgAotDwyGAhaMWstGDWdmAAYoyNZQ25rHhXUPRaIRSFj4L%2BABWDAQoVYcC4AHEcPQtl4sOMiGVQDZ7FxfJs9JJZAoVHUbmjuLZNjEEPQPl9MGduiAFthmmhlDNmUA
                              api-version:
                                type: string
                                example: '2023-09-30'
                          data:
                            type: array
                            items:
                              type: object
                              properties:
                                instrument:
                                  type: string
                                  example: BTC-29DEC23-30000-C
                                exchange:
                                  type: string
                                  example: deribit
                                exchangeTimestamp:
                                  type: integer
                                  example: 1690185600000
                                  default: 0
                                open:
                                  type: number
                                  example: 0.128
                                  default: 0
                                high:
                                  type: number
                                  example: 0.128
                                  default: 0
                                low:
                                  type: number
                                  example: 0.1145
                                  default: 0
                                close:
                                  type: number
                                  example: 0.1155
                                  default: 0
                                volume:
                                  type: number
                                  example: 28.5
                                  default: 0
      deprecated: false
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````