I had an Option Buy trade for BANKNIFTY2350443400CE and at 15:15:03, I was trying to close that trade by placing Sell order for BANKNIFTY2350443400CE using the below-mentioned parameters. But I got this error "Insufficient funds. Required margin is 2608519.58 but available margin is 717962.80. Check the orderbook for open orders." Even though, I was able to close that manually using the UI.
Could anyone help me what could be the issue with my order?
This is the margin requirement for fresh short SELL order of BANKNIFTY2350443400CE, so the possibility can be that a different product type, then the open position, so it was considered as a new order.
@rakeshr My order entry is mentioned below along with the failed sell order. Both of them have product type as MIS. The only difference I can think of is the order_type. Buy order was placed using LIMIT and sell order was placed using "MARKET"
Could you confirm if the order_type difference can make it consider the buy/sell order from the different category?
At the time you were placing the order there was already a stoploss order pending. Hence the new order you placed was considered as a fresh sell. Later, it was cancelled and then position was closed.
BANKNIFTY2350443400CE
, so the possibility can be that a different product type, then the open position, so it was considered as a new order.Could you confirm if the order_type difference can make it consider the buy/sell order from the different category?
{'account_id': 'JZ9146', 'unfilled_quantity': 0, 'checksum': '', 'placed_by': 'JZ9146', 'order_id': '230504202742163', 'exchange_order_id': '1500000139198974', 'parent_order_id': None, 'status': 'OPEN', 'status_message': None, 'status_message_raw': None, 'order_timestamp': 'REPLACED', 'exchange_update_timestamp': 'REPLACED', 'exchange_timestamp': 'REPLACED', 'variety': 'regular', 'exchange': 'NFO', 'tradingsymbol': 'BANKNIFTY2350443400CE', 'instrument_token': 14554114, 'order_type': 'LIMIT', 'transaction_type': 'BUY', 'validity': 'DAY', 'product': 'MIS', 'quantity': 450, 'disclosed_quantity': 0, 'price': 166.3, 'trigger_price': 0, 'average_price': 0, 'filled_quantity': 0, 'pending_quantity': 450, 'cancelled_quantity': 0, 'market_protection': 0, 'meta': {}, 'tag': None, 'guid': '25142XJHjTsn092QS4'}
{'account_id': 'JZ9146', 'unfilled_quantity': 0, 'checksum': '', 'placed_by': 'JZ9146', 'order_id': '230504203192019', 'exchange_order_id': None, 'parent_order_id': None, 'status': 'REJECTED', 'status_message': 'Insufficient funds. Required margin is 2608519.58 but available margin is 717962.80. Check the orderbook for open orders.', 'status_message_raw': 'RMS:Margin Exceeds,Required:2608519.58, Available:717962.80 for entity account-JZ9146 across exchange across segment across product ', 'order_timestamp': '2023-05-04 15:15:03', 'exchange_update_timestamp': None, 'exchange_timestamp': None, 'variety': 'regular', 'exchange': 'NFO', 'tradingsymbol': 'BANKNIFTY2350443400CE', 'instrument_token': 14554114, 'order_type': 'MARKET', 'transaction_type': 'SELL', 'validity': 'DAY', 'product': 'MIS', 'quantity': 450, 'disclosed_quantity': 0, 'price': 0, 'trigger_price': 0, 'average_price': 0, 'filled_quantity': 0, 'pending_quantity': 0, 'cancelled_quantity': 0, 'market_protection': 0, 'meta': {}, 'tag': None, 'guid': '25142X5q7aCya6psC4'}