# Purchase date of a open position

**URL:** <https://forum.alpaca.markets/t/purchase-date-of-a-open-position/136>\
**Category:** Alpaca Integration Applications\
**Created:** [August 7, 2019, 7:17pm UTC](https://forum.alpaca.markets/t/purchase-date-of-a-open-position/136 "2019-08-07T19:17:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tcj2001](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/tcj2001/32/87_2.png) [@tcj2001](https://forum.alpaca.markets/u/tcj2001)\
**Post date:** [August 7, 2019, 7:17pm UTC](https://forum.alpaca.markets/t/purchase-date-of-a-open-position/136/1 "2019-08-07T19:17:37Z")

</div>

Is there a way to get the date of purchase of a position, i want to check the date before i sell the position to avoid day trade

Currently the position entity does not have purchase date.

---

<div class="post-metadata">

**Author:** ![coins](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/coins/32/62_2.png) [@coins](https://forum.alpaca.markets/u/coins)\
**Post date:** [August 7, 2019, 7:35pm UTC](https://forum.alpaca.markets/t/purchase-date-of-a-open-position/136/2 "2019-08-07T19:35:28Z")

</div>

There doesn’t appear to be a built in method for finding the purchase date. One way would be to get your order list and check the fill date for your position.

Another method to avoid buying and selling on the same day could be to check if the position has an unrealized\_intraday\_pl and unrealized\_pl that are not equal.

---

<div class="post-metadata">

**Author:** ![tcj2001](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/tcj2001/32/87_2.png) [@tcj2001](https://forum.alpaca.markets/u/tcj2001)\
**Post date:** [August 8, 2019, 4:31pm UTC](https://forum.alpaca.markets/t/purchase-date-of-a-open-position/136/3 "2019-08-08T16:31:18Z")

</div>

Thanks for the suggestion, but I think i can make use of daytrade\_count in account entity

---

<div class="post-metadata">

**Author:** ![tcj2001](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/tcj2001/32/87_2.png) [@tcj2001](https://forum.alpaca.markets/u/tcj2001)\
**Post date:** [August 8, 2019, 8:11pm UTC](https://forum.alpaca.markets/t/purchase-date-of-a-open-position/136/4 "2019-08-08T20:11:46Z")

</div>

May be not

I finally did what u said

def todays\_buy\_fill\_date(symbol):  
orders=api.list\_orders(status=‘closed’, limit=500, after=midnight, until=None, direction=‘desc’)  
for order in orders:  
if order.symbol==symbol:  
return order.filled\_at.astimezone(local\_timezone)

---

<div class="post-metadata">

**Author:** ![backpack](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/backpack/32/4842_2.png) [@backpack](https://forum.alpaca.markets/u/backpack)\
**Post date:** [November 18, 2022, 12:43am UTC](https://forum.alpaca.markets/t/purchase-date-of-a-open-position/136/5 "2022-11-18T00:43:34Z")

</div>

A little late to this thread, but it looks like you can review account activity.

def prevent\_daytrading(symbol):  
trades\_today = api.get\_activities(date=\<today’s date\>)  
for trade in trades\_today:  
if symbol == trade.symbol:  
return False

Something like that might do it
