Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📈 Stock Explorer

An interactive quantitative finance dashboard for analyzing historical equity performance, risk, market relationships and return distributions.

Built with Python, pandas, Plotly and Streamlit.


Python Streamlit Tests License

Open in Streamlit

Overview

Stock Explorer is an end-to-end financial analysis application that retrieves historical market data, computes professional portfolio metrics and presents the results through an interactive dashboard.

Unlike many introductory stock dashboards that simply display historical prices, this project focuses on quantitative analysis, including risk-adjusted performance, rolling statistics, benchmark comparison and statistical characteristics of return distributions.

The project was developed as the first project in a larger quantitative finance programming portfolio.


Motivation

One of the biggest differences between looking at a stock chart and performing quantitative analysis is asking why historical performance behaved the way it did.

Instead of answering only:

"What was the return?"

this project also explores questions such as:

  • How volatile was the asset?
  • How did risk evolve over time?
  • How closely did it move with the market?
  • Did it outperform what CAPM would predict?
  • Were returns normally distributed?
  • Which months contributed most to performance?
  • How severe were historical drawdowns?

The application also generates automatic rule-based interpretations, transforming numerical metrics into concise analytical observations.


Features

Market Data

  • Historical OHLCV data
  • Adjusted closing prices
  • Benchmark retrieval
  • Data validation

Performance Analysis

  • Daily returns
  • Cumulative returns
  • Total return
  • Annualized return
  • Rolling returns

Risk Analysis

  • Annualized volatility
  • Rolling volatility
  • Drawdown
  • Maximum drawdown
  • Maximum drawdown period

Market Relationship

  • Benchmark comparison
  • Correlation
  • Rolling correlation
  • Beta
  • Rolling beta
  • CAPM Alpha

Statistical Analysis

  • Return distribution
  • Mean and median returns
  • Skewness
  • Excess kurtosis
  • Best and worst trading days
  • Monthly return heatmap

Visualization

  • Interactive price chart
  • Moving averages
  • Candlestick chart
  • Trading volume
  • Benchmark comparison
  • Regression scatter plot
  • Rolling analysis dashboard
  • Distribution histogram
  • Monthly heatmap

Dashboard

  • Interactive Streamlit interface
  • Custom theme
  • Downloadable market data
  • Automatic interpretation engine
  • Cached analysis
  • Input validation

Project Structure

src/
    stock_explorer/
        data.py
        metrics.py
        indicators.py
        charts.py
        interpretation.py
        report.py

tests/
    test_metrics.py
    test_interpretation.py

assets/
    screenshots/

app.py
README.md
requirements.txt
LICENSE

The project separates responsibilities into:

  • data retrieval
  • financial calculations
  • technical indicators
  • visualization
  • interpretation
  • report generation

allowing the dashboard layer to remain lightweight.


Dashboard Preview

The screenshots below show an example analysis of AAPL relative to SPY over a user-selected historical period.

Performance Overview

Review headline performance and risk metrics, moving averages, price history, trading volume and automatically generated interpretations.

Stock Explorer performance overview

Rolling Analysis

Track how trailing returns, annualized volatility, correlation and beta evolve over time using a configurable rolling window.

Rolling return, volatility, correlation and beta

Return Distribution

Examine the distribution of daily returns, descriptive statistics and the strongest and weakest trading days in the selected period.

Daily return distribution and extreme trading days

Monthly Performance

View compounded monthly returns in a calendar heatmap and identify the strongest and weakest months in the sample.

Monthly return heatmap and distribution interpretation

Benchmark Analysis

Compare the asset with a selected benchmark through normalized performance, excess return, beta, correlation and CAPM alpha.

Asset and benchmark relationship analysis


Technologies

  • Python
  • pandas
  • NumPy
  • Plotly
  • Streamlit
  • SciPy
  • pytest
  • yfinance

Installation

git clone https://github.com/enesozs/stock-explorer.git

cd stock-explorer

python -m venv .venv

source .venv/bin/activate

pip install -r requirements.txt

Run:

python -m streamlit run app.py

Testing

The project includes automated unit tests covering:

  • return calculations
  • rolling metrics
  • drawdown calculations
  • benchmark statistics
  • monthly returns
  • interpretation rules

Run:

python -m pytest

Future Improvements

Possible extensions include:

  • Portfolio analysis
  • Multi-factor models
  • Fama-French factors
  • Monte Carlo simulation
  • Portfolio optimization
  • Efficient frontier
  • Value at Risk (VaR)
  • Expected Shortfall
  • Forecasting models

Lessons Learned

This project involved:

  • modular software design
  • financial time series analysis
  • statistical analysis
  • interactive visualization
  • quantitative performance measurement
  • automated testing
  • dashboard development

It also reinforced the importance of separating calculation, interpretation and presentation into independent components.


Disclaimer

This application is intended for educational purposes.

Historical performance does not guarantee future results and the dashboard should not be interpreted as investment advice.

About

Interactive quantitative finance dashboard for historical equity performance, risk and benchmark analysis.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages