I need a way to parse order_entry_time and find the open orders since last 5 mins and cancel it but the current order date time returned is in the format which I am unable to understand. Can any one help to understand the format ?
alice.get_order_history()[‘data’][‘pending_orders’]
[{‘validity’: ‘DAY’, ‘user_order_id’: ‘1’, ‘trigger_price’: 0.0, ‘transaction_type’: ‘BUY’, ‘trading_symbol’: ‘NIFTY20AUGFUT’, ‘remaining_quantity’: 75, ‘rejection_reason’: ‘–’, ‘quantity’: 75, ‘product’: ‘BO’, ‘price’: 11250.0, ‘order_type’: ‘LIMIT’, ‘order_tag’: ‘’, ‘order_status’: ‘open’, ‘order_entry_time’: 1597032381 , ‘oms_order_id’: ‘200810000041458’, ‘nest_request_id’: ‘1’, ‘lotsize’: 75, ‘login_id’: ‘AB045925’, ‘leg_order_indicator’: ‘’, ‘instrument_token’: ‘44330’, ‘filled_quantity’: 0, ‘exchange_time’: 1597032381 , ‘exchange_order_id’: ‘1100000002911032’, ‘exchange’: ‘NFO’, ‘disclosed_quantity’: 0, ‘client_id’: ‘AB0XXXX’, ‘average_price’: 0.0}]
1 Like
I got the answer. Its [Unix epoch time] (Unix Epoch Clock ) format.
dexter
August 16, 2020, 10:52am
3
Rajesh_Sivadasan:
[{‘validity’: ‘DAY’, ‘user_order_id’: ‘1’, ‘trigger_price’: 0.0, ‘transaction_type’: ‘BUY’, ‘trading_symbol’: ‘NIFTY20AUGFUT’, ‘remaining_quantity’: 75, ‘rejection_reason’: ‘–’, ‘quantity’: 75, ‘product’: ‘BO’, ‘price’: 11250.0, ‘order_type’: ‘LIMIT’, ‘order_tag’: ‘’, ‘order_status’: ‘open’, ‘order_entry_time’: 1597032381 , ‘oms_order_id’: ‘200810000041458’, ‘nest_request_id’: ‘1’, ‘lotsize’: 75, ‘login_id’: ‘AB045925’, ‘leg_order_indicator’: ‘’, ‘instrument_token’: ‘44330’, ‘filled_quantity’: 0, ‘exchange_time’: 1597032381 , ‘exchange_order_id’: ‘1100000002911032’, ‘exchange’: ‘NFO’, ‘disclosed_quantity’: 0, ‘client_id’: ‘AB0XXXX’, ‘average_price’: 0.0}]
If you paste this on JSON Viewer Online Best and Free it will give you invalid response as it is not a valid JSON.
So use a validator - jsonformatter.curiousconcept.com/
Go here and paste it. You will get proper schema.
It is making a list. So You need to scrap the pending_orders using
alice.get_order_history()[‘data’][‘pending_orders’][0]
alice.get_order_history()[‘data’][‘pending_orders’][1]