-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sleep 3 seconds and retrying https://paper-api.alpaca.markets/v2/account 3 more time(s) #45
Comments
so this is a known issue. it happens when doing a rest request to the servers too often. I'm working on resolving it and it will be fixed in the next release. |
@shlomikushchi Ok, but I don't see my logs from algorithm, so I am not sure that it's working. |
which data source are you using? alpaca data api or polygon? |
@shlomikushchi polygon with AlpacaStore. Without Alpaca broker works good. |
are you using an IDE? try putting a breakpoint in |
@shlomikushchi yes. Put breakpoint inside |
ok I understand. I will try to debug this soon and will let you know. |
could you check which version of alpaca-trade-api-python you have installed? |
@shlomikushchi
|
could you update alpaca-trade-api to the latest version and try again? |
and now even without alpaca broker I can't use it, looks I need downgrade it?
|
I downgraded Next time will make updates on new environment because now I can use your libraries at least with live data feed for testing without alpaca broker. |
ok, just remember to update all packages when we release the new version |
I mean with old versions. With new not working at all. But I will try with new env from scratch. |
check out this version and let me know if it works now: try the new version and check if you still get this error: https://github.com/alpacahq/alpaca-backtrader-api/releases/tag/v0.8.0 |
@shlomikushchi what version of python I need? I can't install 0.8.0 even from scratch. |
@shlomikushchi 0.8.0 could not find version. |
try this: |
pip freeze:
Something new in logs but "sleeping" looks like the same:
Then, I starting resampling time frames. |
After about 1 minute, it started, but sometimes I receiving |
the |
Yes, now looks like it works. |
if you want to use the polygon stream. just make sure to pass |
I don't understand why you said that "sleep 3 second" not affect algorithm. For example, If I set up |
IMO these are unrelated issues. let's try something. change line 152 in alpaca_backtrader_api/alpacabroker from this: |
|
so, I'm not sure what I see in the graphs. could you explain? are you still experiencing issues? |
Alpaca Data chart shows that data not loading because (I think so) no data or very rare (dots in example) and moving can't be calculated. It's about data quality. About issues yes - I've tried using with all your comments lines and uncomments, but it's freezing - not loading data or very slow and no matter with Alpaca data or Polygon. Maybe with Polygon faster soe times. Looks like not many people use this library, so we can't analyze problem on my side or not. |
First added
Do you see sleep message and how long it load data? |
Can you provide |
If I am using this code to log SMA:
It's very thin ticker, if it would be like AAPL, need hours to load data. On the vide speed of loading: Without |
this is the data factory I am using: DataFactory(dataname='AAPL',
historical=False,
timeframe=bt.TimeFrame.Days)
# or just alpaca_backtrader_api.AlpacaBroker()
broker = store.getbroker()
cerebro.setbroker(broker) and basically the entire stratefy code is in the sample folder of the repo |
also changing to |
so the difference is the start_date. once added it takes time to load previous data. but that also makes sense, no? |
Why without Alpaca broker it's much faster - in example above from 2020-5-1 it takes about few seconds vs hour and more with Alpaca broker? |
that is weird because the data source is the same |
Yes, but anyway I appreciate for this library because it was simpler way to start backtesting and also live trading (with side execution) with polygon.io data. |
this package wraps the python sdk. |
I'm having this problem now, but last week I ran this same code for paper trade and it worked fine....strange. |
I'm getting: sleep 3 seconds and retrying https://api.alpaca.markets/v2/account 3 more time(s)... If I click the link it gives: {"code":40110000,"message":"access key verification failed : access key not found (Code = 40110000)"} It happens in both paper trading and live mode, but not in backtests. Anyone know what's going on? |
when you run a backtest you are not connected to the broker so it makes sense it doesn't happen in that case |
That worked, thx! I just worry that in the future i'm going to be running it live and it's going to just stop working or something. Any idea what causes problems like that or if they can happen while you're running it live on a real $$ account? |
first of all always start by paper trading for a while, making sure your setup works |
Nevermind, it didn't work. The market was just closed :/ |
Yes that's how I found this, the issues page. I saw this guy had the same issue but it doesn't seem like it was ever resolved. |
I changed usePolygon to False and didn't get the error anymore. Idk what it uses if not polygon though. Maybe this is a polygon related error? I don't have money in my real $$ account yet, it's pending, so maybe I can't use polygon yet. I sent $5 to it to see if that's why i'm having this issue. |
we have 2 data sources - polygon and alpaca. |
You know what, it's not Polygon. It's something wrong with my strategy. I tried one of the sample strategies and it works fine with polygon and paper trading. I didn't find the problem specifically but it was an error on my part in the strategy. Thanks for the quick responses though! |
I'm trying to use 5 minute candles but this code seems to be giving me that sleep 3 seconds and retrying error: TRADE_LIVE = True |
When I change bt.TimeFrame.Minutes to Days the error goes away...so seems to be something to do with bt.TimeFrame.Minutes |
you are trying to get minute data for a year and a half, that could be a problem. |
OH that makes sense. I have had problems doing that with other frameworks too. Thanks I have been really frustrated trying to figure this out. |
Actually i'm not sure if that was even the problem. I deleted all alpaca and backtrader folders, everything related to either of them, then just unzipped this back into the same folder and now it no longer gives me that error. Very odd. I had an alpaca api folder as well (without backtrader) and I think that was somehow conflicting with this. |
maybe you installed things under the same virtual environment. try using a clean virtual env |
closing due to lack of activity |
I try paper trading with my own live feed using alpaca-backtrader-api. When I do resample for this data feed, I received message:
sleep 3 seconds and retrying https://paper-api.alpaca.markets/v2/account 3 more time(s)…
Sometimes it starts normally, but often no at all.
When disable alpaca broker, data feed working well.
The text was updated successfully, but these errors were encountered: