Skip to content

This is a repository for creating a financial dashboard app with Streamlit and deploying it online to the Heroku platform.

License

Notifications You must be signed in to change notification settings

KOrfanakis/Financial_Dashboard_App

Repository files navigation

This repository demonstrates how to create a financial dashboard with Python’s Streamlit and deploy it to the Heroku cloud platform.


  • Access the application:
  • See the application in action:
  • View the app as a notebook:

Table of Contents

  1. The Dashboard
  2. Dataset
  3. Files
  4. Brief Introduction to Technical Indicators
  5. Trading Strategy
  6. References
  7. Feedback

The Dashboard

The dashboard application calculates and (interactively) displays stock price information and indicators. Specifically, it plots:

  • A candlestick chart for the stock's price, along with the 12- and 26-period exponential moving average,
  • The MACD indicator, along with its signal line,
  • The Relative Strength Index (RSI) indicator, and finally,
  • The trading volume.

It also includes a trading strategy based on the MACD indicator and its signal line. This project is not a tutorial on finance terms and concepts; however, I have included a section titled ‘Brief Introduction to Technical Indicators’ that introduces some of these topics.


❗❗❗Disclaimer❗❗❗: Any information provided in this project is for educational purposes only. It is not intended as financial or investment advice and should not be construed or relied on as such.


Dataset

For retrieving the dataset, we will use yfinance, which offers a reliable, threaded, and Pythonic way to download historical market data from Yahoo! finance. We just need to specify the stock's ticker and the time frame of interest. The extracted dataset contains daily data for the opening, lowest, highest, closing, and adjusted closing price of the stock, along with its trading volume.


Files

The source code for implementing the Streamlit application is organised into two Python Scripts:

  • Dashboard_App.py: the main script.
  • Dashboard_Functions.py: a separate script with all custom functions required for the application.

Just by having these two files, we can run a Streamlit app locally in a browser [1]. For deployment to Heroku, three extra files are needed:

  • requirements.txt – A text file that contains all libraries that need to be installed for the app to work.
  • setup.sh – A shell file that creates a streamlit folder.
  • Procfile – A simple text file used to first execute the setup.sh and then call streamlit run to run the application.

You can read more about these files in Refs [1-3].


Brief Introduction to Technical Indicators

Simply put, technical indicators are visual tools used by investors/traders to help them make investment choices. Technical indicators use historical data to interpret and forecast the future price action of a financial asset [4]. Together, these indicators form the basis of technical analysis [5].

Examples of common technical indicators include the Relative Strength Index, Money Flow Index, Stochastics, MACD, and Bollinger Bands.

In this notebook, we will only use two indicators:

  1. Moving average convergence divergence (MACD) [6]: The MACD is calculated by subtracting the 26-period exponential moving average (EMA) from the 12-period EMA.
    The result of that calculation is the MACD line. A nine-day EMA of the MACD (called the "signal line") is then plotted on top of the MACD line, which can function as a trigger for buy and sell signals. Traders may buy the asset when the MACD crosses above its signal line and sell the asset when the MACD crosses below the signal line.

  2. Relative Strength Index (RSI) [7]: measures the magnitude of recent price changes to evaluate overbought or oversold conditions in the price of an asset. The RSI is displayed as an oscillator (a line graph that moves between two extreme values) and can have a value from 0 to 100.
    Traditional interpretation and usage of the RSI are that values of 70 or above indicate that a security is becoming overbought or overvalued and may be primed for a trend reversal or corrective pullback in price. An RSI reading of 30 or below indicates an oversold or undervalued condition.


MACD measures the relationship between two EMAs, while the RSI measures price change in relation to recent price highs and lows. These two indicators are often used together to provide analysts with a more complete technical picture of a market.

Both indicators measure momentum in a market. However, because they measure different factors, they sometimes give contrary indications [6].


Trading Strategy

In our case, we will construct our trading strategy based on the MACD indicator and its signal line. Specifically, we will create a 'Buy Signal’ when the MACD crosses above its signal line and a ‘Sell Signal’ when the MACD crosses below the signal line. The two types of signals will be overlayed on the candlestick chart as triangles (specifically, green up-pointing triangles for ‘Buy’ and yellow down-pointing triangles for ‘Sell’).


References



Feedback

If you have any feedback or ideas to improve this project, feel free to contact me via:

Twitter LinkedIn

About

This is a repository for creating a financial dashboard app with Streamlit and deploying it online to the Heroku platform.

Topics

Resources

License

Stars

Watchers

Forks

Languages