Noob: Getting 500 when calling Polygon API

Found a simple Python tutorial and gave it a spin:

import alpaca_trade_api as tradeapi

api = tradeapi.REST(‘key1’,‘key2’)

aapl_daily = api.polygon.historic_agg(‘day’,‘AAPL’,limit=1000).df

I am getting this error:

500 Server ERror: Internal Server Error for url: https://api.polygon.io/v1/historic/agg/day/AAPL?limit=1000&apiKey=key1

Any ideas as to why? Or any better updated tutorials for a noob just getting into this?

Thanks so much for any help!

JJ

The “500 Server ERor” is an internal web server issue. Maybe you just happened to run it when the server was having issues. Did you try it again? What is the link to the tutorial?

I’ll have to get the link when I am home, but I have tried it over multiple days in multiple different environments. I did read somewhere that you had to have an alpaca live account and I have had that funded for a while.

Thanks!
JJ

Well tried again this morning and now everything is working. Thank you for the help!

JJ

I am getting the same error now. My understanding is that it is due to the version being v1 which should v2. Did you manage to update it if so how?

I receive a “requests.exceptions.HTTPError: 500 Server Error: Internal Server Error” when using:

api.polygon.historic_agg_v2(symbol=“AAPL”, multiplier=“1”, timespan=“min”, _from=“0000-01-01”, to=“2020-02-09”)

and receive data as expected when using:

api.polygon.historic_agg_v2(symbol=“AAPL”, multiplier=“1”, timespan=“minute”, _from=“0000-01-01”, to=“2020-02-09”)

where the usage that receives an error includes ‘timespan=min’ and the usage that receives data as expected includes ‘timespan=“minute”.’

You can ask questions for polygon in Alpaca slack #dev-polygon channel or directly email to their support.