Unexpected 429 since May 1st


Since last night May 1st I’m getting 429 for market data on free account (development stage). And it was unexpected since I have internal limiter “new Semaphore(2, true)” means 2 calls per second which is less then 3 per second(200/min).

Any updates or server issue?

@Sergey_Kuznetsov A 429 error is ‘rate limit exceeded’ (as you guessed). There are/weren’t any server issues last night (which would typically return a 500 error in any case). If you provide your account number and the approximate times you received that error I can check the logs. Those will show the times and requests which are being received by Alpaca which may help you debug the issue.

Yes that’s would be good for debugging. Thanks, @Dan_Whitnable_Alpaca
Sorry for confusion first 429 I got yesterday afternoon EST.
This is the first message:

HTTP response body: {“code”:42910000,“message”:“rate limit exceeded”}
HTTP response headers: {access-control-allow-credentials=[true], access-control-allow-headers=[Apca-Api-Key-Id, Apca-Api-Secret-Key, Authorization, Content-Type], access-control-allow-methods=[GET, OPTIONS, PUT, DELETE, POST, PATCH], access-control-allow-origin=[*], access-control-max-age=[1728000], connection=[keep-alive], content-length=[49], content-type=[application/json; charset=UTF-8], date=[Wed, 01 May 2024 16:36:02 GMT], strict-transport-security=[max-age=31536000; includeSubDomains], vary=[Origin], x-ratelimit-limit=[200], x-ratelimit-remaining=[0], x-ratelimit-reset=[1714581422], x-request-id=[721b75a6ef9f5995ca2668d4f30d40e3]} - 2024-05-01 12:36:02
2024-05-01 12:36:05

@Sergey_Kuznetsov Checking…

@Sergey_Kuznetsov You are simply placing too many calls. Your rate limiting logic must not be working.

Below are the calls leading up to the 429 rate limit error. Notice the timestamps are only milliseconds apart.

timestamp method path ratelimit remaining status_code
May 1, 2024 @ 11:36:00.144 GET /papertrader/api/v2/orders 200 3 200
May 1, 2024 @ 11:36:02.019 GET /papertrader/api/v2/positions 200 2 200
May 1, 2024 @ 11:36:02.389 GET /papertrader/api/v2/clock 200 3 200
May 1, 2024 @ 11:36:02.582 GET /papertrader/api/v2/orders 200 2 200
May 1, 2024 @ 11:36:02.659 GET /papertrader/api/v2/orders 200 1 200
May 1, 2024 @ 11:36:02.814 GET /papertrader/api/v2/orders 200 0 200
May 1, 2024 @ 11:36:02.889 GET /papertrader/api/v2/orders 200 0 429

@Dan_Whitnable_Alpaca thank you for the helpful feedback, i’m gonna debug and find leaks on my side.
have a good day!

@Sergey_Kuznetsov I can provide more log detail if you wish. Good luck.

1 Like