Order WebSocket Sending Empty Messages for SL Modify, SL Trigger, and Exit Events

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.


:magnifying_glass_tilted_left: 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


:warning: 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.


:red_question_mark: Request for Clarification

Could you please confirm:

  1. Has Dhan recently changed the WebSocket behavior from full snapshots to partial/delta updates?

  2. If no, then this seems like a backend regression where internal OMS events (containing only remarks) are being forwarded to clients.

  3. If yes, can you share the updated WebSocket message structure or documentation?

  4. 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.


:memo: 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.

Hi @GaneshGani55,

Good to see you on community after a long time.

We have shared the details with you over email on your registered email address. Please have a look and let us know if you need any further clarification.

For any additional help, you can simply reply to the same email or reach out to us at apihelp@dhan.co.

1 Like