This repo shall contain all the content for my senior year at La Salle College Prep.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
highschool-senior/apgov/stocks_history.py

18 lines
377 B

2 years ago
import csv
import yfinance as yf
tickers = ["FSLY", "NET", "FB", "RKLB"]
data = [["ticker", "close"]]
for ticker in tickers:
stock = yf.Ticker(ticker)
close_history = stock.history(period="15d")['Close'].tolist()
data.append([ticker, close_history])
print(close_history)
f = open('history.csv', 'w')
writer = csv.writer(f)
writer.writerows(data)
f.close()