cd /news/machine-learning/building-a-production-ml-trading-das… · home topics machine-learning article
[ARTICLE · art-102575] src=dev.to ↗ pub= topic=machine-learning verified=true sentiment=· neutral

Building a Production ML Trading Dashboard with the Dhan API

A developer detailed the integration of machine learning models with live broker data via the Dhan API for a production trading dashboard, focusing on NIFTY options. The system uses XGBoost on 15-minute bars and emphasizes separating inference from execution, with paper trading first. The developer reported 60.5% top-decile accuracy but unprofitable fixed stop-loss backtests, highlighting the importance of honest research status.

read1 min views1 publishedAug 19, 2026

Real integration notes for wiring NIFTY ML models to live broker data via Dhan. Research/

paper-trading context — not a live-trading recommendation.

Dhan's API exposes direct option-chain access — exactly what an options-ML system needs:

POST /optionchain

— full chain for an underlyingPOST /optionchain/expirylist

— available expiriessecurity_id

, last_price

, volume

, oi

, previous_oi

, implied_volatility

, top_bid_price

, top_ask_price

, and greeks (delta/theta/gamma/vega)Security IDs are stable: NIFTY = 13 (IDX_I), BANKNIFTY = 10001 (IDX_I).

A research dashboard pulls live chain + underlying, runs the trained XGBoost model on each

new 15-minute bar, and displays:

Keep the inference path separate from the execution path. The dashboard shows; a

permissioned, human-approved module places orders.

The DhanLiveTrader

pattern: load the model, predict on each new bar, place long orders with

configurable SL/TP (default 1.0 ATR SL, 2.0 ATR TP), and run in paper mode first. Only

after stable out-of-sample + paper evidence should any execution module even be considered.

{
  "client_id": "YOUR_DHAN_CLIENT_ID",
  "access_token": "YOUR_DHAN_ACCESS_TOKEN",
  "is_paper_trade": true,
  "nifty_symbol": "NIFTY",
  "quantity": 50,
  "max_trades_per_day": 3,
  "sl_atr_mult": 1.0,
  "tp_atr_mult": 2.0
}

A known footgun: using a Stop-Loss Limit (SL-L) order with price = sl − 0.05

means it

won't fill if price crashes through the stop. Prefer SL-Market for the protective stop.

Execution quality is its own research topic — don't bolt it on at the end.

The ML side of this stack showed real directional skill (60.5% top-decile accuracy) but the

fixed-SL backtest was still unprofitable (PF 0.53). A dashboard that displays an honest

"RESEARCH / PAPER" status is worth more than one that hides the gap.

Research only. Not investment advice. SEBI/compliance is a separate, required topic before live trading.

── more in #machine-learning 4 stories · sorted by recency
── more on @dhan 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/building-a-productio…] indexed:0 read:1min 2026-08-19 ·