# Sleep 3 seconds and retrying https://paper-api.alpaca.markets/v2/orders 3 more time(s)

**URL:** <https://forum.alpaca.markets/t/sleep-3-seconds-and-retrying-https-paper-api-alpaca-markets-v2-orders-3-more-time-s/2225>\
**Category:** Alpaca Integration Applications\
**Created:** [July 31, 2020, 5:00pm UTC](https://forum.alpaca.markets/t/sleep-3-seconds-and-retrying-https-paper-api-alpaca-markets-v2-orders-3-more-time-s/2225 "2020-07-31T17:00:44Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![GreenCauliflower](https://avatars.discourse-cdn.com/v4/letter/g/a5b964/32.png) [@GreenCauliflower](https://forum.alpaca.markets/u/GreenCauliflower)\
**Post date:** [July 31, 2020, 5:00pm UTC](https://forum.alpaca.markets/t/sleep-3-seconds-and-retrying-https-paper-api-alpaca-markets-v2-orders-3-more-time-s/2225/1 "2020-07-31T17:00:45Z")

</div>

Hi All,

left my algo running to test it today, it is currently listening to 11 stocks, receiving minute updates. I came back to find this in the log:

sleep 3 seconds and retrying [https://paper-api.alpaca.markets/v2/orders](https://paper-api.alpaca.markets/v2/orders) 3 more time(s)…  
sleep 3 seconds and retrying [https://paper-api.alpaca.markets/v2/orders](https://paper-api.alpaca.markets/v2/orders) 2 more time(s)…  
sleep 3 seconds and retrying https//paper-api.alpaca.markets/v2/orders 1 more time(s)…  
Closed Connection

I have never seen this error before, I would just like to understand what it is. Thanks to all who reply in advance.

E

---

<div class="post-metadata">

**Author:** ![Shlomik](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/shlomik/32/793_2.png) [@Shlomik](https://forum.alpaca.markets/u/Shlomik)\
**Post date:** [August 3, 2020, 1:03pm UTC](https://forum.alpaca.markets/t/sleep-3-seconds-and-retrying-https-paper-api-alpaca-markets-v2-orders-3-more-time-s/2225/2 "2020-08-03T13:03:55Z")

</div>

Hi,  
this indicates a server communication issue.  
when did you experience that? during market open hours or outside of market hours?  
did it happen again?  
what repository are you using? (backtrader, pylivetrader, direct alpaca-trade-api)  
what happened when you restarted?

---

<div class="post-metadata">

**Author:** ![GreenCauliflower](https://avatars.discourse-cdn.com/v4/letter/g/a5b964/32.png) [@GreenCauliflower](https://forum.alpaca.markets/u/GreenCauliflower)\
**Post date:** [August 4, 2020, 3:56pm UTC](https://forum.alpaca.markets/t/sleep-3-seconds-and-retrying-https-paper-api-alpaca-markets-v2-orders-3-more-time-s/2225/3 "2020-08-04T15:56:14Z")

</div>

thanks for your reply, it started again fine. must be an alpaca issue

---

<div class="post-metadata">

**Author:** ![TBD](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/tbd/32/1220_2.png) [@TBD](https://forum.alpaca.markets/u/TBD)\
**Post date:** [October 9, 2020, 5:26pm UTC](https://forum.alpaca.markets/t/sleep-3-seconds-and-retrying-https-paper-api-alpaca-markets-v2-orders-3-more-time-s/2225/4 "2020-10-09T17:26:57Z")

</div>

I get it all day long. Even if I stop and wait 10 seconds. It’s annoying and it makes me lose money. There is no way I can run my script on auto because this error requires me to manually set up sells. The buys may post but once this error comes, I am screwed. Let me ask you, is this due to the web socket? Like the OP I have more than two stocks that I am following and trading at one time. Will using AL for ordering and Poly (paid plan) for data and the web socket connect spare me of this error code?

---

<div class="post-metadata">

**Author:** ![Juan\_Rousselot](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/juan_rousselot/32/543_2.png) [@Juan\_Rousselot](https://forum.alpaca.markets/u/Juan_Rousselot)\
**Post date:** [October 9, 2020, 10:04pm UTC](https://forum.alpaca.markets/t/sleep-3-seconds-and-retrying-https-paper-api-alpaca-markets-v2-orders-3-more-time-s/2225/5 "2020-10-09T22:04:40Z")

</div>

I’m 82% sure that is caused because you are exceeding the 200 per minute query limit alpaca has in place.

---

<div class="post-metadata">

**Author:** ![Shlomik](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/shlomik/32/793_2.png) [@Shlomik](https://forum.alpaca.markets/u/Shlomik)\
**Post date:** [October 12, 2020, 2:12pm UTC](https://forum.alpaca.markets/t/sleep-3-seconds-and-retrying-https-paper-api-alpaca-markets-v2-orders-3-more-time-s/2225/6 "2020-10-12T14:12:51Z")

</div>

Hi,  
you have 2 choices for websocket connection as you mantioned (Alpaca data stream and Polygon data stream for paid accounts). of course - try both if you encounter an issue with the alpaca data steam.

no matter what you choose, your orders will be with Alpaca.

are you using python? if not what is your stack?  
are you using the python SDK or doing it directly against the API servers?  
are you using the backtrader integration or pylivetrader or did you write your own manager?

---

<div class="post-metadata">

**Author:** ![Joseph](https://avatars.discourse-cdn.com/v4/letter/j/dc4da7/32.png) [@Joseph](https://forum.alpaca.markets/u/Joseph)\
**Post date:** [October 14, 2020, 4:07am UTC](https://forum.alpaca.markets/t/sleep-3-seconds-and-retrying-https-paper-api-alpaca-markets-v2-orders-3-more-time-s/2225/7 "2020-10-14T04:07:15Z")

</div>

@GreenCauliflower and @TBD - I got this message too, and I can confirm it’s because I was making too many API calls per second. In Python, I now have a

> time.sleep(0.5)

after every API call, so the script basically pauses for half a second (which is conservative since we’re allowed to make about 3 calls per second) before making another call. Hope that helps.

---

<div class="post-metadata">

**Author:** ![TBD](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/tbd/32/1220_2.png) [@TBD](https://forum.alpaca.markets/u/TBD)\
**Post date:** [December 18, 2020, 9:54pm UTC](https://forum.alpaca.markets/t/sleep-3-seconds-and-retrying-https-paper-api-alpaca-markets-v2-orders-3-more-time-s/2225/8 "2020-12-18T21:54:10Z")

</div>

I know I’m late but I’ll answer for others.

Polygon - I noticed it does not like me to run 3 or more scripts. If I do I get the error regardless of whether or not its buying or selling. I was able to confirm this today because I finally used IOC. My script gets every last tick in almost real time. No errors on two running.

Yes, Python.  
API  
Manager that uses AL API and Backtrader.

The problem is it does not like me to run more than 3 scripts at a time. Basically I can only follow two symbols or have two strategies. It sucks big time. I realized I need more than one account. Also, it doesn’t see to like “Day” and “Extending.” The minute I switched to ICO with Extended off (no choice), I was making big moves. LOL It worked how the paper account worked, super fast.

---

<div class="post-metadata">

**Author:** ![deanmayne](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/deanmayne/32/3734_2.png) [@deanmayne](https://forum.alpaca.markets/u/deanmayne)\
**Post date:** [May 22, 2022, 5:29am UTC](https://forum.alpaca.markets/t/sleep-3-seconds-and-retrying-https-paper-api-alpaca-markets-v2-orders-3-more-time-s/2225/9 "2022-05-22T05:29:00Z")

</div>

I am also late here but chiming in in 2022:

I am using the python library alpaca\_trade\_api and was getting the following over and over forever during market hours on my paper account:

WARNING:alpaca\_trade\_api.rest:sleep 3 seconds and retrying [https://data.alpaca.markets/v2/stocks/ZNGA/bars](https://data.alpaca.markets/v2/stocks/ZNGA/bars) 3 more time(s)…

I was using a modified version of the Scalping Algorithm in one of the Alpaca articles and code pulled directly from the AlpacaMarkets GitHub.

I figured out in order to get the scalping code to work I had change my Market Data Subscription plan from Free to Unlimited. Which seems counterintuitive to the concept of a paper account, let alone attempting code that Alpaca puts out itself for users to “try”.

Hope this helps someone avoid some head banging against the wall.

---

<div class="post-metadata">

**Author:** ![Federico](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.alpaca.markets/federico/32/3668_2.png) [@Federico](https://forum.alpaca.markets/u/Federico)\
**Post date:** [July 13, 2022, 8:14pm UTC](https://forum.alpaca.markets/t/sleep-3-seconds-and-retrying-https-paper-api-alpaca-markets-v2-orders-3-more-time-s/2225/10 "2022-07-13T20:14:41Z")

</div>

Hi,

I am just starting with Alpaca, trying the recipies I find in GitHub using the paper account, unfortunatelly many of the recipies are broken (needs debugging).  
For this one in aprticular, I get the following 10 seconds after starting and it goes forever

2022-07-13 20:55:37,042:rest.py:216:WARNING:alpaca\_trade\_api.rest:sleep 3 seconds and retrying [https://data.alpaca.markets/v2/stocks/TSLA/bars](https://data.alpaca.markets/v2/stocks/TSLA/bars) 3 more time(s)…  
2022-07-13 20:55:41,423:rest.py:216:WARNING:alpaca\_trade\_api.rest:sleep 3 seconds and retrying [https://data.alpaca.markets/v2/stocks/TSLA/bars](https://data.alpaca.markets/v2/stocks/TSLA/bars) 3 more time(s)…  
2022-07-13 20:55:45,734:rest.py:216:WARNING:alpaca\_trade\_api.rest:sleep 3 seconds and retrying [https://data.alpaca.markets/v2/stocks/TSLA/bars](https://data.alpaca.markets/v2/stocks/TSLA/bars) 3 more time(s)…  
…

@Shlomik thanks to your replies I manage to make a couple of recipies in the backtrader repo work, fingers crossed here

Is there a way to make the scalping example work without using the unlimited subcription proposed by @deanmayne?

many thanks in advance

---

<div class="post-metadata">

**Author:** ![akshay](https://avatars.discourse-cdn.com/v4/letter/a/3ab097/32.png) [@akshay](https://forum.alpaca.markets/u/akshay)\
**Post date:** [July 14, 2022, 4:22pm UTC](https://forum.alpaca.markets/t/sleep-3-seconds-and-retrying-https-paper-api-alpaca-markets-v2-orders-3-more-time-s/2225/11 "2022-07-14T16:22:22Z")

</div>

Alpaca provides live data with websockets with their free tier. So for scalping purpose it should be fine.
