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

# Long/Short Ratio History



## OpenAPI

````yaml openapi.json GET /gateway/v1/exchange/long-short-ratio
openapi: 3.1.0
info:
  title: Hermod
  version: 0.0.1
servers:
  - url: https://api.asksurf.ai
security: []
paths:
  /gateway/v1/exchange/long-short-ratio:
    get:
      tags:
        - Exchange
      summary: Exchange Long/Short Ratio History
      description: >-
        Returns historical long/short ratio for a perpetual contract.


        **Included fields:** ratio value, long account percentage, short account
        percentage.


        **Granularity:** `interval` supports `1h`, `4h`, `1d`.


        **Pagination:** use `from` for start time and `limit` for result count.
        For longer history, pass the last returned timestamp as the next `from`
        value.


        **Note:** not all exchanges support historical queries via `from`; some
        only return recent data regardless.


        Just pass the base pair (e.g. `pair=BTC/USDT`). For aggregated
        cross-exchange long/short ratio, see `/market/futures`.
      operationId: exchange-long-short-ratio
      parameters:
        - description: Trading pair (e.g. BTC/USDT)
          explode: false
          in: query
          name: pair
          required: true
          schema:
            description: Trading pair (e.g. BTC/USDT)
            examples:
              - BTC/USDT
            type: string
        - description: Data interval
          explode: false
          in: query
          name: interval
          schema:
            default: 1h
            description: Data interval
            enum:
              - 1h
              - 4h
              - 1d
            examples:
              - 1h
            type: string
        - description: >-
            Start of time range. Accepts Unix seconds or date string
            (YYYY-MM-DD, ISO8601). Not all exchanges support historical queries;
            some only return recent data regardless of this value.
          explode: false
          in: query
          name: from
          schema:
            description: >-
              Start of time range. Accepts Unix seconds or date string
              (YYYY-MM-DD, ISO8601). Not all exchanges support historical
              queries; some only return recent data regardless of this value.
            examples:
              - '2026-03-01'
            type: string
        - description: >-
            Max number of records. For longer history, paginate using the last
            returned timestamp as the next from value.
          explode: false
          in: query
          name: limit
          schema:
            default: 50
            description: >-
              Max number of records. For longer history, paginate using the last
              returned timestamp as the next from value.
            examples:
              - 50
            format: int64
            maximum: 500
            minimum: 1
            type: integer
        - description: Exchange identifier
          explode: false
          in: query
          name: exchange
          schema:
            default: binance
            description: Exchange identifier
            enum:
              - binance
              - okx
              - bybit
              - bitget
            examples:
              - binance
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/SimpleListResponseExchangeLongShortRatioItem
          description: OK
        default:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DataAPIError'
          description: Error
      security:
        - AccessToken: []
components:
  schemas:
    SimpleListResponseExchangeLongShortRatioItem:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - >-
              https://example.com/schemas/SimpleListResponseExchangeLongShortRatioItem.json
          format: uri
          readOnly: true
          type: string
        data:
          items:
            $ref: '#/components/schemas/ExchangeLongShortRatioItem'
          type:
            - array
            - 'null'
        meta:
          $ref: '#/components/schemas/ObjectResponseMeta'
      required:
        - data
        - meta
      type: object
    DataAPIError:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
            - https://example.com/schemas/DataAPIError.json
          format: uri
          readOnly: true
          type: string
        error:
          $ref: '#/components/schemas/DataAPIErrorDetail'
      required:
        - error
      type: object
    ExchangeLongShortRatioItem:
      additionalProperties: false
      properties:
        exchange:
          description: Exchange identifier
          type: string
        long_short_ratio:
          description: >-
            Ratio of longs to shorts (e.g. 1.5 means 60% long / 40% short). To
            get percentages: long% = ratio/(ratio+1)*100, short% = 100/(ratio+1)
          format: double
          type:
            - number
            - 'null'
        pair:
          description: Perpetual contract pair like BTC/USDT
          type: string
        timestamp:
          description: Unix timestamp in seconds
          format: int64
          type:
            - integer
            - 'null'
      required:
        - exchange
        - pair
        - long_short_ratio
        - timestamp
      type: object
    ObjectResponseMeta:
      additionalProperties: false
      properties:
        cached:
          description: Whether this response was served from cache
          type: boolean
        credits_used:
          description: Credits deducted for this request
          format: int64
          type: integer
      required:
        - credits_used
        - cached
      type: object
    DataAPIErrorDetail:
      additionalProperties: false
      properties:
        code:
          type: string
        message:
          type: string
      required:
        - code
        - message
      type: object

````