On 27 May 2025, I modified my algorithm to place buy orders in parallel. However, it behaved unexpectedly and resulted in a significant loss. Upon investigating the issue at the end of the day, I discovered that many orders were tagged incorrectly or randomly, which my algorithm couldn’t recognize or handle properly.
At the time, I wasn’t logging the order tags during order placement, so I initially suspected a bug in my own code. Since I hadn’t changed the tagging logic recently, I also considered a possible issue on Upstox’s end and reported the problem on the Upstox community forum here. Mysterious order tags
To confirm this, I added logging for order tags the next day (28 May). The logs showed that the tags were being set correctly by my system, which indicated that the issue was on Upstox’s side. I updated my community post accordingly and shut down the algorithm early that day to avoid further unintended losses.
Below are the orders that were mistagged on:
27 May 2025
{
“exchange”: “NFO”,
“product”: “I”,
“price”: 0.0,
“quantity”: 375,
“status”: “complete”,
“guid”: null,
“tag”: “Or69Hx55”,
“instrument_token”: “NSE_FO|61725”,
“tradingsymbol”: “NIFTY25MAY24800CE”,
“trading_symbol”: “NIFTY25MAY24800CE”,
“order_type”: “MARKET”,
“validity”: “DAY”,
“trigger_price”: 0.0,
“disclosed_quantity”: 0,
“transaction_type”: “BUY”,
“average_price”: 210.07,
“filled_quantity”: 375,
“pending_quantity”: 0,
“status_message”: null,
“status_message_raw”: null,
“exchange_order_id”: “1600000044553075”,
“parent_order_id”: null,
“order_id”: “250527000189900”,
“variety”: “SIMPLE”,
“order_timestamp”: “2025-05-27 10:12:39”,
“exchange_timestamp”: “2025-05-27 10:12:39”,
“is_amo”: false,
“order_request_id”: “1”,
“order_ref_id”: “UDAPI-I-bfQ7xqxy8QveCGvTagyXK7Ju”
}
{
"exchange": "NFO",
"product": "I",
"price": 0.0,
"quantity": 1200,
"status": "complete",
"guid": null,
"tag": "de84f6f0",
"instrument_token": "NSE_FO|61725",
"tradingsymbol": "NIFTY25MAY24800CE",
"trading_symbol": "NIFTY25MAY24800CE",
"order_type": "MARKET",
"validity": "DAY",
"trigger_price": 0.0,
"disclosed_quantity": 0,
"transaction_type": "SELL",
"average_price": 199.62,
"filled_quantity": 1200,
"pending_quantity": 0,
"status_message": null,
"status_message_raw": null,
"exchange_order_id": "1600000046350021",
"parent_order_id": null,
"order_id": "250527000195946",
"variety": "SIMPLE",
"order_timestamp": "2025-05-27 10:15:56",
"exchange_timestamp": "2025-05-27 10:15:56",
"is_amo": false,
"order_request_id": "1",
"order_ref_id": "UDAPI-I-Q82ski4rxOqMTvJyCqOtTOI1"
}
{
"exchange": "NFO",
"product": "I",
"price": 0.0,
"quantity": 1650,
"status": "complete",
"guid": null,
"tag": "LA6ZzJsi",
"instrument_token": "NSE_FO|61725",
"tradingsymbol": "NIFTY25MAY24800CE",
"trading_symbol": "NIFTY25MAY24800CE",
"order_type": "MARKET",
"validity": "DAY",
"trigger_price": 0.0,
"disclosed_quantity": 0,
"transaction_type": "SELL",
"average_price": 288.53,
"filled_quantity": 1650,
"pending_quantity": 0,
"status_message": null,
"status_message_raw": null,
"exchange_order_id": "1600000081387067",
"parent_order_id": null,
"order_id": "250527000308057",
"variety": "SIMPLE",
"order_timestamp": "2025-05-27 11:17:19",
"exchange_timestamp": "2025-05-27 11:17:19",
"is_amo": false,
"order_request_id": "1",
"order_ref_id": "UDAPI-I-MHbf1iBvKMivaPhdBez93bfX"
}
28 May 2025
{
“exchange”: “NFO”,
“product”: “I”,
“price”: 0.0,
“quantity”: 1800,
“status”: “complete”,
“guid”: null,
“tag”: “XnTQFDu5DSu9jLU4_tpE”,
“instrument_token”: “NSE_FO|61726”,
“tradingsymbol”: “NIFTY25MAY24800PE”,
“trading_symbol”: “NIFTY25MAY24800PE”,
“order_type”: “MARKET”,
“validity”: “DAY”,
“trigger_price”: 0.0,
“disclosed_quantity”: 0,
“transaction_type”: “BUY”,
“average_price”: 175.82,
“filled_quantity”: 1800,
“pending_quantity”: 0,
“status_message”: null,
“status_message_raw”: null,
“exchange_order_id”: “1600000000123386”,
“parent_order_id”: null,
“order_id”: “250528000012074”,
“variety”: “SIMPLE”,
“order_timestamp”: “2025-05-28 09:15:09”,
“exchange_timestamp”: “2025-05-28 09:15:09”,
“is_amo”: false,
“order_request_id”: “1”,
“order_ref_id”: “UDAPI-I-XuwbEybYap5rs1sN7J2WwYhT”
}
{
"exchange": "NFO",
"product": "I",
"price": 0.0,
"quantity": 1800,
"status": "complete",
"guid": null,
"tag": "AAAAAAA84AAAAMA0CQAAAAAAAAAACwAAAAD//wAA",
"instrument_token": "NSE_FO|61725",
"tradingsymbol": "NIFTY25MAY24800CE",
"trading_symbol": "NIFTY25MAY24800CE",
"order_type": "MARKET",
"validity": "DAY",
"trigger_price": 0.0,
"disclosed_quantity": 0,
"transaction_type": "SELL",
"average_price": 235.01,
"filled_quantity": 1800,
"pending_quantity": 0,
"status_message": null,
"status_message_raw": null,
"exchange_order_id": "1600000006372945",
"parent_order_id": null,
"order_id": "250528000042122",
"variety": "SIMPLE",
"order_timestamp": "2025-05-28 09:21:18",
"exchange_timestamp": "2025-05-28 09:21:18",
"is_amo": false,
"order_request_id": "1",
"order_ref_id": "UDAPI-I-AYouPWYBr7H9K6WoyuTJSCWE"
}
{
"exchange": "NFO",
"product": "I",
"price": 0.0,
"quantity": 1800,
"status": "rejected",
"guid": null,
"tag": "string",
"instrument_token": "NSE_FO|61726",
"tradingsymbol": "NIFTY25MAY24800PE",
"trading_symbol": "NIFTY25MAY24800PE",
"order_type": "MARKET",
"validity": "DAY",
"trigger_price": 0.0,
"disclosed_quantity": 0,
"transaction_type": "BUY",
"average_price": 0.0,
"filled_quantity": 0,
"pending_quantity": 0,
"status_message": "You need to add Rs. 306739.37 in your account to place this trade.",
"status_message_raw": "RMS:Margin Exceeds,Required:785197.34, Available:478457.97 for entity account-75APHF across exchange across segment across product ",
"exchange_order_id": "",
"parent_order_id": null,
"order_id": "250528000060564",
"variety": "SIMPLE",
"order_timestamp": "2025-05-28 09:25:59",
"exchange_timestamp": null,
"is_amo": false,
"order_request_id": "1",
"order_ref_id": "UDAPI-I-sQwIGIJB2fqXhydBxWEsDy9C"
}
{
"exchange": "NFO",
"product": "I",
"price": 0.0,
"quantity": 600,
"status": "rejected",
"guid": null,
"tag": "string",
"instrument_token": "NSE_FO|61726",
"tradingsymbol": "NIFTY25MAY24800PE",
"trading_symbol": "NIFTY25MAY24800PE",
"order_type": "MARKET",
"validity": "DAY",
"trigger_price": 0.0,
"disclosed_quantity": 0,
"transaction_type": "BUY",
"average_price": 0.0,
"filled_quantity": 0,
"pending_quantity": 0,
"status_message": "You need to add Rs. 75319.37 in your account to place this trade.",
"status_message_raw": "RMS:Margin Exceeds,Required:553777.34, Available:478457.97 for entity account-75APHF across exchange across segment across product ",
"exchange_order_id": "",
"parent_order_id": null,
"order_id": "250528000060565",
"variety": "SIMPLE",
"order_timestamp": "2025-05-28 09:25:59",
"exchange_timestamp": null,
"is_amo": false,
"order_request_id": "1",
"order_ref_id": "UDAPI-I-fzTavkphT5w1DqSebmAvdXxv"
}
{
"exchange": "NFO",
"product": "I",
"price": 0.0,
"quantity": 1800,
"status": "complete",
"guid": null,
"tag": "AAAAAAH1jQAAAMmjkAAAAAAAAAAACAAAAAD//wAA",
"instrument_token": "NSE_FO|61726",
"tradingsymbol": "NIFTY25MAY24800PE",
"trading_symbol": "NIFTY25MAY24800PE",
"order_type": "MARKET",
"validity": "DAY",
"trigger_price": 0.0,
"disclosed_quantity": 0,
"transaction_type": "BUY",
"average_price": 173.02,
"filled_quantity": 1800,
"pending_quantity": 0,
"status_message": null,
"status_message_raw": null,
"exchange_order_id": "1600000043937420",
"parent_order_id": null,
"order_id": "250528000158364",
"variety": "SIMPLE",
"order_timestamp": "2025-05-28 10:06:00",
"exchange_timestamp": "2025-05-28 10:06:00",
"is_amo": false,
"order_request_id": "1",
"order_ref_id": "UDAPI-I-7Ltd3IxiupoaHxkYTYjIStdQ"
}
The tagging bug not only disrupted the execution of trades associated with the mistagged orders, but also disrupted other trades, as the algorithm was unable to identify or process the unrecognized tags present in the order book.
While I understand that trading carries risks, this loss was not due to strategy failure but rather a system malfunction of Upstox.
The UpStox API team has acknowledged the bug in the API here. Mysterious order tags - #4 by MohitGolecha
I am not seeking compensation for missed profits—only a refund of the actual losses incurred, which total ₹241,772.71 across 27 May (₹167,883.15) and 28 May (₹73,889.56).
Thank you for your understanding and support.