YFinance — Building Candlestick Charts with Tableau

In [1]:
import yfinance as yf
import pandas as pd
tesla = yf.download("TSLA", start="2020-01-01", end=pd.to_datetime("today").strftime("%Y-%m-%d"))
[*********************100%%**********************]  1 of 1 completed
In [2]:
tesla
Out[2]:
Open High Low Close Adj Close Volume
Date
2020-01-02 28.299999 28.713333 28.114000 28.684000 28.684000 142981500
2020-01-03 29.366667 30.266666 29.128000 29.534000 29.534000 266677500
2020-01-06 29.364668 30.104000 29.333332 30.102667 30.102667 151995000
2020-01-07 30.760000 31.441999 30.224001 31.270666 31.270666 268231500
2020-01-08 31.580000 33.232666 31.215334 32.809334 32.809334 467164500
... ... ... ... ... ... ...
2024-01-29 185.630005 191.479996 183.669998 190.929993 190.929993 125013100
2024-01-30 195.330002 196.360001 190.610001 191.589996 191.589996 109982300
2024-01-31 187.000000 193.970001 185.850006 187.289993 187.289993 103221400
2024-02-01 188.500000 189.880005 184.279999 188.860001 188.860001 91843300
2024-02-02 185.039993 188.690002 182.000000 187.910004 187.910004 110505100

1029 rows × 6 columns

In [3]:
tesla.to_csv("/Users/mekki/Desktop/TSLA.csv")