Python and yfinance library make it easy to download stock price data. This post will show you how to get Nvidia's stock price data and visualize it.

Start with importing the required packages:
#import packages:
import pandas as pd
import pandas_datareader.data as web
import datetime as dt
import matplotlib.pyplot as plt
import yfinance as yf
import finplot as fplt
Get Nvidia (NVDA) stock price data using yfinance library between 22 January 1999 and 04 June 2023:
#query the data:
nvda = yf.download('NVDA', start='1999-01-22', end='2023-06-04')
Check everything is alright with the data frame:
#look at the top of the data frame
nvda.head()

#look at the bottom of the data frame
nvda.tail()

And finally visualize the data:
#candle-stick chart for Nvidia's Stock Prices
fplt.candlestick_ochl(nvda[['Open','Close','High','Low']])
fplt.show()
The whole picture:

Zoom in and look at the last two years:

Thanks for reading!
Check out this book to improve your Python skills on financial analysis:
Make a one-time donation
Make a monthly donation
Make a yearly donation
Choose an amount
Or enter a custom amount
Your contribution is appreciated.
Your contribution is appreciated.
Your contribution is appreciated.