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

# Crypto Market Context API: Price, Flow & Macro

> Get a single-call crypto trading brief with last price, 1H/4H/24H ranges, hourly bars, cross-venue funding and open interest deltas plus macro events.

## Overview

This endpoint bundles one crypto instrument's recent price action, perpetual positioning across venues, and nearby high-impact macro releases into a single JSON response. It reads 24 hours of 5-minute candles on a Darvas aggregated pair (by default) or a single exchange, then assembles trailing price windows, hourly OHLCV bars, per-venue funding and open interest changes, and economic calendar releases.

| Coverage | Details |
| - | - |
| Aggregated feed | `darvas` (default) aggregates candles across constituent exchanges and pulls derivatives positioning from every derivative venue in the pair |
| Single exchanges | `okx`, `binance`, `bybit`, `hyperliquid`, `coinbase`, `kraken`, `bitstamp`, `deribit` and `bitfinex` |
| Price windows | Trailing `last_1h`, `last_4h`, and `last_24h` changes, highs, lows, and timestamps built from 288 five-minute candles |
| Derivatives venues | Live funding rate and USD open interest with 1h, 4h, and 24h changes on `okx`, `binance`, `bybit`, and `hyperliquid` (perpetual swaps only) |
| Macro window | High-impact releases from 24 hours before to 48 hours after `observed_at` (up to 15 past and 15 upcoming) |
| Optional flags | `include_hourly_bars` (`true` default, or `false`) and `include_macro` (`true` default, or `false`) |
| MCP tool | `get_crypto_market_context` on the [data API MCP server](https://docs.darvas.app/mcp-server.md) |

## Response sections and partial degradation

Each section fails independently so a single slow feed does not block the full market brief.

* **`price` and `windows`.** `price` reports the latest 5-minute candle close (`last`), open timestamp (`time`, `time_milliseconds`), `bar_interval` (`"5m"`), and `last_bar_closed`. `windows` returns `last_1h`, `last_4h`, and `last_24h`, each with `from`, `to`, `bars`, `change_percent`, `high`, `high_time`, `low`, and `low_time`.
* **`hourly_bars`.** Up to 25 UTC hourly OHLCV bars rolled up from the 5-minute series, oldest first. Pass `include_hourly_bars=false` to return `null` and shrink the payload.
* **`derivatives`.** Populated when `market_type` is `swap`, and `null` for spot, futures, or options. Contains `total_open_interest_usd` (sum of venues that answered) and a `venues` array with `funding_rate`, `next_funding_rate`, `next_funding_time`, `funding_interval_hours`, `open_interest_usd`, `open_interest_time`, and `open_interest_change_pct_1h`, `_4h`, and `_24h`. On `hyperliquid`, open interest history is not published so the three OI change fields are `null`. On `exchange=darvas`, passing `venues` filters both the candles and the `derivatives.venues` list; sending `venues` with a single exchange returns `400`.
* **`macro`.** High-impact releases from the economic calendar with `event_name`, `currency`, `country_name`, `importance`, `release_at`, `released`, `actual`, `forecast`, and `previous`. Returns `null` when `include_macro=false` or when the calendar store is unavailable.
* **Related endpoints.** For deeper structure analysis, see [`/crypto/market-structure`](https://docs.darvas.app/crypto/market-structure). For single-venue live mark price and basis, see [`/crypto/derivatives/snapshot`](https://docs.darvas.app/crypto/derivatives-snapshot). For the full calendar filter set, see [`/macro/economic-calendar`](https://docs.darvas.app/macro/economic-calendar).

## Examples

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

headers = {"X-API-KEY": os.environ["DARVAS_API_KEY"]}
ctx = requests.get(
    "https://api.darvas.app/v1/crypto/context",
    headers=headers,
    params={"ticker": "BTC-USDT-SWAP", "exchange": "darvas"},
).json()

print("Last:", ctx["price"]["last"], "24h %:", ctx["windows"]["last_24h"]["change_percent"])
print("Total OI USD:", ctx["derivatives"]["total_open_interest_usd"])
for v in ctx["derivatives"]["venues"]:
    print(" ", v["exchange"], "funding:", v["funding_rate"], "OI 24h %:", v["open_interest_change_pct_24h"])
print("Upcoming high-impact events:", len([r for r in ctx["macro"]["releases"] if not r["released"]]))
```

```bash theme={null}
# Compact ETH perpetual context without hourly bars or macro events, limited to Binance and OKX
curl -H "X-API-KEY: $DARVAS_API_KEY" \
  "https://api.darvas.app/v1/crypto/context?ticker=ETH-USDT-SWAP&exchange=darvas&venues=binance,okx&include_hourly_bars=false&include_macro=false"
```


## OpenAPI

````yaml openapi.yaml GET /crypto/context
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/context:
    get:
      tags:
        - crypto
      summary: Read a crypto market's context
      description: >-
        One instrument or Darvas aggregated pair in a single call: the last
        price, the change, high and low of the trailing hour, four hours and day
        from five-minute candles, the day as hourly bars, the funding rate, next
        funding time and open interest with its 1-hour, 4-hour and 24-hour
        change on every exchange that lists the perpetual (each one a Darvas
        pair combines), and the high-impact macro releases from a day before to
        two days after now. A part a venue cannot answer is null.
      operationId: getCryptoMarketContext
      parameters:
        - $ref: '#/components/parameters/CryptoTicker'
        - $ref: '#/components/parameters/OverviewExchange'
        - $ref: '#/components/parameters/CryptoMarketType'
        - $ref: '#/components/parameters/DarvasVenues'
        - $ref: '#/components/parameters/ContextHourlyBars'
        - $ref: '#/components/parameters/ContextMacro'
      responses:
        '200':
          description: 'Read a crypto market''s context: 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/CryptoMarketContextResponse'
              example:
                ticker: BTC-USDT-SWAP
                exchange: okx
                market_type: swap
                observed_at: '2026-11-28T12:00:00.000Z'
                price:
                  last: 97811.4
                  time: '2026-11-28T11:55:00.000Z'
                  time_milliseconds: 1795866900000
                  bar_interval: 5m
                  last_bar_closed: false
                windows:
                  last_1h:
                    from: '2026-11-28T11:00:00.000Z'
                    to: '2026-11-28T11:55:00.000Z'
                    bars: 12
                    change_percent: 0.42
                    high: 97990
                    high_time: '2026-11-28T11:35:00.000Z'
                    low: 97302.6
                    low_time: '2026-11-28T11:05:00.000Z'
                  last_4h:
                    from: '2026-11-28T08:00:00.000Z'
                    to: '2026-11-28T11:55:00.000Z'
                    bars: 12
                    change_percent: 0.42
                    high: 97990
                    high_time: '2026-11-28T11:35:00.000Z'
                    low: 97302.6
                    low_time: '2026-11-28T11:05:00.000Z'
                  last_24h:
                    from: '2026-11-27T12:00:00.000Z'
                    to: '2026-11-28T11:55:00.000Z'
                    bars: 12
                    change_percent: 0.42
                    high: 97990
                    high_time: '2026-11-28T11:35:00.000Z'
                    low: 97302.6
                    low_time: '2026-11-28T11:05:00.000Z'
                hourly_bars:
                  - time: '2026-11-28T11:00:00.000Z'
                    open: 97401.2
                    high: 97990
                    low: 97302.6
                    close: 97811.4
                    volume: 1204.36
                derivatives:
                  total_open_interest_usd: 3120440211.2
                  venues:
                    - exchange: okx
                      ticker: BTC-USDT-SWAP
                      funding_rate: 0.0001
                      next_funding_rate: null
                      next_funding_time: '2026-11-28T16:00:00.000Z'
                      funding_interval_hours: null
                      open_interest_usd: 3120440211.2
                      open_interest_time: '2026-11-28T11:00:00.000Z'
                      open_interest_change_pct_1h: 0.35
                      open_interest_change_pct_4h: 1.12
                      open_interest_change_pct_24h: -2.08
                macro:
                  past_hours: 24
                  future_hours: 48
                  releases:
                    - event_name: Nonfarm Payrolls
                      currency: USD
                      country_name: United States
                      importance: high
                      release_at: '2026-12-04T13:30:00.000Z'
                      released: false
                      actual: null
                      forecast: 180K
                      previous: 150K
        '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
    OverviewExchange:
      name: exchange
      in: query
      required: false
      description: >-
        The exchange whose pairs or instrument to read, or darvas for Darvas's
        aggregated pairs; darvas without it.
      schema:
        type: string
        enum:
          - darvas
          - okx
          - binance
          - bybit
          - hyperliquid
          - coinbase
          - kraken
          - bitstamp
          - deribit
          - bitfinex
        default: darvas
      example: darvas
    CryptoMarketType:
      name: market_type
      in: query
      required: false
      description: spot, swap, futures or option; without it, the type the id implies.
      schema:
        type: string
        enum:
          - spot
          - swap
          - futures
          - option
      example: spot
    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
    ContextHourlyBars:
      name: include_hourly_bars
      in: query
      required: false
      description: false leaves out the day's hourly bars; true without it.
      schema:
        type: string
        enum:
          - 'true'
          - 'false'
        default: 'true'
      example: 'true'
    ContextMacro:
      name: include_macro
      in: query
      required: false
      description: false leaves out the macro releases; true without it.
      schema:
        type: string
        enum:
          - 'true'
          - 'false'
        default: 'true'
      example: 'true'
  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:
    CryptoMarketContextResponse:
      type: object
      description: The answer of GET /crypto/context.
      additionalProperties: false
      required:
        - ticker
        - exchange
        - market_type
        - observed_at
        - price
        - windows
        - hourly_bars
        - derivatives
        - macro
      properties:
        ticker:
          type: string
          pattern: ^[A-Za-z0-9][A-Za-z0-9._:/-]{0,63}$
          maxLength: 64
          description: The instrument id of the context.
          examples:
            - BTC-USDT-SWAP
        exchange:
          type: string
          enum:
            - darvas
            - okx
            - binance
            - bybit
            - hyperliquid
            - coinbase
            - kraken
            - bitstamp
            - deribit
            - bitfinex
          description: The exchange of the context's candles.
          examples:
            - okx
        market_type:
          type: string
          enum:
            - spot
            - swap
            - futures
            - option
          description: The market of the context's candles.
          examples:
            - swap
        constituents:
          type: array
          maxItems: 16
          description: >-
            With exchange darvas: every exchange the pair of the context
            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 context's candles combine
            when venues narrowed them, null when they combine all of them.
            Absent for one exchange.
          items:
            type: string
            pattern: ^[a-z0-9][a-z0-9-]{0,31}$
            maxLength: 32
          examples:
            - null
        observed_at:
          type: string
          format: date-time
          maxLength: 30
          description: When Darvas read the context.
          examples:
            - '2026-11-28T12:00:00.000Z'
        price:
          $ref: '#/components/schemas/ContextPrice'
        windows:
          $ref: '#/components/schemas/ContextWindows'
        hourly_bars:
          type:
            - array
            - 'null'
          maxItems: 25
          description: >-
            The day as UTC hours, oldest first; null with include_hourly_bars
            false.
          items:
            $ref: '#/components/schemas/ContextHourlyBar'
        derivatives:
          description: Funding and open interest; null for spot.
          anyOf:
            - $ref: '#/components/schemas/ContextDerivatives'
            - type: 'null'
        macro:
          description: >-
            Macro releases; null with include_macro false or while the calendar
            is unavailable.
          anyOf:
            - $ref: '#/components/schemas/ContextMacro'
            - type: 'null'
      examples:
        - ticker: BTC-USDT-SWAP
          exchange: okx
          market_type: swap
          observed_at: '2026-11-28T12:00:00.000Z'
          price:
            last: 97811.4
            time: '2026-11-28T11:55:00.000Z'
            time_milliseconds: 1795866900000
            bar_interval: 5m
            last_bar_closed: false
          windows:
            last_1h:
              from: '2026-11-28T11:00:00.000Z'
              to: '2026-11-28T11:55:00.000Z'
              bars: 12
              change_percent: 0.42
              high: 97990
              high_time: '2026-11-28T11:35:00.000Z'
              low: 97302.6
              low_time: '2026-11-28T11:05:00.000Z'
            last_4h:
              from: '2026-11-28T08:00:00.000Z'
              to: '2026-11-28T11:55:00.000Z'
              bars: 12
              change_percent: 0.42
              high: 97990
              high_time: '2026-11-28T11:35:00.000Z'
              low: 97302.6
              low_time: '2026-11-28T11:05:00.000Z'
            last_24h:
              from: '2026-11-27T12:00:00.000Z'
              to: '2026-11-28T11:55:00.000Z'
              bars: 12
              change_percent: 0.42
              high: 97990
              high_time: '2026-11-28T11:35:00.000Z'
              low: 97302.6
              low_time: '2026-11-28T11:05:00.000Z'
          hourly_bars:
            - time: '2026-11-28T11:00:00.000Z'
              open: 97401.2
              high: 97990
              low: 97302.6
              close: 97811.4
              volume: 1204.36
          derivatives:
            total_open_interest_usd: 3120440211.2
            venues:
              - exchange: okx
                ticker: BTC-USDT-SWAP
                funding_rate: 0.0001
                next_funding_rate: null
                next_funding_time: '2026-11-28T16:00:00.000Z'
                funding_interval_hours: null
                open_interest_usd: 3120440211.2
                open_interest_time: '2026-11-28T11:00:00.000Z'
                open_interest_change_pct_1h: 0.35
                open_interest_change_pct_4h: 1.12
                open_interest_change_pct_24h: -2.08
          macro:
            past_hours: 24
            future_hours: 48
            releases:
              - event_name: Nonfarm Payrolls
                currency: USD
                country_name: United States
                importance: high
                release_at: '2026-12-04T13:30:00.000Z'
                released: false
                actual: null
                forecast: 180K
                previous: 150K
    ContextPrice:
      type: object
      description: The newest five-minute candle's close.
      additionalProperties: false
      required:
        - last
        - time
        - time_milliseconds
        - bar_interval
        - last_bar_closed
      properties:
        last:
          type:
            - number
            - 'null'
          format: double
          description: The context's last price.
          examples:
            - 97811.4
        time:
          type: string
          format: date-time
          maxLength: 30
          description: The open of the newest five-minute candle.
          examples:
            - '2026-11-28T11:55:00.000Z'
        time_milliseconds:
          type: integer
          format: int64
          minimum: 0
          maximum: 9999999999999
          description: That open in Unix milliseconds.
          examples:
            - 1795866900000
        bar_interval:
          type: string
          enum:
            - 5m
          description: The candle frame the context reads.
          examples:
            - 5m
        last_bar_closed:
          type: boolean
          description: Whether the newest five-minute candle has closed.
          examples:
            - false
      examples:
        - last: 97811.4
          time: '2026-11-28T11:55:00.000Z'
          time_milliseconds: 1795866900000
          bar_interval: 5m
          last_bar_closed: false
    ContextWindows:
      type: object
      description: The trailing hour, four hours and day; null without a candle in it.
      additionalProperties: false
      required:
        - last_1h
        - last_4h
        - last_24h
      properties:
        last_1h:
          description: The hour before the last candle.
          anyOf:
            - $ref: '#/components/schemas/ContextWindow'
            - type: 'null'
        last_4h:
          description: The four hours before the last candle.
          anyOf:
            - $ref: '#/components/schemas/ContextWindow'
            - type: 'null'
        last_24h:
          description: The day before the last candle.
          anyOf:
            - $ref: '#/components/schemas/ContextWindow'
            - type: 'null'
      examples:
        - last_1h:
            from: '2026-11-28T11:00:00.000Z'
            to: '2026-11-28T11:55:00.000Z'
            bars: 12
            change_percent: 0.42
            high: 97990
            high_time: '2026-11-28T11:35:00.000Z'
            low: 97302.6
            low_time: '2026-11-28T11:05:00.000Z'
          last_4h:
            from: '2026-11-28T08:00:00.000Z'
            to: '2026-11-28T11:55:00.000Z'
            bars: 12
            change_percent: 0.42
            high: 97990
            high_time: '2026-11-28T11:35:00.000Z'
            low: 97302.6
            low_time: '2026-11-28T11:05:00.000Z'
          last_24h:
            from: '2026-11-27T12:00:00.000Z'
            to: '2026-11-28T11:55:00.000Z'
            bars: 12
            change_percent: 0.42
            high: 97990
            high_time: '2026-11-28T11:35:00.000Z'
            low: 97302.6
            low_time: '2026-11-28T11:05:00.000Z'
    ContextHourlyBar:
      type: object
      description: One UTC hour of the day.
      additionalProperties: false
      required:
        - time
        - open
        - high
        - low
        - close
        - volume
      properties:
        time:
          type: string
          format: date-time
          maxLength: 30
          description: The UTC hour of the context bar.
          examples:
            - '2026-11-28T11:00:00.000Z'
        open:
          type:
            - number
            - 'null'
          format: double
          description: The hour's first price.
          examples:
            - 97401.2
        high:
          type:
            - number
            - 'null'
          format: double
          description: The hour's highest price.
          examples:
            - 97990
        low:
          type:
            - number
            - 'null'
          format: double
          description: The hour's lowest price.
          examples:
            - 97302.6
        close:
          type:
            - number
            - 'null'
          format: double
          description: The hour's last price.
          examples:
            - 97811.4
        volume:
          type:
            - number
            - 'null'
          format: double
          description: The amount traded in the hour, in the base currency.
          examples:
            - 1204.36
      examples:
        - time: '2026-11-28T11:00:00.000Z'
          open: 97401.2
          high: 97990
          low: 97302.6
          close: 97811.4
          volume: 1204.36
    ContextDerivatives:
      type: object
      description: The perpetual's positioning on each exchange.
      additionalProperties: false
      required:
        - total_open_interest_usd
        - venues
      properties:
        total_open_interest_usd:
          type:
            - number
            - 'null'
          format: double
          description: The open interest of the exchanges that answered, in US dollars.
          examples:
            - 3120440211.2
        venues:
          type: array
          maxItems: 16
          description: Each exchange's funding and open interest of the perpetual.
          items:
            $ref: '#/components/schemas/ContextVenueDerivatives'
      examples:
        - total_open_interest_usd: 3120440211.2
          venues:
            - exchange: okx
              ticker: BTC-USDT-SWAP
              funding_rate: 0.0001
              next_funding_rate: null
              next_funding_time: '2026-11-28T16:00:00.000Z'
              funding_interval_hours: null
              open_interest_usd: 3120440211.2
              open_interest_time: '2026-11-28T11:00:00.000Z'
              open_interest_change_pct_1h: 0.35
              open_interest_change_pct_4h: 1.12
              open_interest_change_pct_24h: -2.08
    ContextMacro:
      type: object
      description: High-impact macro releases around now.
      additionalProperties: false
      required:
        - past_hours
        - future_hours
        - releases
      properties:
        past_hours:
          type: integer
          format: int32
          minimum: 0
          maximum: 168
          description: Hours before now the macro releases cover.
          examples:
            - 24
        future_hours:
          type: integer
          format: int32
          minimum: 0
          maximum: 168
          description: Hours after now the macro releases cover.
          examples:
            - 48
        releases:
          type: array
          maxItems: 30
          description: The releases, up to 15 on each side of now.
          items:
            $ref: '#/components/schemas/ContextMacroRelease'
      examples:
        - past_hours: 24
          future_hours: 48
          releases:
            - event_name: Nonfarm Payrolls
              currency: USD
              country_name: United States
              importance: high
              release_at: '2026-12-04T13:30:00.000Z'
              released: false
              actual: null
              forecast: 180K
              previous: 150K
    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
    ContextWindow:
      type: object
      description: The candles of one trailing window.
      additionalProperties: false
      required:
        - from
        - to
        - bars
        - change_percent
        - high
        - high_time
        - low
        - low_time
      properties:
        from:
          type: string
          format: date-time
          maxLength: 30
          description: The first candle of the trailing window.
          examples:
            - '2026-11-28T11:00:00.000Z'
        to:
          type: string
          format: date-time
          maxLength: 30
          description: The last candle of the trailing window.
          examples:
            - '2026-11-28T11:55:00.000Z'
        bars:
          type: integer
          format: int32
          minimum: 0
          maximum: 288
          description: The candles in the trailing window.
          examples:
            - 12
        change_percent:
          type:
            - number
            - 'null'
          format: double
          description: From the window's first open to its last close, in percent.
          examples:
            - 0.42
        high:
          type:
            - number
            - 'null'
          format: double
          description: The trailing window's highest price.
          examples:
            - 97990
        high_time:
          type: string
          format: date-time
          maxLength: 30
          description: The candle of the trailing window's high.
          examples:
            - '2026-11-28T11:35:00.000Z'
        low:
          type:
            - number
            - 'null'
          format: double
          description: The trailing window's lowest price.
          examples:
            - 97302.6
        low_time:
          type: string
          format: date-time
          maxLength: 30
          description: The candle of the trailing window's low.
          examples:
            - '2026-11-28T11:05:00.000Z'
      examples:
        - from: '2026-11-28T11:00:00.000Z'
          to: '2026-11-28T11:55:00.000Z'
          bars: 12
          change_percent: 0.42
          high: 97990
          high_time: '2026-11-28T11:35:00.000Z'
          low: 97302.6
          low_time: '2026-11-28T11:05:00.000Z'
    ContextVenueDerivatives:
      type: object
      description: >-
        One exchange's funding and open interest of the perpetual; null where it
        did not answer.
      additionalProperties: false
      required:
        - exchange
        - ticker
        - funding_rate
        - next_funding_rate
        - next_funding_time
        - funding_interval_hours
        - open_interest_usd
        - open_interest_time
        - open_interest_change_pct_1h
        - open_interest_change_pct_4h
        - open_interest_change_pct_24h
      properties:
        exchange:
          type: string
          enum:
            - okx
            - binance
            - bybit
            - hyperliquid
          description: The exchange that lists the perpetual.
          examples:
            - okx
        ticker:
          type: string
          pattern: ^[A-Za-z0-9][A-Za-z0-9._:/-]{0,63}$
          maxLength: 64
          description: That exchange's id of the perpetual.
          examples:
            - BTC-USDT-SWAP
        funding_rate:
          type:
            - number
            - 'null'
          format: double
          description: The perpetual's current funding rate there, as a fraction.
          examples:
            - 0.0001
        next_funding_rate:
          type:
            - number
            - 'null'
          format: double
          description: The predicted next funding rate, where the exchange gives one.
          examples:
            - null
        next_funding_time:
          type:
            - string
            - 'null'
          format: date-time
          maxLength: 30
          description: The perpetual's next funding there.
          examples:
            - '2026-11-28T16:00:00.000Z'
        funding_interval_hours:
          type:
            - number
            - 'null'
          format: double
          description: Hours between the perpetual's fundings, where the exchange says.
          examples:
            - null
        open_interest_usd:
          type:
            - number
            - 'null'
          format: double
          description: The perpetual's open interest there, in US dollars.
          examples:
            - 3120440211.2
        open_interest_time:
          type:
            - string
            - 'null'
          format: date-time
          maxLength: 30
          description: When the exchange's open interest was read.
          examples:
            - '2026-11-28T11:00:00.000Z'
        open_interest_change_pct_1h:
          type:
            - number
            - 'null'
          format: double
          description: The open interest's change over the last hour, in percent.
          examples:
            - 0.35
        open_interest_change_pct_4h:
          type:
            - number
            - 'null'
          format: double
          description: The open interest's change over the last four hours, in percent.
          examples:
            - 1.12
        open_interest_change_pct_24h:
          type:
            - number
            - 'null'
          format: double
          description: The open interest's change over the last 24 hours, in percent.
          examples:
            - -2.08
      examples:
        - exchange: okx
          ticker: BTC-USDT-SWAP
          funding_rate: 0.0001
          next_funding_rate: null
          next_funding_time: '2026-11-28T16:00:00.000Z'
          funding_interval_hours: null
          open_interest_usd: 3120440211.2
          open_interest_time: '2026-11-28T11:00:00.000Z'
          open_interest_change_pct_1h: 0.35
          open_interest_change_pct_4h: 1.12
          open_interest_change_pct_24h: -2.08
    ContextMacroRelease:
      type: object
      description: One high-impact macro release.
      additionalProperties: false
      required:
        - event_name
        - currency
        - country_name
        - importance
        - release_at
        - released
        - actual
        - forecast
        - previous
      properties:
        event_name:
          type: string
          pattern: ^[^\x00-\x08\x0b\x0c\x0e-\x1f]*$
          maxLength: 200
          description: The macro release's name.
          examples:
            - Nonfarm Payrolls
        currency:
          type: string
          pattern: ^[^\x00-\x08\x0b\x0c\x0e-\x1f]*$
          maxLength: 8
          description: The currency the release moves.
          examples:
            - USD
        country_name:
          type:
            - string
            - 'null'
          pattern: ^[^\x00-\x08\x0b\x0c\x0e-\x1f]*$
          maxLength: 80
          description: The country that publishes the release.
          examples:
            - United States
        importance:
          type: string
          pattern: ^[^\x00-\x08\x0b\x0c\x0e-\x1f]*$
          maxLength: 16
          description: The release's expected impact.
          examples:
            - high
        release_at:
          type: string
          format: date-time
          maxLength: 30
          description: When the release is published.
          examples:
            - '2026-12-04T13:30:00.000Z'
        released:
          type: boolean
          description: Whether the release has been published.
          examples:
            - false
        actual:
          type:
            - string
            - 'null'
          pattern: ^[^\x00-\x08\x0b\x0c\x0e-\x1f]*$
          maxLength: 40
          description: The release's published value.
          examples:
            - null
        forecast:
          type:
            - string
            - 'null'
          pattern: ^[^\x00-\x08\x0b\x0c\x0e-\x1f]*$
          maxLength: 40
          description: The release's consensus forecast.
          examples:
            - 180K
        previous:
          type:
            - string
            - 'null'
          pattern: ^[^\x00-\x08\x0b\x0c\x0e-\x1f]*$
          maxLength: 40
          description: The release's value the time before.
          examples:
            - 150K
      examples:
        - event_name: Nonfarm Payrolls
          currency: USD
          country_name: United States
          importance: high
          release_at: '2026-12-04T13:30:00.000Z'
          released: false
          actual: null
          forecast: 180K
          previous: 150K
  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.