APIError: trade denied due to pattern day trading protection

I have a program that buys a stock at market open and sells it at market close daily. When I ran it today, I get an error when I sell a stock with the API. It says

APIError: trade denied due to pattern day trading protection

Where can I get more detail of this error? Is there a reference doc?

I found that this is related to " Pattern Day Trader (PDT) Protection".

Alpaca Trading platform monitors the number of day trades for the account for the past 5 business days and rejects a newly submitted orders on exit of a position if it could potentially result in the account being flagged for PDT. This protection triggers only when the previous day’s closing account equity is less than $25,000 at the time of order submission.

More details here - https://docs.alpaca.markets/user-protections/

2 Likes

It’s a legal restriction that all brokers have to check for, though some seem to implement it differently. IB will still let you close positions if you’ve been flagged for PDT, even if your account balance is below $25k. If you’re funded above that, it’s a non-issue regardless.

2 Likes

I accidentally triggered the PDT rule and I can’t buy anything. I get the error: “Failed to submit order,
entry denied due to pattern day trading.” How long will this restriction last?