Alpaca Stock API Timeout when Pulling Historic Data When Published but not when in Debug

35 Views Asked by At

I have a basic console app that daily pulls a long list of stock values for the day.

When I run it in debug it works fine. However, when I publish it I get a lot of timeout errors. What would be different with a published app then running from the IDE? Is there a configuration difference in port/communication timeouts when published vs running in the IDE?

This is written in C# visual Studio 2022

I can mostly make it work by adding in a thread.sleep every 100 requests or so but it is dramatically slower.

Just looking for some ideas on where the discrepancy might exist.

1

There are 1 best solutions below

4
LikeASir On

From my experience with Alpaca, they do limit how many API calls you can make. According to their FAQs it's 200/min (Alpaca Docs: https://alpaca.markets/support/usage-limit-api-calls)

So any difference between debug and a publish app will be because of performance/optimizations. From some research, it does appear that debug mode is slower and that there are some optimizations that are built into a published app.

Here are a couple StackOverflow posts about it that might shed some more light on performance differences between debug and published: