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

# Pine Script request.security & Financial Data

> Pull multi-timeframe symbols with request.security() and access US company financials, earnings, dividends, splits and macro data in Pine Script.

## Another timeframe or symbol

`request.security()` reads another timeframe of the chart's symbol, or another symbol that Darvas lists, such as a crypto pair.

```pine theme={null}
//@version=6
indicator("Daily close on intraday", overlay=true)
dailyClose = request.security(syminfo.tickerid, "D", close)
plot(dailyClose, "Daily close", color=color.orange)
```

* `syminfo.tickerid` and the chart's own pair read the chart's market.
* Another symbol is matched against the markets Darvas lists. A ticker matches without separators, so `ETHUSDT` finds `ETH-USDT`. The `.P` suffix asks for the perpetual. Without it, spot comes first.
* An exchange prefix, such as `OKX:` in `OKX:ETHUSDT`, picks the exchange that Darvas reads first, when your account can chart that exchange. The chart's exchange comes next. A prefix of an exchange that Darvas does not list, such as `KUCOIN:`, stops the script with "`KUCOIN` in `KUCOIN:BTCUSD` is not an exchange on Darvas".
* A symbol Darvas does not list, such as `DXY` or `SPY`, stops the script with "`DXY` is not available on Darvas".
* Timeframes can be seconds, minutes, `D`, `W` and `M`, including non-standard ones such as `3D`. An unsupported timeframe stops the script with an error that names it.
* A series covers the chart back to its first bar. A lower timeframe reads up to 5,000 bars, so on long charts the oldest bars can read `na`. A higher timeframe reads at least 500 of its own bars.
* One run makes at most 12 data reads. Each distinct `request.*()` series counts as one read, and so does `indicator(timeframe=...)`.

## Run the whole script on another timeframe

`indicator(timeframe="D")` runs the script on that timeframe of the chart's symbol and places the values on the chart's bars, as on TradingView.

* Write the timeframe as a string literal.
* `timeframe_gaps` works as on TradingView. Gaps are on by default.
* Labels, lines, boxes, tables, polylines and linefills cannot be combined with `timeframe=`. A script that draws them fails with an error.

## US company data

These calls read US companies' SEC filings. Each value appears on the day its filing was public. A later restatement changes the value from its own filing day, and earlier bars keep what was filed.

| Call | What it returns |
| - | - |
| `request.financial(symbol, id, period)` | A reported value for `period` `FQ`, `FY` or `TTM`. |
| `request.earnings(symbol, earnings.actual)` | Each quarter's diluted EPS, from its first filing. |
| `request.dividends(symbol, dividends.gross)` | The cash dividend per share as paid, from its ex-date. Later splits do not adjust it. |
| `request.splits(symbol, splits.numerator)` | A split's ratio from its first session. `splits.denominator` gives the other side. |

The `request.financial` ids are `TOTAL_REVENUE`, `GROSS_PROFIT`, `OPER_INCOME`, `NET_INCOME`, `EBITDA`, `EARNINGS_PER_SHARE_BASIC`, `EARNINGS_PER_SHARE_DILUTED`, `DPS_COMMON_STOCK_PRIM_ISSUE`, `TOTAL_ASSETS`, `TOTAL_DEBT`, `TOTAL_EQUITY`, `CASH_N_EQUIVALENTS`, `TOTAL_SHARES_OUTSTANDING`, `DILUTED_SHARES_OUTSTANDING`, `CASH_F_OPERATING_ACTIVITIES`, `CAPITAL_EXPENDITURES`, `FREE_CASH_FLOW`, `BOOK_VALUE_PER_SHARE`, `GROSS_MARGIN` and `RETURN_ON_EQUITY`. `GROSS_MARGIN` and `RETURN_ON_EQUITY` are percentages.

The symbol is an SEC ticker, with or without a US exchange prefix, such as `NASDAQ:AAPL` or `NYSE:BRK.B`. On an OKX stock swap or a Bybit xStocks chart, `syminfo.tickerid` names the stock that the market tracks. Any other symbol stops the script with "is not a US company on Darvas".

```pine theme={null}
//@version=6
indicator("P/E", overlay=false)
eps = request.financial(syminfo.tickerid, "EARNINGS_PER_SHARE_DILUTED", "TTM", ignore_invalid_symbol=true)
plot(close / eps, "P/E")
```

> [!NOTE]
>
> An xStocks close is the price of one token, and one token may not equal one share. A ratio such as P/E then needs the token's share ratio.

## US economic data

`request.economic("US", field)` reads these fields, each from the day it was published:

| Field | Series |
| - | - |
| `GDPQQ` | Real GDP growth, each quarter |
| `IRYY` | Inflation rate: CPI change over 12 months |
| `CIR` | Core inflation rate: core CPI change over 12 months |
| `CPI` | Consumer price index, not seasonally adjusted |
| `CCPI` | Core consumer price index, not seasonally adjusted |
| `PCEPI` | PCE price index |
| `CPCEPI` | Core PCE price index |
| `UR` | Unemployment rate |
| `NFP` | Non-farm payrolls: the change from the month before |
| `LFPR` | Labor force participation rate |
| `EMR` | Employment rate: the employment to population ratio |
| `AWH` | Average weekly hours |
| `INTR` | Interest rate: the midpoint of the federal funds target range. TradingView shows the upper bound. |

## Values that read na

* `earnings.estimate`, `earnings.standardized`, `dividends.net`, the period `FH`, the `currency` argument, other countries and other economic fields read `na`.
* With `ignore_invalid_symbol=true`, `request.financial`, `request.earnings`, `request.dividends` and `request.splits` read `na` for a symbol Darvas cannot serve, such as a crypto pair, instead of stopping the script.
* `request.economic` reads `na` when Darvas cannot serve the field.
* With `barmerge.gaps_on`, a value shows only on the bar where it changed. Without it, the value holds on every later bar.


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