I am having trouble retrieving only the client_order_id.
Does it not appear as one of the fields from Get order API?
I set my own ‘client_order_id’ using day of the year
ticker + doy
however,
print out a list of your orders, and try this
def Order_Id(my_order):
order_id = str(my_order)
order_id = order_id.split()
order_id = order_id[24][1:][:-2]
return order_id
I use this to get the actual order_id # so i can cancel specific orders if need be. you can change the [24] to [8] and it will give you the client_order_id
so this is a typical order return
starting with ‘asset_class’ as number 1…just count left to right. the client_order_id heading is number 7, the actual client id is number 8. thats how I came up with this way. like i said, I use ticker + doy. today is day 99. ‘TVIX99’
Order({ ‘asset_class’: ‘us_equity’,
‘asset_id’: ‘93a044fc-7f2d-4fb7-bca3-a5e72e1b8bdc’,
‘canceled_at’: None,
‘client_order_id’: ‘TVIX99’,
‘created_at’: ‘2020-04-08T13:30:00.78457Z’,
‘expired_at’: None,
‘extended_hours’: False,
‘failed_at’: None,
‘filled_at’: ‘2020-04-08T13:30:20.546544Z’,
‘filled_avg_price’: ‘264.52’,
‘filled_qty’: ‘7’,
‘id’: ‘e35833c2-34b9-40ed-aa22-8fcff48ffd67’,
‘legs’: None,
‘limit_price’: ‘264.65’,
‘order_class’: ‘’,
‘order_type’: ‘limit’,
‘qty’: ‘7’,
‘replaced_at’: None,
‘replaced_by’: None,
‘replaces’: None,
‘side’: ‘buy’,
‘status’: ‘filled’,
‘stop_price’: None,
‘submitted_at’: ‘2020-04-08T13:30:00.767254Z’,
‘symbol’: ‘TVIX’,
‘time_in_force’: ‘day’,
‘type’: ‘limit’,
‘updated_at’: ‘2020-04-08T13:30:20.557802Z’})
if anyone has a better way, Im new to coding and would love to try something different. This is just what I tinkered with until it worked
Thanks guys… I actually was just calling it incorrectly. Thansk