I am looking for a free S&P 500 data feed, preferably one with a REST API. It appears that Yahoo Finance & Google Finance have discontinued their feeds. For example, http://download.finance.yahoo.com/d/quotes.csv?s=GOOG+AAPL&f=snl1 returns, "It has come to our attention that this service is being used in violation of the Yahoo Terms of Service..." Does anyone know of a free S&P 500 data feed? Delayed quotes are fine.
4 Answers
If you use Python combined with Beautifulsoup you can easily get data from multiple sites. Example:
from bs4 import BeautifulSoup
import urllib2
url = "https://finance.yahoo.com/quote/A?p=A"
content = urllib2.urlopen(url).read()
soup = BeautifulSoup(content)
soup = soup.find_all('script')
soupstr = str(soup)
print soupstr[soupstr.find("regularMarketPrice")+27:soupstr.find("regularMarketPrice")+35]
The only problem is you will actually use 0,4 MB per quote which I think is a lot of unnecessary use of bandwith and capacity.
Or maybe you can use Quandl.
Good Luck!

- 11
- 1
-
Thanks, @Wietse-de-wit. I was hoping that I didn't have to resort to screen scraping, but it will work. Thanks for mentioning Quandl. I'll check it out. – John DiFini Nov 20 '17 at 17:39
So far, I have come across Alpha Vantange and Tradier. At a cursory glance, Alpha Vantage appears to offer semi-realtime quotes by providing high & low quotes over an interval (1 min is the smallest interval).
Tradier appears to offer free delayed quotes for a "sandbox" environment.

- 96
- 2
- 6
Try this (took from yFinance source code ):
https://query2.finance.yahoo.com/v8/finance/chart/%5EGSPC
I'm not sure if the current price is comming in this response.
EDIT:

- 1,922
- 4
- 28
- 53
-
Try it for gold too! https://query2.finance.yahoo.com/v8/finance/chart/GC=F – Magno C May 06 '22 at 13:20
I wound up using IEX Cloud (e.g. https://cloud.iexapis.com/stable/stock/TSLA/quote?token=xxxx). You can sign up for a free account here - https://iexcloud.io. Lastly, here's their terms of use - https://iexcloud.io/terms.

- 96
- 2
- 6