Extract any stock’s data and visualize the data using Python (No need to install Python or a IDE)

0

With the help of the below video tutorial, you’ll learn how to extract data of any stock from Yahoo Finance, visualize the data by constructing a chart and also download the stock’s data to an excel sheet, using Python.

You can implement the code using a Python IDE or by simply using Google Colaboratory (link given below) as instructed in the video.

Instructor: Chirag Chhatbar

Link to Google Colaboratory: https://colab.research.google.com/

Code:
#Import the libraries
import math
import pandas_datareader as web
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

#Get the stock quote
df = web.DataReader(‘RELIANCE.NS’, data_source=’yahoo’, start=’2014-01-01′, end=’2020-01-02′)

#Show the data
df

#Visualize the closing price history
plt.figure(figsize=(16,8))
plt.title(‘Close Price History’)
plt.plot(df[‘Close’])
plt.xlabel(‘Date’, fontsize=9)
plt.ylabel(‘Close Price INR’, fontsize=9)
plt.show()

from google.colab import files
df.to_excel(‘Data.xlsx’)
files.download(‘Data.xlsx’)

#End of the code

Thanks for watching! Hope you could learn something from this tutorial. If the video was useful, please like and share the video, and subscribe to our channel for more such informative videos.

Leave a Reply