Order getting failed even when we have fund

  • Closed current position which is occupying my fund.
  • Position closed successfully.
  • after then only, immediately traded oposite position via algo.
  • Getting error omsErrorDescription: Fund Limit Insufficient

If I keep loop running after each second until my trade doesn’t get sucess: I get rejection for 1 to 3 order and then order get traded

please look into this issue.

FYI:

Before rejection:

	All Order List:  {'status': 'success', 'remarks': '', 'data': [{'dhanClientId': '<>', 'orderId': '<>', 'exchangeOrderId': '<>', 'correlationId': '', 'orderStatus': 'TRADED', 'transactionType': 'BUY', 'exchangeSegment': 'NSE_FNO', 'productType': 'MARGIN', 'orderType': 'MARKET', 'validity': 'DAY', 'tradingSymbol': 'NIFTY-May2024-22400-CE', 'securityId': '38754', 'quantity': 50, 'disclosedQuantity': 0, 'price': 175.15, 'triggerPrice': 0.0, 'afterMarketOrder': False, 'boProfitValue': 0.0, 'boStopLossValue': 0.0, 'legName': 'NA', 'createTime': '2024-05-21 11:06:09', 'updateTime': '2024-05-21 11:06:09', 'exchangeTime': '2024-05-21 11:06:09', 'drvExpiryDate': '2024-05-23', 'drvOptionType': 'CALL', 'drvStrikePrice': 22400.0, 'omsErrorCode': '0', 'omsErrorDescription': 'TRADE CONFIRMED', 'filled_qty': 50, 'algoId': '0'}, {'dhanClientId': '<>', 'orderId': '<>', 'exchangeOrderId': '<>', 'correlationId': '', 'orderStatus': 'TRADED', 'transactionType': 'SELL', 'exchangeSegment': 'NSE_FNO', 'productType': 'MARGIN', 'orderType': 'MARKET', 'validity': 'DAY', 'tradingSymbol': 'NIFTY-May2024-22400-CE', 'securityId': '38754', 'quantity': 50, 'disclosedQuantity': 0, 'price': 156.325, 'triggerPrice': 0.0, 'afterMarketOrder': False, 'boProfitValue': 0.0, 'boStopLossValue': 0.0, 'legName': 'NA', 'createTime': '2024-05-21 10:02:01', 'updateTime': '2024-05-21 10:02:01', 'exchangeTime': '2024-05-21 10:02:01', 'drvExpiryDate': '2024-05-23', 'drvOptionType': 'CALL', 'drvStrikePrice': 22400.0, 'omsErrorCode': '0', 'omsErrorDescription': 'TRADE CONFIRMED', 'filled_qty': 50, 'algoId': '0'}]}

	All Position List:  {'status': 'success', 'remarks': '', 'data': [{'dhanClientId': '<>', 'tradingSymbol': 'NIFTY-May2024-22400-CE', 'securityId': '38754', 'positionType': 'CLOSED', 'exchangeSegment': 'NSE_FNO', 'productType': 'MARGIN', 'buyAvg': 175.15, 'costPrice': 156.325, 'buyQty': 50, 'sellAvg': 156.325, 'sellQty': 50, 'netQty': 0, 'realizedProfit': -941.25, 'unrealizedProfit': 478.12494, 'rbiReferenceRate': 1.0, 'multiplier': 1, 'carryForwardBuyQty': 0, 'carryForwardSellQty': 0, 'carryForwardBuyValue': 0.0, 'carryForwardSellValue': 0.0, 'dayBuyQty': 50, 'daySellQty': 50, 'dayBuyValue': 8757.5, 'daySellValue': 7816.25, 'drvExpiryDate': '2024-05-23 14:30:00', 'drvOptionType': 'CALL', 'drvStrikePrice': 22400.0, 'crossCurrency': False}]}



Rejected order:
	{'status': 'success', 'remarks': '', 'data': [{'dhanClientId': '<>', 'tradingSymbol': 'NIFTY-May2024-22400-CE', 'securityId': '38754', 'positionType': 'CLOSED', 'exchangeSegment': 'NSE_FNO', 'productType': 'MARGIN', 'buyAvg': 175.15, 'costPrice': 156.325, 'buyQty': 50, 'sellAvg': 156.325, 'sellQty': 50, 'netQty': 0, 'realizedProfit': -941.25, 'unrealizedProfit': 478.12494, 'rbiReferenceRate': 1.0, 'multiplier': 1, 'carryForwardBuyQty': 0, 'carryForwardSellQty': 0, 'carryForwardBuyValue': 0.0, 'carryForwardSellValue': 0.0, 'dayBuyQty': 50, 'daySellQty': 50, 'dayBuyValue': 8757.5, 'daySellValue': 7816.25, 'drvExpiryDate': '2024-05-23 14:30:00', 'drvOptionType': 'CALL', 'drvStrikePrice': 22400.0, 'crossCurrency': False}]}



After rejection:
	All Order List:  {'status': 'success', 'remarks': '', 'data': [{'dhanClientId': '<>', 'orderId': '<>', 'exchangeOrderId': '0', 'correlationId': '', 'orderStatus': 'REJECTED', 'transactionType': 'SELL', 'exchangeSegment': 'NSE_FNO', 'productType': 'MARGIN', 'orderType': 'MARKET', 'validity': 'DAY', 'tradingSymbol': 'NIFTY-May2024-22550-PE', 'securityId': '38767', 'quantity': 50, 'disclosedQuantity': 0, 'price': 0.0, 'triggerPrice': 0.0, 'afterMarketOrder': False, 'boProfitValue': 0.0, 'boStopLossValue': 0.0, 'legName': 'NA', 'createTime': '2024-05-21 11:06:10', 'updateTime': '2024-05-21 11:06:10', 'exchangeTime': '0001-01-01 00:00:00', 'drvExpiryDate': '2024-05-23', 'drvOptionType': 'PUT', 'drvStrikePrice': 22550.0, 'omsErrorCode': '0', 'omsErrorDescription': 'RMS:42240521211841:Fund Limit Insufficient By 29171.98 & Available Amount 100288. Order Amount Is 6575.00', 'filled_qty': 0, 'algoId': '0'}, {'dhanClientId': '<>', 'orderId': '<>', 'exchangeOrderId': '<>', 'correlationId': '', 'orderStatus': 'TRADED', 'transactionType': 'BUY', 'exchangeSegment': 'NSE_FNO', 'productType': 'MARGIN', 'orderType': 'MARKET', 'validity': 'DAY', 'tradingSymbol': 'NIFTY-May2024-22400-CE', 'securityId': '38754', 'quantity': 50, 'disclosedQuantity': 0, 'price': 175.15, 'triggerPrice': 0.0, 'afterMarketOrder': False, 'boProfitValue': 0.0, 'boStopLossValue': 0.0, 'legName': 'NA', 'createTime': '2024-05-21 11:06:09', 'updateTime': '2024-05-21 11:06:09', 'exchangeTime': '2024-05-21 11:06:09', 'drvExpiryDate': '2024-05-23', 'drvOptionType': 'CALL', 'drvStrikePrice': 22400.0, 'omsErrorCode': '0', 'omsErrorDescription': 'TRADE CONFIRMED', 'filled_qty': 50, 'algoId': '0'}, {'dhanClientId': '<>', 'orderId': '<>', 'exchangeOrderId': '<>', 'correlationId': '', 'orderStatus': 'TRADED', 'transactionType': 'SELL', 'exchangeSegment': 'NSE_FNO', 'productType': 'MARGIN', 'orderType': 'MARKET', 'validity': 'DAY', 'tradingSymbol': 'NIFTY-May2024-22400-CE', 'securityId': '38754', 'quantity': 50, 'disclosedQuantity': 0, 'price': 156.325, 'triggerPrice': 0.0, 'afterMarketOrder': False, 'boProfitValue': 0.0, 'boStopLossValue': 0.0, 'legName': 'NA', 'createTime': '2024-05-21 10:02:01', 'updateTime': '2024-05-21 10:02:01', 'exchangeTime': '2024-05-21 10:02:01', 'drvExpiryDate': '2024-05-23', 'drvOptionType': 'CALL', 'drvStrikePrice': 22400.0, 'omsErrorCode': '0', 'omsErrorDescription': 'TRADE CONFIRMED', 'filled_qty': 50, 'algoId': '0'}]}

	All Position List:  {'status': 'success', 'remarks': '', 'data': [{'dhanClientId': '<>', 'tradingSymbol': 'NIFTY-May2024-22400-CE', 'securityId': '38754', 'positionType': 'CLOSED', 'exchangeSegment': 'NSE_FNO', 'productType': 'MARGIN', 'buyAvg': 175.15, 'costPrice': 156.325, 'buyQty': 50, 'sellAvg': 156.325, 'sellQty': 50, 'netQty': 0, 'realizedProfit': -941.25, 'unrealizedProfit': 478.12494, 'rbiReferenceRate': 1.0, 'multiplier': 1, 'carryForwardBuyQty': 0, 'carryForwardSellQty': 0, 'carryForwardBuyValue': 0.0, 'carryForwardSellValue': 0.0, 'dayBuyQty': 50, 'daySellQty': 50, 'dayBuyValue': 8757.5, 'daySellValue': 7816.25, 'drvExpiryDate': '2024-05-23 14:30:00', 'drvOptionType': 'CALL', 'drvStrikePrice': 22400.0, 'crossCurrency': False}]}


	Traded order successfully:
		{'status': 'success', 'remarks': '', 'data': {'orderId': '<>', 'orderStatus': 'TRANSIT'}}

Hello @Vaibhav722

This may arise if your existing position is closed at the same instant as the new order is placed. Is there any slip that you have kept between polling the Positions API concurrently?

Yeah I kept 1 sec slip,
But sometimes it have to wait 5 sec to place new order and before that each sec placed order gets failed that is the issue.
If the previous order has been closed before 4 sec ago so why not new order get placed on very next second.
As there some second difference between closed and new order placed, I think it should not rejected. Kindly look into this issue.

Hello @Vaibhav722

Sure, will take a look into this. We do monitor response times on regular basis and such instance should not arise. Can you share your Client ID along with Order ID/Timestamp when you faced this issue?

Will ask team to check logs and understand this scenario better.

I don’t think, I should share sensitive information publicly.
Client I’d can’t share. If you want anything else which help to debug issue, let me know.

Hello @Vaibhav722

Apologies on my end, missed adding this above. Can you share the above details over DM or at help@dhan.co.

I apologize, but I’m unable to provide the details directly due to privacy concerns. Please try to troubleshoot the issue on your end. If you need any specific guidance or have any questions, I’m here to help as much as I can. Thank you for your understanding.

@Vaibhav722

Alright, we did trying troubleshooting here, but this is not an error as per system, as the order execution was happening at that instance.

To look into exactly what happened at that particular instance, where you faced the delay, we will have to check logs. You can always raise appropriate ticket with @Dhan_Cares directly from any of the Dhan platforms.

1 Like