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.
17 lines
352 B
17 lines
352 B
2 years ago
|
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()
|