order_type mismatch while trying to exit positions at market closing time

growwealthalgos
Hello,
I observe a strange behavior while placing a reverse order to exit an OTM order today.
For Ex, for
OrderID: 230829003412422. if we check the states using order_history API,

[{'placed_by': 'OTW355', 'order_id': '230829003412422', 'exchange_order_id': None, 'parent_order_id': None,
'status': 'PUT ORDER REQ RECEIVED', 'order_type': 'MARKET', 'transaction_type': 'SELL', 'validity': 'DAY',
'status': 'VALIDATION PENDING', 'order_type': 'MARKET', 'transaction_type': 'SELL', 'validity': 'DAY',
'status': 'OPEN PENDING', 'order_type': 'MARKET', 'transaction_type': 'SELL', 'validity': 'DAY',


{'placed_by': 'OTW355', 'order_id': '230829003412422', 'exchange_order_id': '1900000201611987', 'parent_order_id': None, 'status': 'OPEN', 'status_message': None, 'status_message_raw': None, 'order_timestamp': datetime.datetime(2023, 8, 29, 15, 20, 4), 'exchange_update_timestamp': '2023-08-29 15:20:04', 'exchange_timestamp': datetime.datetime(2023, 8, 29, 15, 20, 4), 'variety': 'regular', 'modified': False, 'exchange': 'NFO', 'tradingsymbol': 'FINNIFTY23AUG19400PE', 'instrument_token': 10341890, 'order_type': 'MARKET', 'transaction_type': 'SELL', 'validity': 'DAY', 'validity_ttl': 0, 'product': 'MIS', 'quantity': 120, 'disclosed_quantity': 0, 'price': 0, 'trigger_price': 0, 'average_price': 0, 'filled_quantity': 0, 'pending_quantity': 120, 'cancelled_quantity': 0, 'market_protection': 0, 'meta': {}, 'tag': None, 'guid': '72529XolZXOHz5k19z'},


{'placed_by': 'OTW355', 'order_id': '230829003412422', 'exchange_order_id': '1900000201611987', 'parent_order_id': None, 'status': 'OPEN', 'status_message': None, 'status_message_raw': None, 'order_timestamp': datetime.datetime(2023, 8, 29, 15, 20, 4), 'exchange_update_timestamp': '2023-08-29 15:20:04', 'exchange_timestamp': datetime.datetime(2023, 8, 29, 15, 20, 4), 'variety': 'regular', 'modified': False, 'exchange': 'NFO', 'tradingsymbol': 'FINNIFTY23AUG19400PE', 'instrument_token': 10341890, 'order_type': 'LIMIT', 'transaction_type': 'SELL', 'validity': 'DAY', 'validity_ttl': 0, 'product': 'MIS', 'quantity': 120, 'disclosed_quantity': 0, 'price': 0.05, 'trigger_price': 0, 'average_price': 0, 'filled_quantity': 0, 'pending_quantity': 120, 'cancelled_quantity': 0, 'market_protection': 0, 'meta': {}, 'tag': None, 'guid': '72529XolZXOHz5k19z'},


The last 2 states, the only change is changing the order_type from MARKET to LIMIT. and price update of 0.05.
This request is not triggered from Algo end. Is it possible to check how the state change happens without modify req.

I am confused as i am not seeing this pattern for ITM options.
This behavior breaks some of the logic at our end as we are trying to modify order to make it MARKET but it continues to be LIMIT

Sign In or Register to comment.