Hi,
I am migrating my custom application to the Dhan API v2 WebSocket (wss://api-feed.dhan.co?version=2).
I have successfully established a connection and am receiving live data for Options contracts across NSE, BSE, and MCX using the Binary Subscription (Request Code 21).
However, I am unable to receive the Spot Price / Underlying Index Value for any exchange. The server acknowledges the subscription but sends no data for these specific Instrument IDs.
The Issue: I am sending a Binary Subscription (Code 21) for the following, but receiving silence:
-
NSE Indices: NIFTY 50 (ID
13) / BANKNIFTY (ID25).- Tried Exchange Segment:
1(NSE_EQ) and0(IDX).
- Tried Exchange Segment:
-
BSE Indices: SENSEX.
- Tried Exchange Segment:
0(IDX),4(BSE_EQ) and8(BSE_FNO).
- Tried Exchange Segment:
-
MCX Spot: Crude Oil / Natural Gas Underlying.
- Tried Exchange Segment:
5(MCX_COMM).
- Tried Exchange Segment:
My Questions:
-
Correct Segments: What are the correct
ExchangeSegmentvalues to use in the Subscription Packet (Code 21) for Indices (NSE/BSE) and Commodity Spot (MCX)? -
Packet Type: Does Index data require a different Request Code (e.g.,
15Ticker instead of21Full)? -
Response Structure: Is the Response Code for Indices different from the standard
8(Full Quote)? If so, could you share the byte map for the Index packet?
Technical Context:
-
Auth: V2 URL Auth (Working).
-
Options Data: Working perfectly (receiving LTP at Offset 8).
-
Spot Data: No incoming packets.
Any documentation on the specific Segment/Instrument type mapping for Indices in v2 would be a lifesaver.
Thanks!