Skip to content
Quant Brain / DocsBack to website
OPTIONAL CONNECTION / ZERODHA KITE

Set up Zerodha Kite.
Check your first quote.

Connect your own broker account to read a supported stock quote through your assistant.

1. Check your installation

Install Quant Brain and connect an assistant first. Check that its tool list contains nse_broker_quote. If it is missing, use a project revision with the broker integration.

Live verification pending

The adapter has passed simulated tests. These instructions still need to be verified with a live account. This demo reads quotes; it does not place trades or supply backtest history.

2. Get your credentials

  1. Open the Kite developer dashboard and create or select an app with market-data access.
  2. Use a redirect URL your app controls and copy the app’s API key.
  3. Complete Kite login through your app. Your app’s login client must exchange the returned request_token using the app secret to get an access_token.
  4. Keep the current access token. Repeat login when it expires.

The request_token is not your access_token. The app secret belongs in the login client, not the Quant Brain configuration below. Follow the official token-exchange instructions.

3. Save the credentials on your computer

Open Terminal and run this. It opens your private broker settings file in nano.

Open broker settings
QB_CONFIG="$HOME/.local/share/quant-brain"
touch "$QB_CONFIG/research-brokers.env"
chmod 600 "$QB_CONFIG/research-brokers.env"
nano "$QB_CONFIG/research-brokers.env"

Copy this template into the file. Replace the YOUR_… placeholders with your values in the private editor.

research-brokers.env template
export QUANT_BROKER_ACCOUNTS='{"local-research":{"zerodha":{"api_key":"YOUR_KITE_KEY","access_token":"YOUR_CURRENT_KITE_TOKEN"}}}'

Already connected another broker? Keep one QUANT_BROKER_ACCOUNTS line and merge both broker entries under local-research. Don’t add a second line that overwrites the first. The combined template is below.

Show the template for both brokers
Combined broker settings
export QUANT_BROKER_ACCOUNTS='{"local-research":{"kotak":{"consumer_key":"YOUR_NEO_TOKEN","base_url":"YOUR_ASSIGNED_HTTPS_BASE_URL"},"zerodha":{"api_key":"YOUR_KITE_KEY","access_token":"YOUR_CURRENT_KITE_TOKEN"}}}'

Press Ctrl+O, Enter, then Ctrl+X. Restart the assistant’s Quant Brain server. Keep passwords, app secrets, MPIN and one-time codes in the broker login flow.

local-research is the default local owner. On a hosted server, set QUANT_BROKER_ACCOUNTS to the raw JSON in the host’s private environment settings and match the owner ID to MCP_API_KEYS. Omit the export prefix and surrounding single quotes in dashboard fields. Environment settings explained.

4. Ask for a quote

Ask your assistant
Use Quant Brain nse_broker_quote with ticker=RELIANCE
and broker=zerodha. Show broker, symbol, INR price and
retrieval time. If it fails, show the error.

Check for an actual tool call. Retrieval time means when Quant Brain received the quote; a trade timestamp is not available here. If you see broker_not_connected, check the owner ID and private settings file. For Kite, also check whether the token has expired.

Set up Kotak too