# Client\_order\_id

**URL:** <https://forum.alpaca.markets/t/client-order-id/1137>\
**Category:** Alpaca Integration Applications\
**Created:** [April 8, 2020, 3:52pm UTC](https://forum.alpaca.markets/t/client-order-id/1137 "2020-04-08T15:52:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zachary\_Warren](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/zachary_warren/32/610_2.png) [@Zachary\_Warren](https://forum.alpaca.markets/u/Zachary_Warren)\
**Post date:** [April 8, 2020, 3:52pm UTC](https://forum.alpaca.markets/t/client-order-id/1137/1 "2020-04-08T15:52:52Z")

</div>

I am having trouble retrieving only the client\_order\_id.

---

<div class="post-metadata">

**Author:** ![hitoshi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/hitoshi/32/69_2.png) [@hitoshi](https://forum.alpaca.markets/u/hitoshi)\
**Post date:** [April 9, 2020, 7:27pm UTC](https://forum.alpaca.markets/t/client-order-id/1137/2 "2020-04-09T19:27:28Z")

</div>

Does it not appear as one of the fields from Get order API?

---

<div class="post-metadata">

**Author:** ![Brian\_Devereaux](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/brian_devereaux/32/574_2.png) [@Brian\_Devereaux](https://forum.alpaca.markets/u/Brian_Devereaux)\
**Post date:** [April 9, 2020, 8:21pm UTC](https://forum.alpaca.markets/t/client-order-id/1137/3 "2020-04-09T20:21:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Zachary\_Warren](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/zachary_warren/32/610_2.png) [@Zachary\_Warren](https://forum.alpaca.markets/u/Zachary_Warren)\
**Post date:** [April 15, 2020, 4:04pm UTC](https://forum.alpaca.markets/t/client-order-id/1137/4 "2020-04-15T16:04:59Z")

</div>

Thanks guys… I actually was just calling it incorrectly. Thansk
