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.
16 lines
352 B
16 lines
352 B
import csv
|
|
import yfinance as yf
|
|
|
|
tickers = ["FB", "NET", "RKLB", "FSLY"]
|
|
|
|
data = [["ticker", "close"]]
|
|
|
|
for ticker in tickers:
|
|
stock = yf.Ticker(ticker)
|
|
close_history = stock.history(period="15d")['Close'].tolist()
|
|
data.append([ticker, close_history])
|
|
|
|
f = open('history.csv', 'w')
|
|
writer = csv.writer(f)
|
|
writer.writerows(data)
|
|
f.close()
|
|
|