# Destructive bug in Alpaca that is destroying our portfolio

**URL:** <https://forum.alpaca.markets/t/destructive-bug-in-alpaca-that-is-destroying-our-portfolio/13877>\
**Category:** Alpaca Trading\
**Created:** [March 18, 2024, 2:34pm UTC](https://forum.alpaca.markets/t/destructive-bug-in-alpaca-that-is-destroying-our-portfolio/13877 "2024-03-18T14:34:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andy\_S](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/andy_s/32/5686_2.png) [@Andy\_S](https://forum.alpaca.markets/u/Andy_S)\
**Post date:** [March 18, 2024, 2:34pm UTC](https://forum.alpaca.markets/t/destructive-bug-in-alpaca-that-is-destroying-our-portfolio/13877/1 "2024-03-18T14:34:55Z")

</div>

I kept on getting insufficient day trade buying power as of last week. which found today despite selling half of the portfolio worth stocks and cash tripled, the DT buying power error message did not go away, and is still stuck at original dollar value it complaint before selling stocks. DT is a bogus rule that gets thrown and does not update when stocks are sold to free up the DT power.

WHAT a great BUG alpaca has . Its a useless and bogus algo platform like I mentioned on my first article on this Forum. It takes 3 days for alpaca guys to answer your question, No phone to contact, No rapid emails or chats, the slowest service on the planet at the time when trading companies are becoming lightening fast in the era of AI

thanks,  
Andy

---

<div class="post-metadata">

**Author:** ![Andy\_S](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/andy_s/32/5686_2.png) [@Andy\_S](https://forum.alpaca.markets/u/Andy_S)\
**Post date:** [March 18, 2024, 2:39pm UTC](https://forum.alpaca.markets/t/destructive-bug-in-alpaca-that-is-destroying-our-portfolio/13877/2 "2024-03-18T14:39:43Z")

</div>

![Alpaca Error 2](https://us1.discourse-cdn.com/flex020/uploads/alp/original/2X/b/bc849b5de3f68732339c69a9ce1ab58746da6f4c.jpeg)

Can you explain this despite selling all shares, WHY DT buying power is still stuck at 2379 ? While cash is over 90K ?

This is a biggies serious issue in ALPACA trading platform.

---

<div class="post-metadata">

**Author:** ![Andy\_S](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/andy_s/32/5686_2.png) [@Andy\_S](https://forum.alpaca.markets/u/Andy_S)\
**Post date:** [March 18, 2024, 3:51pm UTC](https://forum.alpaca.markets/t/destructive-bug-in-alpaca-that-is-destroying-our-portfolio/13877/3 "2024-03-18T15:51:30Z")

</div>

I need to Know despite selling all shares why the DT buying power still stuck at 2334 ?

Why is it not adjusting back to full levels? What is the holp up here? This is INDEED very frustrating to be using Alpaca trading platform

Cash : 90765.92   
Portfolio : 90788.23   
Buy Power : 181531.84   
DT Buy Power : 2334.00

---

<div class="post-metadata">

**Author:** ![Dan\_Whitnable\_Alpaca](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/dan_whitnable_alpaca/32/1658_2.png) [@Dan\_Whitnable\_Alpaca](https://forum.alpaca.markets/u/Dan_Whitnable_Alpaca)\
**Post date:** [March 18, 2024, 4:38pm UTC](https://forum.alpaca.markets/t/destructive-bug-in-alpaca-that-is-destroying-our-portfolio/13877/4 "2024-03-18T16:38:49Z")

</div>

@Andy_S The first thing to understand is there are several ‘buying powers’. The two main ones are `regt_buying_power` and `daytrading_buying_power`.

`regt_buying_power` varies in real time and is the amount one can use to open new positions which will be held overnight. The max `daytrading_buying_power` is fixed at the beginning of each day based upon the previous end of day equity and is the amount one can use to open new positions which will be held intra-day (ie day traded). It is debited and credited as a day trade is opened then closed. There is a bit on buying power in the docs [here](https://docs.alpaca.markets/docs/margin-and-short-selling#how-margin-works) and also a more in depth description on the [SEC website here](https://www.sec.gov/oiea/investor-alerts-and-bulletins/margin-rules-day-trading).

The reason “_why the DT buying power still stuck at 2334_” is because that was the beginning of day DTBP. The DTBP will never exceed that. This is calculated at the beginning of each day as below, and the current DTBP is simply that value less the net of all day trades made during the day.

```auto
max_dtbp = previous_excess_equity x 4
max_dtbp = (last_equity - last_maintenance_margin) x 4
current_dtbp = max_dtbp - net_day_trades_for_the_day

```

In this specific case the values were

```auto
max_dtbp = (90,098.04 - 89,501.28) x 4
max_dtbp = 596.76 x 4
current_dtbp = 2387.04 - 53.04
current_dtbp = 2334

```

The DTBP is really independent from the current holdings.

---

<div class="post-metadata">

**Author:** ![Andy\_S](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/andy_s/32/5686_2.png) [@Andy\_S](https://forum.alpaca.markets/u/Andy_S)\
**Post date:** [March 18, 2024, 6:31pm UTC](https://forum.alpaca.markets/t/destructive-bug-in-alpaca-that-is-destroying-our-portfolio/13877/5 "2024-03-18T18:31:32Z")

</div>

okay, thanks for the explanation Dan. I understood all the trading powers but my concern is I am completely blocked out from further trading even after selling every single stock I had. Despite cash 90k and buying power over 181k , because DT buying power is stuck at 2334 as you mentioned it starts from the beginning of the day and never changes, but this does not help us as I am dead in water as of now. I literally waste one whole day for the DT bp to reset over night. This goes against the algo spirit.

thanks, Andy
