Skip to content

whoIsClownHere/Yahoo-Stocks-QT6-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Yahoo Stocks banner

Python PyQt6 Yahoo Finance License

Track weighted stock portfolios, calculate historical returns, export CSV analytics, and visualize performance from a clean Qt desktop interface.

Features · Quick Start · Usage · Architecture · Roadmap

---

📌 Overview

Yahoo Stocks is a Python desktop application built with PyQt6 for tracking the historical movement of an investment portfolio. The app fetches stock data from Yahoo Finance, calculates weighted daily portfolio returns, saves results to CSV, and provides visual analytics through multiple chart types.

It is designed as a compact portfolio-analysis tool for users who want to enter ticker symbols, assign portfolio weights, select a buy/sell date range, and quickly understand how the portfolio moved over time.

Disclaimer: This project is for educational and analytical purposes only. It is not financial advice.


✨ Features

Feature Description
📈 Yahoo Finance data retrieval Downloads historical close prices for selected stock tickers using yfinance.
⚖️ Weighted portfolio calculation Combines multiple assets according to user-defined portfolio weights.
🗓️ Calendar-based date selection Lets users choose start and end dates through a PyQt6 calendar dialog.
📄 CSV output Saves calculated portfolio returns to Data/stocks_returns.csv.
📊 Portfolio charts Generates portfolio movement, profit/loss ratio, and boxplot visualizations with Matplotlib.
🧮 Statistical summary Creates descriptive statistics such as count, mean, standard deviation, min, quartiles, and max.
🗃️ SQLite history layer Includes a SQLite-backed module for storing and clearing query history.
🖥️ Desktop-first UI Uses PyQt6 widgets, tables, dialogs, and multi-window navigation.

🖼️ Visual Workflow

flowchart LR
    A[User enters tickers, weights, separator, dates] --> B[MainWindow.py]
    B --> C[CalendarWindow.py]
    B --> D[BackEnd.py]
    D --> E[yfinance / Yahoo Finance]
    E --> D
    D --> F[Data/stocks_returns.csv]
    F --> G[StockWindow.py]
    G --> H[MoreInfoWindow.py]
    G --> I[GraphWindow.py]
    H --> J[Data/more_info.csv]
    I --> K[BuildGraphs.py]
    K --> L[Portfolio chart]
    K --> M[Profit vs loss pie chart]
    K --> N[Boxplot]
    B --> O[HistoryWindow.py]
    O --> P[WorkWithHistory.py]
    P --> Q[History.sqlite]
Loading

🧱 Tech Stack

Layer Technology
GUI PyQt6
Market data yfinance
Data processing pandas
Visualization matplotlib
Local persistence sqlite3
Export format CSV

📁 Project Structure

Yahoo-Stocks-QT6-app/
├── Qt project/
│   ├── BackEnd.py          # Yahoo Finance requests, weighted return calculation, CSV export
│   ├── BuildGraphs.py      # Matplotlib chart builders
│   ├── CalendarWindow.py   # Date picker dialog
│   ├── GraphWindow.py      # Chart selection window
│   ├── HistoryWindow.py    # History UI
│   ├── MainWindow.py       # Main PyQt6 application entry point
│   ├── MoreInfoWindow.py   # Statistical summary table
│   ├── StockWindow.py      # Portfolio return table and analytics actions
│   └── WorkWithHistory.py  # SQLite history helpers
├── Project presentation.pdf
├── LICENSE.md
└── README.md

🚀 Quick Start

1. Clone the repository

git clone https://github.com/whoIsClownHere/Yahoo-Stocks-QT6-app.git
cd Yahoo-Stocks-QT6-app

2. Create a virtual environment

macOS / Linux

python3 -m venv .venv
source .venv/bin/activate

Windows PowerShell

python -m venv .venv
.venv\Scripts\Activate.ps1

3. Install dependencies

pip install PyQt6 pandas yfinance matplotlib

4. Create the data directory

The app writes generated CSV files into Data/.

macOS / Linux

mkdir -p "Qt project/Data"

Windows PowerShell

New-Item -ItemType Directory -Force -Path "Qt project\Data"

5. Run the app

cd "Qt project"
python MainWindow.py

🧭 Usage

  1. Open the application.

  2. Enter stock tickers in the stock name field.

    Example:

    AAPL, MSFT, NVDA
    
  3. Enter portfolio weights in the same order.

    Example:

    0.4, 0.35, 0.25
    
  4. Keep or change the separator.

    Example:

    , 
    
  5. Select purchase and sale dates using the calendar buttons.

  6. Click Get Data.

  7. Review the generated return table.

  8. Open charts or statistical summaries from the results window.


📊 Analytics

The app produces two main CSV outputs:

File Purpose
Data/stocks_returns.csv Stores daily weighted portfolio return values.
Data/more_info.csv Stores descriptive statistics generated from the return table.

Available visualizations:

  • Portfolio movement chart — shows the overall movement of the portfolio.
  • Profit/loss pie chart — compares the number of profitable and losing days.
  • Boxplot — visualizes distribution, median, spread, and outliers.

🧩 Core Modules

MainWindow.py

Main application window. It handles user input for tickers, weights, separators, and dates, then launches the calculation workflow.

BackEnd.py

Fetches historical stock data using yfinance, calculates weighted portfolio movements, and writes return data to CSV.

StockWindow.py

Displays calculated portfolio return data in a table and provides actions for charting and advanced information.

BuildGraphs.py

Builds Matplotlib visualizations for portfolio movement, profit/loss distribution, and return distribution.

MoreInfoWindow.py

Displays statistical summary data generated with pandas.

WorkWithHistory.py

Contains SQLite helper functions for reading, writing, and clearing query history.


🖼️ Screenshots

The repository currently includes a project presentation PDF:

Open project presentation

Suggested screenshot layout for future updates:

docs/assets/
├── main-window.png
├── results-table.png
├── portfolio-chart.png
├── statistics-window.png
└── graphs-window.png

After adding screenshots, you can embed them like this:

<p align="center">
  <img src="docs/assets/main-window.png" width="48%" alt="Main input window">
  <img src="docs/assets/results-table.png" width="48%" alt="Portfolio results table">
</p>

🛠️ Development Notes

A few improvements that would make the project easier to install and maintain:

  • Add a requirements.txt file.
  • Add input validation for missing tickers, invalid weights, empty dates, and unmatched ticker/weight counts.
  • Use pathlib for reliable cross-platform paths.
  • Ensure Data/ is created automatically before CSV export.
  • Package the project as an installable Python application.
  • Add automated tests for portfolio-return calculations.
  • Add GitHub Actions for linting and test execution.

🗺️ Roadmap

  • Add requirements.txt
  • Auto-create the Data/ directory
  • Improve ticker and weight validation
  • Persist and replay query history from SQLite
  • Add export buttons for generated charts
  • Add application theme support
  • Add tests for calculation logic
  • Build standalone desktop releases with PyInstaller

🤝 Contributing

Contributions are welcome.

  1. Fork the repository.

  2. Create a feature branch.

    git checkout -b feature/your-feature-name
  3. Commit your changes.

    git commit -m "Add your feature"
  4. Push the branch.

    git push origin feature/your-feature-name
  5. Open a pull request.


📜 License

This project is licensed under the MIT License. See LICENSE.md for details.


Made with Python, PyQt6, pandas, Matplotlib, SQLite, and Yahoo Finance data.

Footer banner

::: ​​

About

PyQT6 project that parses, receives and processes data from Yahoo Finance

Topics

Resources

License

Stars

3 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages