> ## 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 AI Generator & Code Assistant

> Describe a trading indicator in plain English, refine Pine Script logic or paste a broken TradingView script for the Darvas AI assistant to repair.

The **Darvas** tab of the indicator editor writes Pine Script for you. It runs each answer on your chart, and when the script fails it sends the error back and fixes it.

## Before you start

The assistant works with your own ChatGPT account and uses its quota. Connect the account in the chat panel. If it is not connected, the tab shows **Connect ChatGPT** and sends your request once the account is connected.

The assistant uses the ChatGPT model you picked in the model menu.

## Describe an indicator

1. Open the indicator editor and choose the **Darvas** tab.
2. Describe what the indicator should draw. For example: "Find RSI 14 divergences. When price makes a lower low while RSI makes a higher low, connect the two lows with a line and put a label under the candle."
3. Send the request.

The tab shows **Writing the indicator...**, then **Testing it on your chart...**. If the script fails, it shows **Fixing an error (attempt 2 of 3)...** and tries again. The assistant makes three attempts at most. A script that runs is added to the chart as a draft, and the tab lists it as a version.

A new indicator is a Pine v6 `indicator()` script. The assistant does not write strategies, libraries or `import` statements.

## Change an indicator

Write what should change, such as "make the line thicker" or "shade the background when RSI crosses 70". Each change is a new version. The assistant keeps the names of existing input variables, so input values you saved still apply.

To go back, choose **Restore** on an earlier version.

## Paste a TradingView script

Paste the whole script into the request box and send it.

* Darvas first runs the script as pasted. If it runs and draws, Darvas adds it under its own `indicator()` title without asking the model, and the tab says "The script ran as pasted."
* If it fails, the assistant gets the runner's error and makes the smallest change that makes it run. It keeps the script's `//@version` line, its inputs, plots and drawings, and every line the error does not involve.
* A script for Pine v1 to v4 runs after an automatic rewrite to v5. See [Pine Script support](https://docs.darvas.app/pine-script/support.md#versions).

## Keep the result

The assistant's indicator is a draft until you save it. Choose **Save** in the editor header to keep it, use it on other charts, set alerts or share it.

If the request asks for alerts, the assistant also shows an alert card. An alert needs a saved indicator, so the card asks you to save first. See [Alerts on indicator marks](https://docs.darvas.app/pine-script/alerts.md).

## Limits

* 60 requests an hour.
* A request can be up to 100,000 characters, enough for a long pasted script.
* If the script runner does not answer, the assistant keeps the script untested and says so. Add it to the chart to see whether it runs.


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