Bokeh can be used to visualize stock market data. Visualization is be done using the
plotting module. Here we will be using the sample stock datasets given to us by Bokeh.
Downloading the dataset :
To download the sample datasets run the following command on the command line :
Alternatively, we can also execute the following Python code :
import bokeh bokeh.sampledata.download()
Analyzing the dataset :
In the sample data provided by Bokeh, there are datasets of the stocks of the following companies :
- AAPL which is Apple
- FB which is Facebook
- GOOG which is Google
- IBM which is International Business Machines
- MSFT which is Microsoft Corporation
All these datasets are available as CSV files. Below is a glimpse into the IBM.csv file :
Date Open High Low Close Volume Adj Close 01-03-2000 102 105.5 100.06 100.25 10807800 84.48 02-03-2000 100.5 105.44 99.5 103.12 11192900 86.9 03-03-2000 107.25 110 106.06 108 10162800 91.01 06-03-2000 109.94 111 101 103.06 10747400 86.85 07-03-2000 106 107 101.69 103 10035100 86.8
The file contains the stock data between the years 2000 and 2013 with over 3000 entries.
Visualizing the Stocks :
We will be plotting a line graph which will track the closing price of the stocks between the years 2000 and 2013 of all the 5 available companies.
- Import the required modules :
- figure, output_file and show from bokeh.plotting
- AAPL, FB, GOOG, IBM and MSFT from bokeh.sampledata.stocks
- Instantiate a figure object with the title and axis types.
- Give the names to x-axis and y-axis.
- Plot line graphs for all the 5 companies.
- Display the model.
- Python Bokeh – Visualizing the Iris Dataset
- Python | Visualizing O(n) using Python
- Python - Stock Data Visualisation
- Python - Performing operations on the stock data
- Python | Visualizing image in different color spaces
- Building and visualizing Sudoku Game Using Pygame
- Visualizing representations of Outputs/Activations of each CNN layer
- Visualizing Relationship between variables with scatter plots in Seaborn
- Visualizing training with TensorBoard
- Python - Data visualization using Bokeh
- Interactive visualization of data using Bokeh
- Python | Plotting Stock charts in excel sheet using XlsxWriter module
- NseTools - Getting Stock Quote of Given Company
- NseTools - Getting Average Price of Comapny Stock
- NseTools - Getting Base Price of Comapny Stock
- bokeh.plotting.figure.diamond_cross() function in Python
- bokeh.plotting.figure.step() function in Python
- bokeh.plotting.figure.circle_cross() function in Python
- bokeh.plotting.figure.annular_wedge() function in Python
- bokeh.plotting.figure.arc() function in Python
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.