401 Client Error: Unauthorized for url:

Using the python alpaca-trade4-api-0.53.0, I am getting:

requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://api.polygon.io/v2/aggs/ticker/SPY/range/15/minute/2018-01-14?unadjusted=False&apiKey=XXXX

I have a funded LIVE account that was working fine for weeks up until last Friday.
Today is March 1, 2021. Do I need to refresh my key?

Any recommendations would be appreciated.
Thanks.

Polygon is no longer supported. The emails said you can subscribe for a free month with them. Otherwise you need to use the new Alpaca Pro API. I will say that I have not had any luck with it yet though. My account is still acting like a basic account limited to 200 calls/min

Wow - thanks for the quick update - just found the relevant email in my gmail account.

That’s really bad news - $199/mo for real-time data is just way too much. I’ll have to look into Interactive Broker’s API and see if I can grab some intraday h1 bars from them.

Thank you.

Does anyone know of a good alternative for polygon.historic_agg_v2 that does not cost $200/month?

Any opinions on IEX Cloud ($10/month) ?

I would prefer to use Alpaca, but so far did not find polygon.historic_agg_v2 alternative
I tried get_barset, but it does not work well with splits, as far as I could tell

i use finviz it doesn’t have a api but i built on over it… works the same

For daily end-of-day bars, I use Norgate Data for $270/yr for US stocks. I essentially download the entire history/market using python and store it in one pickle file (about 1.2GB), nightly at 7 or 8PM PST. It lives in a WIndows systray and downloads prices throughout the day. The only drawback for me was having to write a python script to run within miniconda under a Windows 10 cron for scheduling. I much prefer Linux, which is not available.

As for intraday bars, I, too, am looking for an alternative. The first thing I’ll try is Interactive Broker’s API. I’ll post later if I find anything interesting.

It’s sad that Alpaca lost Polygon as that was the easiest/most direct API for intraday bars I’ve found so far.

Update: for $14.50/mo (US Securities Snapshot for $10, US Equity and Option Add-On for $4.50) or $174/yr, Interactive Broker’s API seems to work well for trade (volume), bid, ask - there are other options I haven’t tested yet. It seems that you have to sign up for IBPro (IBLite for commission-free doesn’t allow for API access) either with fixed or tiered commissions. So, theoretically, that means better fills, but you’ll have to pay some commission.

On a daily basis, the exchanges are down 8h a day so you can grab 16h worth of h1 bars.

just an update i use IEX now

IEX looks very interesting - for both its free data and its exchange services.

I like their claims of transparency, but is the IEX taking the other side of every one of your trades?
If so, there may be some conflict of interest.

no i had to switch form relying on finviz data since i saw they were manipulating the markets

just an update i use over 4 price feeds now

I ended up using the free polygon in combination with the free alpaca.

The free alpaca:

  • does not consider splits
  • have some random data gaps
  • no before and after market pricing

The free polygon:

  • very small number of API calls per minute
  • consider splits
  • have before and after market pricing info
  • I did not experienced random data gaps