Hi Team,
We are facing an issue with the Order WebSocket (order_alert) where Dhan is sending empty or incomplete order update messages.
These messages contain only:
{"Type": "order_alert", "Data": {"remarks": " "}}
This happens specifically during:
-
Stop-Loss Modify
-
Stop-Loss Triggered (SL Hit)
-
Exit Order Placement
-
Exit Order Execution
Earlier, Dhan always sent the full order snapshot for every update, including these events.
Our WebSocket Connection Setup
We are using the standard method recommended by Dhan:
from dhanhq import OrderSocket
class CustomOrderSocket(OrderSocket):
...
custom_socket = CustomOrderSocket(client_id, token_id, redis_client)
while True:
try:
custom_socket.connect_to_dhan_websocket_sync()
except Exception as e:
print(f"[{client_id}] WebSocket error: {e}. Retrying in 5 sec...")
time.sleep(5)
Inside our overridden handler:
async def handle_order_update(self, message: dict):
logger.info(f"Processing Order update for {message}")
This is where we are receiving empty update objects.
Example log:
Processing Order update for {'Data': {'remarks': ' '}, 'Type': 'order_alert'}
No fields like:
-
status
-
orderNo
-
legNo
-
txnType
-
tradedQty
-
avgTradedPrice
-
lastUpdatedTime
This makes it impossible to determine whether the event was:
-
SL Modify
-
SL Triggered
-
Exit Order Placed
-
Exit Order Filled
Impact
This issue breaks our order-lifecycle logic because we cannot:
-
Identify when SL is triggered
-
Identify when exit order is placed or executed
-
Compute exit price
-
Close trades safely
-
Maintain accurate ledger state
-
Implement risk management
This is critical for automated trading.
Request for Clarification
Could you please confirm:
-
Has Dhan recently changed the WebSocket behavior from full snapshots to partial/delta updates?
-
If no, then this seems like a backend regression where internal OMS events (containing only remarks) are being forwarded to clients.
-
If yes, can you share the updated WebSocket message structure or documentation?
-
Are SL/exit events supposed to send full payloads like entry events?
We only receive full payloads for entry events (Pending → Traded).
All SL/exit events are currently incomplete.
Example of Complete Message We Expect (Entry Executed)
{
"status": "Traded",
"legNo": 1,
"txnType": "B",
"orderNo": "432512155726471",
"avgTradedPrice": 84.4,
...
}
But during SL/exit events, we now receive only:
{"Data": {"remarks": " "}}
This behavior is new and was not occurring previously.