This is a Bokeh application that allows you to visualise stock data for two stocks of your choice. You can select the stock tickers, date range, and technical indicators to display on the chart.
- View candlestick charts for two stocks side by side
- Select a custom date range
- Display technical indicators:
- 30-day Simple Moving Average (SMA)
- 100-day Simple Moving Average (SMA)
- Linear Regression trend line
- Interactive panning and zooming on the chart
- Python 3.x
- pandas
- numpy
- bokeh
- yfinance
- pandas_datareader
- math
- datetime
- setuptools
It's recommended to create a virtual environment to manage the project dependencies. Follow these steps:
- Create a new virtual environment:
python -m venv venv
. - Activate the virtual environment:
source venv/bin/activate
. - Install dependencies via pip.
- Clone or download the repository.
- Navigate to the project directory.
- Run the
main.py
script: - The application will open in your default web browser.
- Enter the stock tickers for the two stocks you want to analyze.
- Select the start and end dates for the date range.
- Choose the technical indicators you want to display on the chart.
- Click the "Load Data" button to fetch the stock data and generate the chart.
main.py
: The main script that runs the Bokeh application.load_data
function: Fetches stock data from Yahoo Finance using theyfinance
library.plot_data
function: Generates the candlestick chart and plots the selected technical indicators.on_button_clicked
function: Handles the "Load Data" button click event and updates the chart with the user's selections.