Lagging and dropping connections

I am not aware yet if this is happening on production account, however I get this errors when working on paper account:
01/30/2020 09:58:09 AM DEBUG: h_t_tps://paper-api.alpaca.markets:443 “GET /v2/orders/325ddffe-898c-47cc-ac49-566f00262183 HTTP/1.1” 200 695
01/30/2020 10:01:00 AM DEBUG: Resetting dropped connection: paper-api.alpaca.markets

You can see, that because of this lag I am loosing 3 seconds, when actually orders comes from my code. As a result, order does not go through because of this lag.

Another one is this:
01/30/2020 09:58:06 AM WARNING: sleep 3 seconds and retrying h_t_tps://paper-api.alpaca.markets/v2/orders/325ddffe-898c-47cc-ac49-566f00262183 3 more time(s)…
01/30/2020 09:58:09 AM DEBUG: https://paper-api.alpaca.markets:443 “GET /v2/orders/325ddffe-898c-47cc-ac49-566f00262183 HTTP/1.1” 200 695

Same thing - 3 seconds gap.
What is this and how to manage this properly. Any ideas?
Thank you

looks like you might have a 3 sec sleep timer

This does not come from my code. It comes from Alpaca server. I will check on ping rate (request freq. limits) in documentation to make sure I am not exceeding it.

I got the answer from API Docs:

Rate Limit#

There is a rate limit for the API requests. When it is exceeded, the API server returns error response with HTTP status code 429. The rate limit is 200 requests per every minute per API key.

Thanks all.

1 Like

I have same logs, but also it pause my data feed:

    sleep 3 seconds and retrying https://paper-api.alpaca.markets/v2/account 3 more time(s)...
    2020-04-29, 16:35:00, Price 0.29
    2020-04-29, 16:36:00, Price 0.29
    2020-04-29, 16:37:00, Price 0.29
    2020-04-29, 16:38:00, Price 0.28
    2020-04-29, 16:39:00, Price 0.29
    2020-04-29, 16:40:00, Price 0.29
    2020-04-29, 16:41:00, Price 0.29
    sleep 3 seconds and retrying https://paper-api.alpaca.markets/v2/account 3 more time(s)...

What I am doing wrong?

I looked at my error logs and get the same message about “sleep 3 seconds”. It is coming from the alpaca_trade_api SDK imported into my Python script. In other words, nothing I can do unless I am willing to dive into the SDK and maybe find and correct a bug. My script makes 2 calls each minute to PAPER. There is a sleep timer that enforces the low rate.

Today I got 1,658 (4.25/minute) of these warnings in the error log while the market was open. The time stamps show the average time between these errors is 7 seconds, the shortest is 3, and the longest is 122. In short, it does not appear to be a “rate limit” issue, but more of a connection issue, or perhaps a phantom issue. My script was showing changing prices every minute for each of the two symbols, so it did not appear to have a problem retrieving the data I wanted. My internet connection runs about 100 down by 10 up with not much variation as per Fing, so I doubt it is a bandwidth or latency issue.

Since my trading method is not sensitive to the average 7 seconds, I will just ignore it for now.

I may try the Consolidated Market Data (Polygon) for a different issue if I can find the documentation. That may also connect better, especially if I can get the websocket working.

1 Like

Did you ever look into this? I’m losing money behind it.