If you’ve ever wanted to build your own algo trading system but hesitated because testing live felt too risky or expensive, Dhan now has something that changes the game: Dhan Sandbox.
It’s a fully simulated environment that lets you experiment with trading APIs, test your code, and simulate real-time trading scenarios — without putting any money on the line.

Why It Matters
Testing algo trading strategies directly in the live market is risky. One misplaced parameter or a loop gone wrong, and your account could take a serious hit. Until now, testing broker APIs often required:
- Opening a Demat account
- Completing full KYC
- Funding the account
- Learning everything while the clock (and money) is ticking
With Dhan Sandbox, that entire process is gone. You can start testing your trading ideas today, for free.
How to Get Started
Step 1: Visit the DevPortal
Go to developer.dhanhq.co
Sign up using your email and mobile number — no Dhan account needed.

Step 2: Log in and Generate Your API Credentials
Once you’re in:
- Copy your Client ID
- Copy your Access Token
use the credentials to test your trading strategies with Dhan Sandbox API or in the Dhan API Playground

Step 3: Start Making API Calls
Use the Dhan Sandbox API base URL to test everything from order placements to fetching historical data.
Things to Keep in Mind
- This is a MOCK environment
Trades aren’t routed to the exchange. They’re simulated for testing purposes only. - All orders get filled at price 100
Regardless of market conditions, this static fill price ensures consistency for test cases. - Capital resets every day to ₹10,00,000
No need to manage funds manually. Every morning, you start fresh. - Performance cannot be benchmarked here
You can test order flows, logic, and structure — but not latency, slippage, or real P&L behavior. - Static IP is not required
As it is not a live trading Static IP compliance is not required for testing the APIs before taking strategies live. - Quotes and Websockets not Available
Streaming market data and realtime market quotes are not available in the sandbox API. Usually broker will avoid providing it as it is a mock environment.
What You Can Build or Test
- Full intraday or swing trading strategies
- Broker API integrations for custom platforms
- Trade execution logic with error handling
- Market scanners or signal-based triggers
- Option strategy testers or order chaining logic
Who should use Dhan Sandbox API
Curious Coders: If you’ve ever wanted to dabble in trading automation, the barrier to entry is now virtually zero.
Algo Traders: Develop, test, and refine your strategies without risking a single rupee.
Developers: Build and integrate trading functionalities into your applications with ease.
Fintech Builders: Experiment with innovative financial products leveraging robust trading APIs.
Try It With OpenAlgo

Dhan Sandbox is now supported inside OpenAlgo, the open-source automation tool that connects platforms like TradingView, Amibroker, Python, Excel and more.

You can plug in your sandbox credentials, run strategies during live market hours, and see the full order flow — all inside a real-time dashboard.
📘 Start Testing Dhan Sandbox with OpenAlgo
So, if you’ve been itching to explore algo trading or build trading-related tools, Dhan Sandbox is your invitation to dive in, experiment, and create – all without the initial friction. Happy coding and trading!
Hi Rajendran, First of all, openalgo seems promising and thank you for all your hardwork. I am trying to findout an example to see on how and where I can write my own strategy within openalgo code using Dhan API’s? I see that there is a strategy folder available, but those existing examples doesn’t indicate on how to write code for any specific broker. Looks like my understanding of openalgo might be wrong. But I need some help to figure out these details. Correct me where I am missing to understand? I read through the whole documentation but nowhere it is mentioned. I have a custom strategy that I built using Dhan API’s. I want to execute these strategies from OpenAlgo to have better control, safety and security. Please suggest.