Heyo, I hope you’re doing well. I’m mostly posting because I’ve been having trouble trying to regulate how I place orders and how to develop without running into PDT. For reference, my bot is in Go and I’m a free user.
-
When placing orders, I initially ran into a problem where I was placing too many orders at once. From there, I realized I should probably use some type of rate limiter or just randomly sleep. I was lazy, so I just made it sleep. That worked until I extended my bot to trade with multiple different stocks, which then I put in a rate limiter using time/rate . I forget where I found it, but I read somewhere on the forums that the rate limit is 200/sec, so to play it safe I put a limit of 150 on my bot. Even after putting this rate limit on, I’ve still ran into this same issue. Looking at my logs, some trades are placed within the same second, but that doesn’t mean that I should get a 429 error, no? Either I haven’t been looking in the right places, or the docs just don’t mention what the exact criteria are for getting certain errors. 429 in this case, and the PDT in the next.
-
The other problem I’m having, like everyone else, is accidentally messing with the PDT restrictions. When developing my application, I’ve ran into this error a bunch even though I’m just trying to reset the state of how I’m trading and then restart the bot, but that adds trades to the PDT restrictions. The other problem is that even when I do put restrictions on my bot i.e. 4 trades per stock per work week, I still get a PDT error some times. This second point is twofold: I wish there was a way to turn off PDT restrictions when testing applications in paper trading(it makes sense because we’re not actually trading) and I wish there was documentation around how PDT works specifically on the Alpaca platform, with verified code examples that show a basic version of an application that would work given the restrictions. I find that a lot of the information that’s in the docs is barebones and essentially only covers what you need to make a curl request on a single trade, not how to create a robust trading bot like how the service is advertised.
I’m still going to use this platform as there’s a lot of nice QoL features that I like, but these are my main problems I wish were addressed when writing my first trading bot.