Reputation: 21573
I want to get stock data in Python for some analysis.
And I want to do analysis on many stocks, not a single one like AAPL, but like S&P 500. Specifically, US stock end-of-day price and other info like adjusted price, sector etc.
How can I do it?
I'm sorry if this question is a bit too simple. I tried to find data but didn't have a good solution.
I tried quandl
, but seems only support fetch data by ticker, and so is Yahoo finance
(from https://www.quora.com/Using-Python-whats-the-best-way-to-get-stock-data). One possible source is Quantopian
, but it only supports analysis in their online notebook. Now I'm trying Alph Advantage
When I see other's project, it's just about a csv. Did I miss something in quandl or Yahoo Finance? Or Do I need to manually fetch every ticker of SP 500 from them?
Thanks!
Upvotes: 3
Views: 3797
Reputation: 75
You can use yahoo finance for real time data like for nearly all quotes:
import pandas as pd
from pandas_datareader import data as wb
ticker='BTC-USD'
ticker=wb.DataReader(ticker,start='2015-1-1',data_source='yahoo')
print(ticker)
Yahoo Finance will give you hihg-low-adj_close etc. Just look up for the quote name from yahoo finance page and you will get all the data
Upvotes: 5