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

> ## Agent Instructions
> These docs cover the Darvas financial data API, its MCP server, data API and Darvas Pro+ webhooks, and Pine Script custom indicators for Darvas charts.
> https://docs.darvas.app/llms.txt lists every indexed page with a summary, and https://docs.darvas.app/llms-full.txt holds them in one file. Add .md to any page URL to read that page as Markdown. The lookup lists of tickers, types and series are named at https://docs.darvas.app/ai-agents.
> The docs MCP server https://docs.darvas.app/mcp searches and reads these docs. It needs no key.
> Call the REST API at https://api.darvas.app/v1. Send the API key, which starts with dvk_, in the X-API-KEY header or as Authorization: Bearer. The OpenAPI 3.1 spec of all 168 operations is https://docs.darvas.app/openapi.yaml.
> Name a company by ticker or cik. A share class takes a dot or a dash, so BRK.B and BRK-B name the same shares. Dates are YYYY-MM-DD.
> A list answer holds one page. Request its next_page_url as it is until the answer has none. limit counts rows across all pages.
> Errors are JSON with a stable error code and a message: 400 VALIDATION_ERROR, 401 UNAUTHORIZED, 403 PLAN_REQUIRED, 404 NOT_FOUND, 429 RATE_LIMITED or QUOTA_EXCEEDED, 500 INTERNAL_ERROR and 503 UNAVAILABLE. On a 429, wait the seconds in Retry-After. 1 credit = 1 successful call: a 2xx answer with data costs one credit however many rows it holds (at most 1,000 a page), and empty answers, errors and FINRA /short-volume cost 0 credits.
> The Financial Data MCP server is https://api.darvas.app/mcp (Streamable HTTP, protocol 2025-11-25, the same API key in X-API-KEY or as a Bearer token). tools/list answers 8 flagship tools plus search_data_tools and call_data_tool by default; ?mode=full lists all 164 tools and ?toolsets=sec,crypto,macro lists domains. Every tool is callable by name, takes response_format (json, compact or tsv) and fields, and a list answer's cursor value goes in the cursor argument. The darvas://catalog/* resources cost 0 credits. Setup for each client is at https://docs.darvas.app/mcp-server.
> The data API covers SEC filers and their filings, statements, XBRL facts, debt maturities, ownership and earnings, US stock prices, technicals and FINRA short volume, macro series and a global economic calendar.
> Its crypto data covers prices, indices, order books, order flow, volume profiles, derivatives, options, liquidations, spot ETF flows and a screener across 9 exchanges. It also covers DeFi protocols, stablecoins, yields and DEX pairs, and Polymarket, Kalshi and OKX prediction markets. https://docs.darvas.app/market-coverage gives the history and update time of each dataset.
> https://docs.darvas.app/ai-agents names the endpoint and the MCP tool that answer each kind of question about these datasets.
> Custom indicators for Darvas charts are Pine Script v5 or v6 indicator() or strategy() scripts. Darvas rewrites Pine v1 to v4 to v5 and runs no other indicator language. Start at https://docs.darvas.app/pine-script/introduction.
> https://docs.darvas.app/pine-script/support lists the Pine Script that Darvas runs. https://docs.darvas.app/pine-script/request-security covers request.security() and request.financial(), and https://docs.darvas.app/pine-script/limits lists the run limits.
> Darvas Pro+ webhooks send a signed POST for alarm fires and pauses, scheduled answers, economic calendar alerts, ETF flow updates, ended connections and the data API events. https://docs.darvas.app/pro/webhooks lists every event, its object and how to verify the Darvas-Signature header.

# Live L2 Crypto Order Book Depth & Spread API

> Query live Level 2 crypto order book bids, asks, spread and depth imbalance from a single exchange or merged across multiple top crypto venues.

## Overview

Query the live Level 2 order book of any supported crypto spot or perpetual swap market. By default (`exchange=darvas`), Darvas reads every constituent exchange of a Darvas pair simultaneously and merges resting bids and asks price level by price level. Every quantity is normalized to the base asset, including OKX perpetual contracts converted from contract counts into coins.

| Coverage | Details |
| - | - |
| Aggregated book | `darvas` (default) merges live OKX, Binance, Bybit and Hyperliquid books for a Darvas pair such as `BTC-USDT-SWAP` or `BTC-ALLUSD` |
| Single exchanges | `okx`, `binance`, `bybit` and `hyperliquid` (Hyperliquid perpetuals only, capped at 20 levels per side) |
| Market types | Spot and perpetual swap; dated futures and options return HTTP `400` |
| Depth range | `depth` from `1` to `400` levels per side (default `50`), read from each constituent venue |
| Computed summary | Best bid and ask, mid price, spread, four percentage depth bands and the five largest bid and ask walls |
| MCP tool | `get_crypto_order_book` on the [data API MCP server](https://docs.darvas.app/mcp-server.md) |

## Parameters

Pass `ticker` for every call and refine aggregation, depth, price grouping or payload size with optional query parameters.

| Parameter | Type | Default | Description |
| - | - | - | - |
| `ticker` | string | required | Darvas pair (such as `BTC-USDT-SWAP`) or exchange-native symbol (such as `perpetual:BTCUSDT`). |
| `exchange` | string | `darvas` | Venue selector: `darvas` for merged cross-venue depth, or one of `okx`, `binance`, `bybit`, `hyperliquid`. |
| `market_type` | string | inferred | Optional `spot` or `swap` disambiguator when a ticker string is ambiguous. |
| `venues` | string | `null` | Comma-separated subset of exchanges to merge when `exchange=darvas`; rejected with `400` for single-exchange calls. |
| `depth` | integer | `50` | Number of bid and ask levels to read per exchange and include in the response (`1` to `400`). |
| `grouping` | number | `null` | Coarse price increment for bucketing levels, such as `10` for 10-dollar ticks on BTC. |
| `include_levels` | string | `true` | Set `false` to omit raw `bids` and `asks` arrays while keeping all summary metrics and `sources`. |

## Response fields

### Top-of-book and spread

Top-of-book fields summarize execution cost at the touch across the chosen venue or merged book:

* `best_bid` and `best_ask`: highest bid price and lowest ask price in the active book.
* `mid_price`: arithmetic midpoint between `best_bid` and `best_ask`.
* `spread` and `spread_percent`: `best_ask - best_bid` and the spread as a percentage of `mid_price`. On a merged `darvas` book, `spread` can turn negative when one exchange's best bid sits above another exchange's best ask.

### Depth bands and liquidity walls

Depth summaries measure resting liquidity away from the mid price without scanning raw level arrays on the client:

1. **Percentage depth bands (`depth`).** Four buckets covering `0.25%`, `0.5%`, `1%` and `2%` from `mid_price`. Each bucket reports `bid_size` and `ask_size` in base coins, `bid_notional` and `ask_notional` in quote currency and `bid_share` (`null` if both sides are empty). Raise the `depth` query parameter when wide bands need deeper exchange coverage.
2. **Resting liquidity walls (`bid_walls`, `ask_walls`).** Lists up to the five largest price levels on each side with `price` and `size`, sorted by resting size so large support and resistance clusters stand out immediately.

### Price level grouping and summary mode

* **Price bucketing (`grouping`).** Bids round down and asks round up onto the requested step so grouped levels never cross each other. When omitted, native exchange ticks remain intact and the payload echoes `grouping: null`.
* **Lightweight polling (`include_levels=false`).** Returns empty `bids: []` and `asks: []` arrays while preserving `best_bid`, `best_ask`, `depth`, `bid_walls`, `ask_walls`, `bid_levels`, `ask_levels` and `sources`.

| Field | Description |
| - | - |
| `ticker`, `exchange`, `market_type`, `size_unit` | Resolved instrument, venue mode, market type (`spot` or `swap`) and `base` size unit. |
| `constituents`, `venues` | Present for `exchange=darvas`: all constituent venues of the pair and the applied `venues` filter (`null` when unfiltered). |
| `as_of`, `grouping` | UTC timestamp of the newest venue book read, plus the active price grouping increment or `null`. |
| `bids`, `asks` | Ordered level arrays (best price first), each item containing `price`, `size` and `notional`. |
| `bid_levels`, `ask_levels` | Total bid and ask levels present in the built book before any `include_levels=false` trimming. |
| `sources` | Per-exchange diagnostics carrying `exchange`, `ticker`, `status`, `as_of`, best prices and level counts. |

## Exchange sources and error handling

### Source status codes

Every element in `sources` reports how each constituent exchange contributed to the response:

* `ok`: Darvas read the live exchange order book and merged its levels into the output.
* `unavailable`: the exchange request failed at query time, so the merged book excludes that venue without failing the entire call.
* `unsupported`: the instrument trades on that exchange, but Darvas does not collect live L2 books from that venue.

### HTTP status responses

1. `400 Bad Request`: invalid ticker, unsupported market type (such as dated futures or options), a `venues` filter on a non-`darvas` exchange, or a Darvas pair whose venues have no readable order books.
2. `404 Not Found`: a single-exchange book returned an empty bid or ask side at the moment of the request.
3. `503 Service Unavailable`: the requested single exchange failed, or every readable constituent exchange of a merged `darvas` pair failed simultaneously.

### Related order-flow endpoints

* Historical resting liquidity over time: [`/crypto/order-book/heatmap`](https://docs.darvas.app/crypto/order-book-heatmap)
* Price-level aggressive volume and delta: [`/crypto/footprint`](https://docs.darvas.app/crypto/footprint-charts) and [`/crypto/order-flow`](https://docs.darvas.app/crypto/order-flow)
* Instrument discovery and Darvas pair definitions: [`/crypto/tickers`](https://docs.darvas.app/crypto/tickers)

## Examples

### Merged book with price grouping

Read a 200-level aggregated `BTC-USDT-SWAP` book grouped onto 10-dollar ticks and inspect depth imbalance, venue status and resting walls.

```python theme={null}
import os
import requests

headers = {"X-API-KEY": os.environ["DARVAS_API_KEY"]}
book = requests.get(
    "https://api.darvas.app/v1/crypto/order-book",
    headers=headers,
    params={"ticker": "BTC-USDT-SWAP", "depth": 200, "grouping": 10},
).json()

print("Mid:", book["mid_price"], "Spread %:", book["spread_percent"])
for band in book["depth"]:
    print(f'{band["percent"]}% band: bid {band["bid_size"]} / ask {band["ask_size"]}, bid share {band["bid_share"]}')
for source in book["sources"]:
    print(source["exchange"], source["status"], source["bid_levels"], source["ask_levels"])
print("Largest bid wall:", book["bid_walls"][0], "Largest ask wall:", book["ask_walls"][0])
```

### Single-exchange summary without raw levels

Poll spread, depth bands and top walls across 400 levels of Binance `BTCUSDT` perpetual while omitting the raw level lists for minimal payload size.

```bash theme={null}
curl -H "X-API-KEY: $DARVAS_API_KEY" \
  "https://api.darvas.app/v1/crypto/order-book?ticker=perpetual:BTCUSDT&exchange=binance&depth=400&include_levels=false"
```


## OpenAPI

````yaml openapi.yaml GET /crypto/order-book
openapi: 3.1.1
info:
  title: Darvas Data API
  version: 0.9.0
  summary: >-
    Company, filing, insider, institutional, market and macro data for every SEC
    filer, US stocks, UK and French companies and crypto markets.
  description: >-
    Every value names its source. Field names follow the common financial data
    API shapes, so an existing client reads these answers unchanged; extra
    fields come after them. Send the API key in the X-API-KEY header or as a
    Bearer token. Dates are ISO 8601 and times are RFC 3339 in UTC. Billing: 1
    credit = 1 successful call. A page holds at most 1,000 rows and costs one
    credit however many it holds; an empty answer, a refusal, an error and every
    FINRA /short-volume call cost 0 credits.
  termsOfService: https://darvas.app/terms
  contact:
    name: Darvas data
    url: https://darvas.app
    email: support@darvas.app
  license:
    name: Proprietary
    identifier: LicenseRef-Darvas-Proprietary
servers:
  - url: https://api.darvas.app/v1
    description: Production.
  - url: https://darvas.app/api/data/v1
    description: Production, on the darvas.app host.
security:
  - apiKey: []
  - bearerKey: []
tags:
  - name: company
    description: Company profiles from SEC submissions.
  - name: crypto
    description: >-
      Candles, trades, order books, order flow, derivatives, options, screens
      and market structure of crypto instruments from Darvas's own market data.
  - name: defi
    description: >-
      Multi-chain DeFi protocol TVL, stablecoin supply, yield pools, and
      on-chain DEX liquidity.
  - name: earnings
    description: >-
      Each filing that reports a period, the 8-K earnings release, then the 10-Q
      or 10-K, and the KPIs, guidance and non-GAAP metrics of the releases.
  - name: filings
    description: >-
      SEC filing lists, the items of 10-K, 10-Q and 8-K filings, and search over
      them.
  - name: financials
    description: >-
      Standardized income statements, balance sheets and cash flow statements
      from XBRL filings.
  - name: funds
    description: Holdings of registered funds and ETFs from Form N-PORT.
  - name: insiders
    description: >-
      Insider trades and holdings from Forms 3, 4 and 5, and sale notices from
      Form 144.
  - name: institutions
    description: Positions of investment managers from Form 13F reports.
  - name: ipos
    description: Registration statements and prospectuses of companies going public.
  - name: macro
    description: >-
      Policy rates, the Treasury yield curve, inflation, jobs and GDP from their
      publishers.
  - name: markets
    description: >-
      Market structure data: the shares that failed to settle each day, from
      SEC, and futures positions by trader group, from the CFTC.
  - name: news
    description: >-
      Company 8-K filings and the press releases of the Federal Reserve, the
      SEC, the BEA and the BLS.
  - name: ownership
    description: Owners of more than 5% from Schedules 13D and 13G.
  - name: prediction-markets
    description: >-
      Binary event contract odds and series across Polymarket, Kalshi and OKX
      plus cross-venue arbitrage spreads.
  - name: tokenized-stocks
    description: >-
      Coinbase stock tokens on Base, priced by their USDC pools, and the stock
      instruments of OKX and Bybit.
  - name: webhooks
    description: >-
      Destinations that receive a signed event when new filings, statements,
      insider forms or macro releases arrive.
externalDocs:
  description: Market coverage
  url: https://docs.darvas.app/market-coverage
paths:
  /crypto/order-book:
    get:
      tags:
        - crypto
      summary: Read a live crypto order book
      description: >-
        The live L2 order book of an OKX, Binance, Bybit or Hyperliquid market,
        or with exchange darvas, the default, the books of every exchange a
        Darvas pair combines read at once and merged level by level. Sizes are
        in the base asset everywhere: OKX contracts are turned into coins. The
        answer carries the best bid and ask, the spread, the size and notional
        resting within 0.25, 0.5, 1 and 2 percent of the mid, the five largest
        levels a side and each exchange's status; grouping merges levels onto a
        coarser price grid, bids rounded down and asks up. Hyperliquid serves 20
        levels a side.
      operationId: getCryptoOrderBook
      parameters:
        - $ref: '#/components/parameters/CryptoTicker'
        - $ref: '#/components/parameters/OrderBookExchange'
        - $ref: '#/components/parameters/SpotSwapMarketType'
        - $ref: '#/components/parameters/DarvasVenues'
        - $ref: '#/components/parameters/OrderBookDepth'
        - $ref: '#/components/parameters/OrderBookIncludeLevels'
        - $ref: '#/components/parameters/OrderBookGrouping'
      responses:
        '200':
          description: 'Read a live crypto order book: one page.'
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/RateLimitLimit'
            X-Quota-Unit:
              $ref: '#/components/headers/QuotaUnit'
            X-Credits-Used:
              $ref: '#/components/headers/CreditsUsed'
            X-Quota-Limit:
              $ref: '#/components/headers/QuotaLimit'
            X-Quota-Remaining:
              $ref: '#/components/headers/QuotaRemaining'
            X-Quota-Reset:
              $ref: '#/components/headers/QuotaReset'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CryptoOrderBookResponse'
              example:
                ticker: BTC-USDT-SWAP
                exchange: darvas
                market_type: swap
                constituents:
                  - binance
                  - bybit
                  - hyperliquid
                  - okx
                venues: null
                as_of: '2026-11-28T12:00:00.180Z'
                size_unit: base
                grouping: null
                best_bid: 97810.4
                best_ask: 97810.5
                mid_price: 97810.45
                spread: 0.1
                spread_percent: 0.000102
                depth:
                  - percent: 0.5
                    bid_size: 182.4
                    ask_size: 141.9
                    bid_notional: 17752000.5
                    ask_notional: 13961000.2
                    bid_share: 0.5624
                bid_walls:
                  - price: 97500
                    size: 38.6
                ask_walls:
                  - price: 98200
                    size: 31.2
                bid_levels: 50
                ask_levels: 50
                sources:
                  - exchange: okx
                    ticker: BTC-USDT-SWAP
                    status: ok
                    as_of: '2026-11-28T12:00:00.120Z'
                    best_bid: 97810.4
                    best_ask: 97810.5
                    bid_levels: 50
                    ask_levels: 50
                bids:
                  - price: 97810.5
                    size: 4.21
                    notional: 411782.2
                asks:
                  - price: 97810.5
                    size: 2.05
                    notional: 200511.53
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/PlanRequired'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
        '503':
          $ref: '#/components/responses/Unavailable'
components:
  parameters:
    CryptoTicker:
      name: ticker
      in: query
      required: true
      description: >-
        The instrument id: BTC-USDT or BTC-USDT-SWAP on OKX, ETH-USDC-SWAP on
        Hyperliquid, BTC-USD on Coinbase, spot:BTCUSDT or perpetual:BTCUSDT on
        Binance and Bybit. A Binance or Bybit symbol such as BTCUSDT also works
        with market_type, spot without it. A Darvas aggregated pair is
        BASE-QUOTE or BASE-QUOTE-SWAP, such as BTC-USDT-SWAP, or BTC-ALLUSD for
        one combining its USD, USDT and USDC markets.
      schema:
        type: string
        pattern: ^[A-Za-z0-9][A-Za-z0-9._:/-]{0,63}$
        maxLength: 64
      example: BTC-USDT
    OrderBookExchange:
      name: exchange
      in: query
      required: false
      description: >-
        okx, binance, bybit or hyperliquid, or darvas for every exchange the
        pair combines merged; darvas without it.
      schema:
        type: string
        enum:
          - darvas
          - okx
          - binance
          - bybit
          - hyperliquid
        default: darvas
        maxLength: 16
      example: okx
    SpotSwapMarketType:
      name: market_type
      in: query
      required: false
      description: spot or swap; without it, the market the ticker implies.
      schema:
        type: string
        enum:
          - spot
          - swap
        maxLength: 8
      example: swap
    DarvasVenues:
      name: venues
      in: query
      required: false
      description: >-
        With exchange darvas: combine only these of the pair's exchanges,
        comma-separated. Any other exchange refuses it.
      schema:
        type: string
        pattern: ^[a-z0-9][a-z0-9-]{0,31}(,[a-z0-9][a-z0-9-]{0,31}){0,15}$
        maxLength: 528
      example: binance,okx
    OrderBookDepth:
      name: depth
      in: query
      required: false
      description: >-
        Levels a side to read from each exchange and to answer (1 to 400;
        default 50).
      schema:
        type: integer
        format: int32
        minimum: 1
        maximum: 400
        default: 50
      example: 100
    OrderBookIncludeLevels:
      name: include_levels
      in: query
      required: false
      description: >-
        false to answer the summary alone, without the bids and asks lists; true
        without it.
      schema:
        type: string
        enum:
          - 'true'
          - 'false'
        default: 'true'
        maxLength: 5
      example: 'false'
    OrderBookGrouping:
      name: grouping
      in: query
      required: false
      description: >-
        A price step to merge levels onto, such as 10 for 10-dollar levels of
        BTC; each exchange's own prices without it.
      schema:
        type: number
        format: double
        exclusiveMinimum: 0
        maximum: 1000000000000
      example: 10
  headers:
    RateLimitLimit:
      description: Requests per minute the key may send; on a 401 the limit a new key gets.
      schema:
        type: integer
        format: int32
        minimum: 1
        maximum: 6000
      example: 60
    QuotaUnit:
      description: >-
        What the quota counts: credits. One credit is one successful call that
        returns data.
      schema:
        type: string
        enum:
          - credits
        maxLength: 7
      example: credits
    CreditsUsed:
      description: >-
        Credits this answer cost: one for a 2xx answer with data, however many
        rows it holds. An empty answer, a refusal, an error and a FINRA
        /short-volume answer cost 0.
      schema:
        type: integer
        format: int64
        minimum: 0
        maximum: 9007199254740991
      example: 1
    QuotaLimit:
      description: >-
        The plan's credits for its period plus the account's pay-as-you-go
        credit balance, as the request found them.
      schema:
        type: integer
        format: int64
        minimum: 0
        maximum: 9007199254740991
      example: 2500000
    QuotaRemaining:
      description: >-
        Credits left after this answer: the plan's own first, then the credit
        balance.
      schema:
        type: integer
        format: int64
        minimum: 0
        maximum: 9007199254740991
      example: 2499999
    QuotaReset:
      description: >-
        When the plan's credits start again, or the trial ends, in seconds since
        1970 (UTC). Pay-as-you-go answers leave it out: their credits never
        expire.
      schema:
        type: integer
        format: int64
        minimum: 0
        maximum: 4102444800
      example: 1767225600
    RetryAfter:
      description: Seconds to wait before the next request.
      schema:
        type: integer
        format: int32
        minimum: 1
        maximum: 60
      example: 1
  schemas:
    CryptoOrderBookResponse:
      type: object
      description: The answer of GET /crypto/order-book.
      additionalProperties: false
      required:
        - ticker
        - exchange
        - market_type
        - as_of
        - size_unit
        - grouping
        - best_bid
        - best_ask
        - mid_price
        - spread
        - spread_percent
        - depth
        - bid_walls
        - ask_walls
        - bid_levels
        - ask_levels
        - sources
        - bids
        - asks
      properties:
        ticker:
          type: string
          pattern: ^[A-Za-z0-9][A-Za-z0-9._:/-]{0,63}$
          maxLength: 64
          description: The instrument id of the book.
          examples:
            - BTC-USDT-SWAP
        exchange:
          type: string
          enum:
            - darvas
            - okx
            - binance
            - bybit
            - hyperliquid
          description: The exchange of the book, or darvas for the merged books.
          examples:
            - darvas
        market_type:
          type: string
          enum:
            - spot
            - swap
          description: The market of the book.
          examples:
            - swap
        constituents:
          type: array
          maxItems: 16
          description: >-
            With exchange darvas: every exchange the pair's book combines.
            Absent for one exchange.
          items:
            type: string
            pattern: ^[a-z0-9][a-z0-9-]{0,31}$
            maxLength: 32
          examples:
            - - binance
              - bybit
              - okx
        venues:
          type:
            - array
            - 'null'
          maxItems: 16
          description: >-
            With exchange darvas: the exchanges the book kept when venues
            narrowed them, null when all are. Absent for one exchange.
          items:
            type: string
            pattern: ^[a-z0-9][a-z0-9-]{0,31}$
            maxLength: 32
          examples:
            - - binance
              - okx
        as_of:
          type: string
          format: date-time
          maxLength: 30
          description: When the newest book read was built, in UTC.
          examples:
            - '2026-11-28T12:00:00.180Z'
        size_unit:
          type: string
          enum:
            - base
          description: 'The unit of every size: the base asset.'
          examples:
            - base
        grouping:
          type:
            - number
            - 'null'
          format: double
          description: >-
            The price step levels were merged onto; null for each exchange's own
            prices.
          examples:
            - null
        best_bid:
          type:
            - number
            - 'null'
          format: double
          description: The highest bid.
          examples:
            - 97810.4
        best_ask:
          type:
            - number
            - 'null'
          format: double
          description: The lowest ask.
          examples:
            - 97810.5
        mid_price:
          type:
            - number
            - 'null'
          format: double
          description: The middle of the best bid and ask.
          examples:
            - 97810.45
        spread:
          type:
            - number
            - 'null'
          format: double
          description: best_ask less best_bid; negative when merged exchanges cross.
          examples:
            - 0.1
        spread_percent:
          type:
            - number
            - 'null'
          format: double
          description: The spread as a percent of the mid; null at a zero mid.
          examples:
            - 0.000102
        depth:
          type: array
          maxItems: 4
          description: Size resting within 0.25, 0.5, 1 and 2 percent of the mid.
          items:
            $ref: '#/components/schemas/CryptoOrderBookDepthBand'
        bid_walls:
          type: array
          maxItems: 5
          description: The five largest bid levels.
          items:
            $ref: '#/components/schemas/CryptoOrderBookWall'
        ask_walls:
          type: array
          maxItems: 5
          description: The five largest ask levels.
          items:
            $ref: '#/components/schemas/CryptoOrderBookWall'
        bid_levels:
          type: integer
          format: int64
          minimum: 0
          maximum: 400
          description: Bid levels in the answer's book.
          examples:
            - 50
        ask_levels:
          type: integer
          format: int64
          minimum: 0
          maximum: 400
          description: Ask levels in the answer's book.
          examples:
            - 50
        sources:
          type: array
          maxItems: 16
          description: Each exchange read, with its status.
          items:
            $ref: '#/components/schemas/CryptoOrderBookSource'
        bids:
          type: array
          maxItems: 400
          description: The bids, best first; empty with include_levels=false.
          items:
            $ref: '#/components/schemas/CryptoOrderBookLevel'
        asks:
          type: array
          maxItems: 400
          description: The asks, best first; empty with include_levels=false.
          items:
            $ref: '#/components/schemas/CryptoOrderBookLevel'
      examples:
        - ticker: BTC-USDT-SWAP
          exchange: darvas
          market_type: swap
          constituents:
            - binance
            - bybit
            - hyperliquid
            - okx
          venues: null
          as_of: '2026-11-28T12:00:00.180Z'
          size_unit: base
          grouping: null
          best_bid: 97810.4
          best_ask: 97810.5
          mid_price: 97810.45
          spread: 0.1
          spread_percent: 0.000102
          depth:
            - percent: 0.5
              bid_size: 182.4
              ask_size: 141.9
              bid_notional: 17752000.5
              ask_notional: 13961000.2
              bid_share: 0.5624
          bid_walls:
            - price: 97500
              size: 38.6
          ask_walls:
            - price: 98200
              size: 31.2
          bid_levels: 50
          ask_levels: 50
          sources:
            - exchange: okx
              ticker: BTC-USDT-SWAP
              status: ok
              as_of: '2026-11-28T12:00:00.120Z'
              best_bid: 97810.4
              best_ask: 97810.5
              bid_levels: 50
              ask_levels: 50
          bids:
            - price: 97810.5
              size: 4.21
              notional: 411782.2
          asks:
            - price: 97810.5
              size: 2.05
              notional: 200511.53
    CryptoOrderBookDepthBand:
      type: object
      description: The size resting within a percent of the mid price.
      additionalProperties: false
      required:
        - percent
        - bid_size
        - ask_size
        - bid_notional
        - ask_notional
        - bid_share
      properties:
        percent:
          type:
            - number
            - 'null'
          format: double
          description: 'The band''s distance from the mid, in percent: 0.25, 0.5, 1 or 2.'
          examples:
            - 0.5
        bid_size:
          type:
            - number
            - 'null'
          format: double
          description: Bid size within the band, in the base asset.
          examples:
            - 182.4
        ask_size:
          type:
            - number
            - 'null'
          format: double
          description: Ask size within the band, in the base asset.
          examples:
            - 141.9
        bid_notional:
          type:
            - number
            - 'null'
          format: double
          description: Bid notional within the band, in the quote currency.
          examples:
            - 17752000.5
        ask_notional:
          type:
            - number
            - 'null'
          format: double
          description: Ask notional within the band, in the quote currency.
          examples:
            - 13961000.2
        bid_share:
          type:
            - number
            - 'null'
          format: double
          description: The bids' share of both sides' size; null when both are empty.
          examples:
            - 0.5624
      examples:
        - percent: 0.5
          bid_size: 182.4
          ask_size: 141.9
          bid_notional: 17752000.5
          ask_notional: 13961000.2
          bid_share: 0.5624
    CryptoOrderBookWall:
      type: object
      description: One of the largest levels of a side.
      additionalProperties: false
      required:
        - price
        - size
      properties:
        price:
          type:
            - number
            - 'null'
          format: double
          description: The wall's price.
          examples:
            - 97500
        size:
          type:
            - number
            - 'null'
          format: double
          description: Size resting at the wall, in the base asset.
          examples:
            - 38.6
      examples:
        - price: 97500
          size: 38.6
    CryptoOrderBookSource:
      type: object
      description: The book of one exchange the answer read.
      additionalProperties: false
      required:
        - exchange
        - ticker
        - status
        - as_of
        - best_bid
        - best_ask
        - bid_levels
        - ask_levels
      properties:
        exchange:
          type: string
          pattern: ^[a-z0-9][a-z0-9-]{0,31}$
          maxLength: 32
          description: The exchange.
          examples:
            - okx
        ticker:
          type: string
          pattern: ^[A-Za-z0-9][A-Za-z0-9._:/-]{0,63}$
          maxLength: 64
          description: The exchange's own instrument id.
          examples:
            - BTC-USDT-SWAP
        status:
          type: string
          enum:
            - ok
            - unavailable
            - unsupported
          description: >-
            ok when read; unavailable when the exchange failed just now;
            unsupported when Darvas reads no book of it.
          examples:
            - ok
        as_of:
          type:
            - string
            - 'null'
          format: date-time
          maxLength: 30
          description: When the exchange built the book, in UTC; null without one.
          examples:
            - '2026-11-28T12:00:00.120Z'
        best_bid:
          type:
            - number
            - 'null'
          format: double
          description: The exchange's best bid; null without a book.
          examples:
            - 97810.4
        best_ask:
          type:
            - number
            - 'null'
          format: double
          description: The exchange's best ask; null without a book.
          examples:
            - 97810.5
        bid_levels:
          type: integer
          format: int64
          minimum: 0
          maximum: 1000000000000
          description: Bid levels the exchange served.
          examples:
            - 50
        ask_levels:
          type: integer
          format: int64
          minimum: 0
          maximum: 1000000000000
          description: Ask levels the exchange served.
          examples:
            - 50
      examples:
        - exchange: okx
          ticker: BTC-USDT-SWAP
          status: ok
          as_of: '2026-11-28T12:00:00.120Z'
          best_bid: 97810.4
          best_ask: 97810.5
          bid_levels: 50
          ask_levels: 50
    CryptoOrderBookLevel:
      type: object
      description: One price level of the book.
      additionalProperties: false
      required:
        - price
        - size
        - notional
      properties:
        price:
          type:
            - number
            - 'null'
          format: double
          description: The level's price.
          examples:
            - 97810.5
        size:
          type:
            - number
            - 'null'
          format: double
          description: Size resting at the level, in the base asset.
          examples:
            - 4.21
        notional:
          type:
            - number
            - 'null'
          format: double
          description: price times size, in the quote currency.
          examples:
            - 411782.2
      examples:
        - price: 97810.5
          size: 4.21
          notional: 411782.2
    Error:
      type: object
      description: A refusal or failure.
      additionalProperties: false
      required:
        - error
      properties:
        error:
          type: string
          pattern: ^[A-Z_]{1,64}$
          description: A stable code.
          examples:
            - NOT_FOUND
        message:
          type: string
          pattern: ^[^\x00-\x08\x0b\x0c\x0e-\x1f]*$
          maxLength: 500
          description: What went wrong, in English.
          examples:
            - No company has this ticker or CIK
      examples:
        - error: NOT_FOUND
          message: No company has this ticker or CIK
  responses:
    BadRequest:
      description: A parameter is missing or malformed.
      headers:
        X-RateLimit-Limit:
          $ref: '#/components/headers/RateLimitLimit'
        X-Quota-Unit:
          $ref: '#/components/headers/QuotaUnit'
        X-Credits-Used:
          $ref: '#/components/headers/CreditsUsed'
        X-Quota-Limit:
          $ref: '#/components/headers/QuotaLimit'
        X-Quota-Remaining:
          $ref: '#/components/headers/QuotaRemaining'
        X-Quota-Reset:
          $ref: '#/components/headers/QuotaReset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: VALIDATION_ERROR
            message: Send ticker or cik
    Unauthorized:
      description: The API key is missing, unknown or revoked.
      headers:
        X-RateLimit-Limit:
          $ref: '#/components/headers/RateLimitLimit'
        X-Quota-Unit:
          $ref: '#/components/headers/QuotaUnit'
        X-Credits-Used:
          $ref: '#/components/headers/CreditsUsed'
        X-Quota-Limit:
          $ref: '#/components/headers/QuotaLimit'
        X-Quota-Remaining:
          $ref: '#/components/headers/QuotaRemaining'
        X-Quota-Reset:
          $ref: '#/components/headers/QuotaReset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: UNAUTHORIZED
            message: The API key is not valid
    PlanRequired:
      description: The account of the key has no active data API plan.
      headers:
        X-RateLimit-Limit:
          $ref: '#/components/headers/RateLimitLimit'
        X-Quota-Unit:
          $ref: '#/components/headers/QuotaUnit'
        X-Credits-Used:
          $ref: '#/components/headers/CreditsUsed'
        X-Quota-Limit:
          $ref: '#/components/headers/QuotaLimit'
        X-Quota-Remaining:
          $ref: '#/components/headers/QuotaRemaining'
        X-Quota-Reset:
          $ref: '#/components/headers/QuotaReset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: PLAN_REQUIRED
            message: The account of this key has no active data API plan
    NotFound:
      description: No company has this ticker or CIK.
      headers:
        X-RateLimit-Limit:
          $ref: '#/components/headers/RateLimitLimit'
        X-Quota-Unit:
          $ref: '#/components/headers/QuotaUnit'
        X-Credits-Used:
          $ref: '#/components/headers/CreditsUsed'
        X-Quota-Limit:
          $ref: '#/components/headers/QuotaLimit'
        X-Quota-Remaining:
          $ref: '#/components/headers/QuotaRemaining'
        X-Quota-Reset:
          $ref: '#/components/headers/QuotaReset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: NOT_FOUND
            message: No company has this ticker or CIK
    RateLimited:
      description: >-
        The key sent more requests in a minute than its limit (RATE_LIMITED), or
        its account has no credits left (QUOTA_EXCEEDED).
      headers:
        X-RateLimit-Limit:
          $ref: '#/components/headers/RateLimitLimit'
        X-Quota-Unit:
          $ref: '#/components/headers/QuotaUnit'
        X-Credits-Used:
          $ref: '#/components/headers/CreditsUsed'
        X-Quota-Limit:
          $ref: '#/components/headers/QuotaLimit'
        X-Quota-Remaining:
          $ref: '#/components/headers/QuotaRemaining'
        X-Quota-Reset:
          $ref: '#/components/headers/QuotaReset'
        Retry-After:
          $ref: '#/components/headers/RetryAfter'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: RATE_LIMITED
            message: Too many requests
    InternalError:
      description: Darvas failed; the error is reported.
      headers:
        X-RateLimit-Limit:
          $ref: '#/components/headers/RateLimitLimit'
        X-Quota-Unit:
          $ref: '#/components/headers/QuotaUnit'
        X-Credits-Used:
          $ref: '#/components/headers/CreditsUsed'
        X-Quota-Limit:
          $ref: '#/components/headers/QuotaLimit'
        X-Quota-Remaining:
          $ref: '#/components/headers/QuotaRemaining'
        X-Quota-Reset:
          $ref: '#/components/headers/QuotaReset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: INTERNAL_ERROR
            message: Something went wrong
    Unavailable:
      description: The data store is unavailable.
      headers:
        X-RateLimit-Limit:
          $ref: '#/components/headers/RateLimitLimit'
        X-Quota-Unit:
          $ref: '#/components/headers/QuotaUnit'
        X-Credits-Used:
          $ref: '#/components/headers/CreditsUsed'
        X-Quota-Limit:
          $ref: '#/components/headers/QuotaLimit'
        X-Quota-Remaining:
          $ref: '#/components/headers/QuotaRemaining'
        X-Quota-Reset:
          $ref: '#/components/headers/QuotaReset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: UNAVAILABLE
            message: The data service is unavailable
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: X-API-KEY
      description: 'A Darvas data API key: dvk_ and 43 characters.'
    bearerKey:
      type: http
      scheme: bearer
      description: The same key as a Bearer token.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.