Cannot place any trades as buying power is $0 but no open positions or pending orders

Environment

Language
Let us know what language you’re writing your code in. Please include the version number you’re running, if possible.

Python v3.8.

Alpaca SDK Version
If you’re using an SDK library to interface with the Alpaca API, please include the version number you have installed in your environment.

Python alpaca-trade-api 1.4.1

Other Environment Details

Windows 10 x64.

Problem

Summary

When I place a trade, it says the buying power is $0, despite the fact that I have no positions and no pending orders. My account appears to be mis-configured in some way - perhaps something is stuck?

In addition, for some reason I have the “Pattern Day Trader” flag set. I do not need (or want) this, so this could be switched off if it would help to reset the account to a working state.

Paper or Live Tradng?
LIVE trading.

Example Code

Same issue when attempting to open orders manually on the website.

I think that is your problem right there.
Alpaca only has a margin account, no cash account. This means that the Pattern Day Trader rule gets applied to your account if you do not meet the minimum $25,000 amount on your account. That amount is independent of any margin amount.
With the pattern day trade rule you are only able to make 3 trades in a given week, if you go for a 4th trade then you will be flagged as a Patter Day Trade account.

You can have multiple buy trades for 1 stock, but once you sell, that is considered “1” trade.

To get around this, you can complete a trade on Monday, then on Monday still, find a stock to do a swing trade so you can sell on Tuesday (This does not ding you as long as you buy 1 day, and sell on another day).

It is all working now. Turns out that it was a configuration issue on Alpaca’s side due to a transient issue over the weekend, they fixed it within 24 hours.