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

# Get Long Short Ratio Data

> **Feature Overview**
[OpenAPI JSON Spec](/docs/output/v1_crypto_long-short-ratio_get.json)
Get long short ratio data for a specific trading pair symbol with time range filtering.

**Main Use Cases**
- **Market Sentiment Analysis**: Track the ratio of long to short positions over time
- **Trading Strategy**: Use long/short ratio as a contrarian or confirmation indicator
- **Risk Management**: Monitor extreme positioning in the market
- **Technical Analysis**: Combine with price action for comprehensive analysis

**Query Parameters & Logic**

**Required Parameters:**
- `symbol`: Trading pair symbol (e.g., BTCUSDT)
- `start_time`: Start timestamp (Unix seconds)
- `end_time`: End timestamp (Unix seconds)

**Optional Parameters:**
- `limit`: Maximum number of results to return (1-1000, default: 30)
- `exchange`: Exchange name (only "binance" supported, default: binance)
- `interval`: Time interval (only "1d" supported, default: 1d)

**Supported Intervals:**
- `1d`: 1-day intervals (default)

**Validation Rules:**
- Symbol is required and must be a valid trading pair
- start_time must be before end_time
- Limit defaults to 30 if not provided, max 1000
- Exchange defaults to "binance" if not provided
- Interval defaults to "1d" if not provided

**Response Data Structure**

- `data` ([]LongShortRatioData): Array of long short ratio data points (latest first, reverse chronological order)
- `count` (int32): Actual number of data points returned (0-1000)
- `latest_time` (string): Timestamp of the most recent data point (Unix seconds as string)

**LongShortRatioData fields:**
- `symbol` (string): Trading pair symbol (e.g., "BTCUSDT")
- `long_short_ratio` (string): Long/Short ratio in string format (e.g., "2.2798" means 2.28:1 long:short)
- `long_account_ratio` (number): Long account proportion (e.g., 0.65 means 65% of accounts are long; 0 when source data is missing)
- `short_account_ratio` (number): Short account proportion (e.g., 0.35 means 35% of accounts are short; 0 when source data is missing)
- `timestamp` (string): Unix timestamp in seconds as string (e.g., "1763978100")

**Data Interpretation:**
- longShortRatio > 1.0: More accounts are long (bullish sentiment)
- longShortRatio = 1.0: Equal long and short positions (neutral)
- longShortRatio < 1.0: More accounts are short (bearish sentiment)

**Usage Examples**

1. **Minimal request (uses defaults)**: `?symbol=BTCUSDT&start_time=1733270400&end_time=1733356800`
2. **With custom limit**: `?symbol=BTCUSDT&start_time=1733270400&end_time=1733356800&limit=100`
3. **Full parameters**: `?symbol=BTCUSDT&start_time=1733270400&end_time=1733356800&limit=100&interval=5min&exchange=binance`

**Important Notes**

- All required parameters must be provided
- Results are ordered by timestamp in descending order (latest first)
- Higher long/short ratio indicates more bullish sentiment
- Data is provided in 1-day intervals (1d)



## OpenAPI

````yaml /api-reference/openapi.json get /v1/crypto/long-short-ratio
openapi: 3.0.0
info:
  contact: {}
  description: >-
    Welcome to Arrays!


    Arrays is a unified financial data layer for both financial institutions and
    retail users, delivering comprehensive market data across crypto and equity
    markets. Our datasets cover fundamentals, ETFs, options, crypto, and more.


    Visit [arrays.org](https://arrays.org) to request an API key and start your
    free trial. You can explore our full API offerings in the documentation
    below.


    For any questions regarding APIs or pricing, please contact
    support@arrays.org.
  title: Arrays API
  version: '1.0'
servers:
  - url: https://data-tools.prd.arrays.org/api
security: []
paths:
  /v1/crypto/long-short-ratio:
    get:
      tags:
        - Crypto
      summary: Get Long Short Ratio Data
      description: >-
        **Feature Overview**

        [OpenAPI JSON Spec](/docs/output/v1_crypto_long-short-ratio_get.json)

        Get long short ratio data for a specific trading pair symbol with time
        range filtering.


        **Main Use Cases**

        - **Market Sentiment Analysis**: Track the ratio of long to short
        positions over time

        - **Trading Strategy**: Use long/short ratio as a contrarian or
        confirmation indicator

        - **Risk Management**: Monitor extreme positioning in the market

        - **Technical Analysis**: Combine with price action for comprehensive
        analysis


        **Query Parameters & Logic**


        **Required Parameters:**

        - `symbol`: Trading pair symbol (e.g., BTCUSDT)

        - `start_time`: Start timestamp (Unix seconds)

        - `end_time`: End timestamp (Unix seconds)


        **Optional Parameters:**

        - `limit`: Maximum number of results to return (1-1000, default: 30)

        - `exchange`: Exchange name (only "binance" supported, default: binance)

        - `interval`: Time interval (only "1d" supported, default: 1d)


        **Supported Intervals:**

        - `1d`: 1-day intervals (default)


        **Validation Rules:**

        - Symbol is required and must be a valid trading pair

        - start_time must be before end_time

        - Limit defaults to 30 if not provided, max 1000

        - Exchange defaults to "binance" if not provided

        - Interval defaults to "1d" if not provided


        **Response Data Structure**


        - `data` ([]LongShortRatioData): Array of long short ratio data points
        (latest first, reverse chronological order)

        - `count` (int32): Actual number of data points returned (0-1000)

        - `latest_time` (string): Timestamp of the most recent data point (Unix
        seconds as string)


        **LongShortRatioData fields:**

        - `symbol` (string): Trading pair symbol (e.g., "BTCUSDT")

        - `long_short_ratio` (string): Long/Short ratio in string format (e.g.,
        "2.2798" means 2.28:1 long:short)

        - `long_account_ratio` (number): Long account proportion (e.g., 0.65
        means 65% of accounts are long; 0 when source data is missing)

        - `short_account_ratio` (number): Short account proportion (e.g., 0.35
        means 35% of accounts are short; 0 when source data is missing)

        - `timestamp` (string): Unix timestamp in seconds as string (e.g.,
        "1763978100")


        **Data Interpretation:**

        - longShortRatio > 1.0: More accounts are long (bullish sentiment)

        - longShortRatio = 1.0: Equal long and short positions (neutral)

        - longShortRatio < 1.0: More accounts are short (bearish sentiment)


        **Usage Examples**


        1. **Minimal request (uses defaults)**:
        `?symbol=BTCUSDT&start_time=1733270400&end_time=1733356800`

        2. **With custom limit**:
        `?symbol=BTCUSDT&start_time=1733270400&end_time=1733356800&limit=100`

        3. **Full parameters**:
        `?symbol=BTCUSDT&start_time=1733270400&end_time=1733356800&limit=100&interval=5min&exchange=binance`


        **Important Notes**


        - All required parameters must be provided

        - Results are ordered by timestamp in descending order (latest first)

        - Higher long/short ratio indicates more bullish sentiment

        - Data is provided in 1-day intervals (1d)
      parameters:
        - description: Crypto token symbol (e.g., BTC, ETH, SOL)
          in: query
          name: symbol
          required: true
          schema:
            type: string
        - description: Start timestamp (Unix seconds)
          in: query
          name: start_time
          required: true
          schema:
            type: integer
            format: int64
        - description: End timestamp (Unix seconds)
          in: query
          name: end_time
          required: true
          schema:
            type: integer
            format: int64
        - description: 'Maximum number of results (1-1000, default: 30)'
          in: query
          name: limit
          schema:
            type: integer
            format: int32
            default: 30
        - description: 'Exchange name (only binance supported, default: binance)'
          in: query
          name: exchange
          schema:
            type: string
            enum:
              - binance
            default: binance
        - description: 'Time interval (only 1d supported, default: 1d)'
          in: query
          name: interval
          schema:
            type: string
            enum:
              - 1d
            default: 1d
      responses:
        '200':
          description: Successfully returns long short ratio data
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/model.APIResponse'
                  - properties:
                      data:
                        items:
                          $ref: '#/components/schemas/model.LongShortRatioData'
                        type: array
                    type: object
        '400':
          description: Parameter validation error
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/model.APIResponse'
                  - properties:
                      error:
                        $ref: '#/components/schemas/model.APIError'
                    type: object
        '404':
          description: Trading pair not found
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/model.APIResponse'
                  - properties:
                      error:
                        $ref: '#/components/schemas/model.APIError'
                    type: object
        '500':
          description: Internal server error - gRPC service failure
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/model.APIResponse'
                  - properties:
                      error:
                        $ref: '#/components/schemas/model.APIError'
                    type: object
      security:
        - ApiKeyAuth: []
components:
  schemas:
    model.APIResponse:
      properties:
        data: {}
        error:
          $ref: '#/components/schemas/model.APIError'
        metadata: {}
        pagination: {}
        request_id:
          type: string
        success:
          type: boolean
      type: object
    model.LongShortRatioData:
      properties:
        long_account_ratio:
          description: 多单账户占比
          type: number
        long_short_ratio:
          description: 多空比率
          type: number
        short_account_ratio:
          description: 空单账户占比
          type: number
        symbol:
          type: string
        time:
          description: Formatted time (YYYY-MM-DD hh:mm:ss, UTC+0)
          type: string
        timestamp:
          description: Unix时间戳（秒）
          type: integer
      type: object
    model.APIError:
      properties:
        code:
          example: RESOURCE_NOT_FOUND
          type: string
        details:
          items:
            $ref: '#/components/schemas/model.APIErrorDetail'
          type: array
        docs_url:
          type: string
        examples:
          items:
            type: string
          type: array
        hint:
          type: string
        message:
          example: The requested resource was not found.
          type: string
        suggestions:
          items:
            type: string
          type: array
      type: object
    model.APIErrorDetail:
      properties:
        field:
          type: string
        got:
          type: string
        reason:
          type: string
      type: object
  securitySchemes:
    ApiKeyAuth:
      description: 'API Key authentication. Example: "your-api-key-here"'
      in: header
      name: X-API-Key
      type: apiKey

````