Sharekhan API Algo Trading: Custom Bots on the Trading API

Sharekhan API algo trading means a program that signs in to your own Mirae Asset Sharekhan account through the broker’s free Trading API and places orders when rules you wrote are met. We build that program to order. Sharekhan isn’t one of the ten brokers our ready-made Indian copiers support, so every Sharekhan project starts with a check of what the Sharekhan API allows for your account.

You run the finished software on a computer you control, a home PC or a VPS, signed in with your keys. AlgoDevelop writes code. It isn’t a SEBI-registered intermediary, it gives no tips, and it never holds client money.

Sharekhan API algo trading in practice

Most requests arrive as one sentence. “Buy the NIFTY call when my TradingView alert fires, only before 11:00, and square off at 3:15.” Another trader wants every call from a paid Telegram channel copied at half size, with a stop for the day after two losses.

The program keeps a session open, waits for its trigger, checks your limits and sends the order. That order then appears in your normal order book, exactly as if you had typed it in the app. Your funds stay with the broker the whole time.

A trigger can be a Telegram channel, a WhatsApp group, a TradingView webhook or logic coded into the program itself. The software checks your limits first on every signal. An order that breaks one gets logged with the reason and is never sent.

Sharekhan API algo trading: a signal or your own rule passes your limits and becomes an order through the Sharekhan Trading API
Every signal passes your limits before an order goes to Mirae Asset Sharekhan, whether it came from a channel post, a chart alert or a coded rule.

Sharekhan API documentation: what the official pages confirm

Mirae Asset Sharekhan publishes a Trading API overview page, a Trading API FAQ, an API documentation section and SDK repositories on GitHub under the Sharekhan-API account. When we read them on 5 November 2026, they said:

Gaps in the published documentation

Two gaps matter for anything automated. The FAQ answer on order rate limits reads “XX orders per second”, so no number is published. None of the pages we read says how long an access token stays valid either. We confirm both for your account before quoting.

The documentation page loads its content through scripts. We could read its section list (login, orders, holdings, funds, historical chart data, ScripMaster, WebSocket streaming and error codes) and the Python SDK’s source code.

Getting started with the Sharekhan Trading API: an active account, the Trading API page, an API Key and Secure Key, then a session
Account, Trading API page, API Key plus Secure Key, then a session. You create the keys under your own login.

How the Sharekhan API key and login work

You create the API key yourself, from your own Sharekhan login, on the Trading API page. Sharekhan’s own YouTube channel has a short video on creating it. We never sign in to your account or ask for your password.

Getting a session takes more steps than at most Indian brokers. Going by the official Python SDK (shareconnectpython), the sequence is:

  1. The program builds a login link to api.sharekhan.com that carries your API key. You open it and sign in.
  2. Next, the broker redirects back with an encrypted request token.
  3. The program decrypts that token with your Secure Key, swaps its two parts (RequestId and CustomerId), encrypts it again and exchanges it for an access token. The SDK uses AES-GCM for this step.
  4. Every later call sends the API key and the access token in its headers.

Because a person completes step 1, we don’t promise a fully unattended daily start. Whether part of the sign-in can be automated for your account is one of the points we check, and we never bypass an OTP.

Sharekhan API in Python: the token exchange

We adapted this short Python sketch of the same flow from the SDK’s README. It hasn’t been run against a live account, and it leaves out error handling and secure key storage.

# Python 3. pip install shareconnect  (Sharekhan's official SDK)
from SharekhanApi.sharekhanConnect import SharekhanConnect

api_key = "YOUR_API_KEY"         # from the Trading API page
secure_key = "YOUR_SECURE_KEY"   # keep out of source control

login = SharekhanConnect(api_key)
print(login.login_url())         # open this link and sign in yourself

request_token = input("Request token from the redirect: ")
session = login.generate_session_without_versionId(request_token, secure_key)
access_token = login.get_access_token(api_key, session, 12345)

A symbol name isn’t enough to place a trade. Each order needs the broker’s numeric scrip code and an exchange code (“NC” in the README’s NSE cash example), along with a product type such as INVESTMENT or BIGTRADE. Our builds download the ScripMaster file at the start of each session and map names like ONGC or a NIFTY strike to those codes.

Why Sharekhan needs a custom build

Our Telegram to Indian broker copier and TradingView to Indian broker copier work with ten brokers: Zerodha, Groww, Angel One, Upstox, ICICI Direct, 5paisa, Dhan, Fyers, Kotak Neo and Alice Blue. Sharekhan isn’t on that list.

An account at one of those ten can use a ready-made copier today, and the Indian broker overview compares them. For the Sharekhan account itself, the work is a custom adapter written around the token login and scrip codes described above.

What goes into a custom Sharekhan build

Each project follows its written requirement. A typical build contains:

The SDK’s default request timeout is 7 seconds, and an order that timed out may still have reached the exchange. A careful build checks the order book before it retries, so the same order is not sent twice.

Limits built into Sharekhan automation: order cap, size ceiling, open positions, trading window, square-off and kill switch
Six limits sit between every signal and the order. You pick each value before the first live session.

Questions we settle before quoting

Before a price goes out, we confirm these points with you and against the broker’s current pages:

If something you need turns out to be missing, you hear that before paying anything. For bridges to other broker APIs, see broker API bridge development.

What we check before quoting Sharekhan automation: API access, segments, login, static IP, rate limits and charges
Access, segments, sign-in, static IP, rate limit and charges: settled with you before a price is sent.

Static IP and SEBI’s retail algo circular

SEBI circular SEBI/HO/MIRSD/MIRSD-PoD/P/CIR/2025/0000013, dated 4 February 2025, covers safer participation of retail investors in algorithmic trading. It tells brokers not to permit open APIs. Access is allowed only through a unique vendor-client-specific API key and a static IP whitelisted by the broker. The same circular requires OAuth-based authentication and two-factor authentication for API access.

For self-written algos, registration with the exchange through the broker is needed only above a specified order-per-second threshold. That threshold is set by the Brokers’ Industry Standards Forum with the exchanges and SEBI. A registered algo may then be used for family, which the circular defines as self, spouse, dependent children and dependent parents.

The circular gave 1 August 2025 as its start date, and SEBI later extended the timelines. Check the current date and rules with your broker. In practice your bot has to run from the whitelisted address. In most setups that’s a rented Windows VPS whose IP address never changes. Sharekhan’s API pages don’t describe how to register that IP, so we work through it with you before going live.

How a Sharekhan project runs

  1. Send the requirement. Describe the strategy, the signal source and the account over WhatsApp or through the contact page.
  2. API check and fixed quote. We check the points above for your case and usually reply with a fixed price within a few hours.
  3. Build and test. We test the software on paper or backtest data first and share progress as it goes.
  4. Your review. Nothing touches the live account until you have checked it.
  5. Handover. You receive the tool, the source and a setup walkthrough, and we help with adjustments afterwards.
From requirement to live: how Sharekhan automation gets built, checked, tested and handed over
The five steps run from requirement to handover, and nothing reaches the live account before your review.

Who is responsible for what

When the rules, the API keys and the account are all yours, the trades are your own trading decisions. We don’t operate the software, we send no trading calls and we promise no result. Automated orders can lose money as quickly as manual ones, and a strategy’s past record says nothing certain about its next trade.

Running a bot for other people is a regulated activity in India. If your use needs an approval or a registration under SEBI or exchange rules, getting it falls to you. When unsure, take qualified advice first. Our page asking is copy trading legal in India covers the general position.

Send your written strategy with your segment and signal source, and you get a fixed quote: ask for a Sharekhan quote.

Sharekhan automation: frequently asked questions

Can I point my TradingView alerts at Sharekhan?

Not through the ready-made TradingView copier, which doesn’t support Sharekhan. A custom build can accept the same kind of TradingView webhook and send the order through the Sharekhan API instead.

Does Sharekhan have a Python API?

Yes. The official SDK installs with pip install shareconnect, and live streaming also needs the websocket package. The source is public in the Sharekhan-API GitHub account.

Will the bot start on its own every morning?

Not always. A person signs in on the broker’s login page to start each session, and we don’t bypass OTPs. How much of the morning start can be automated depends on your account.

Do I need to register my algo with the exchange?

Under the February 2025 SEBI circular, a self-written algo needs registration only if it crosses the order-per-second threshold set by the Brokers’ Industry Standards Forum. Ask the broker how it applies the current threshold.

Do you provide signals or run the account?

No. AlgoDevelop only develops software to your specification. We give no trading signals or advice, and you operate the account yourself.

Who owns the finished code?

You do. The handover includes every source file and the setup notes, so another developer can maintain it later.

What decides the price?

The number of signal sources, segments and accounts, plus how complex your exit rules are. Send those details and you get a fixed figure before any work starts.

WhatsApp