I am currently creating a program where I want to fetch stock data from yahoo finance using the yahoo_finance module. However, I want to fetch data for 4 stocks using what i assume would be a loop. Here's the basic structure I thought of using:
from yahoo_finance import Share
ticker_symbols = ["YHOO", "GOOG", "AAPL"]
i = 0
while i < 4:
company = Share(str(i))
print (company.get_open())
i += 1
The main problem I need assistance with is how I would construct a loop that iterates over all the ticker_symbols. As you can tell from my "try" above I am completely clueless, since I am new to python. A secondary problem I have is how I would fetch data from 30 days ago up to current date using the module. Maybe I should have resorted to web scraping but it seems so much more difficult.