https://github.com/dipto9999/stock_portfolio_app
Tkinter application which enables users to analyze stock purchase transactions and simulate profits with previous market data.
https://github.com/dipto9999/stock_portfolio_app
data-science matplotlib oop python sqlite statistics tkinter ux-design
Last synced: about 2 months ago
JSON representation
Tkinter application which enables users to analyze stock purchase transactions and simulate profits with previous market data.
- Host: GitHub
- URL: https://github.com/dipto9999/stock_portfolio_app
- Owner: Dipto9999
- Created: 2022-03-27T23:13:52.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-10-23T23:27:53.000Z (over 3 years ago)
- Last Synced: 2025-05-20T15:11:29.552Z (about 1 year ago)
- Topics: data-science, matplotlib, oop, python, sqlite, statistics, tkinter, ux-design
- Language: Jupyter Notebook
- Homepage:
- Size: 10.6 MB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Stock Portfolio App
## Contents
* [Overview](#Overview)
* [Inspiration](#Inspiration)
* [Design](#Design)
* [User Journey](#User-Journey)
* [Persona](#Persona)
* [Journey Map](#Journey-Map)
* [Data Flow](#Data-Flow-Diagram)
* [Implementation](#Implementation)
* [Tradeoffs](#Tradeoffs)
* [Classes](#Classes)
* [Current Portfolio](#Current-Portfolio)
* [SQLite Database](#SQLite-Database)
* [Demonstration](#Demonstration)
* [Credit](#Credit)
## Overview
Develop **Desktop App** driven by **Python** to collect stock data in local **SQLite** database, analyze market trends, visualize stock portfolio activity, and inform my personal transaction behavior.
This application is a work-in-progress. It has not been fully developed and consists of software bugs. It can currently be run with limited functionality.
### Inspiration
This was inspired primarily by my interest in visualizing and informing my decision-making for my personal **Tax Free Savings Account (TFSA)** investments. These data insights are not intended to provide professional investment advice.
I am a student interested in the technologies used in this application - this in addition serves to practice software design and development when analyzing quantitative data.
## Design
Let's go over the intended usage and functionality of our final application.
## User Journey
We're going to zoom out a little bit and consider a simplified user journey when interacting with this application.
### Persona
Let's start by going over the target user **Jack**, based upon my personal
Jack - "A personal investor interested in optimizing their portfolio returns from historical data."
It is good practice (and necessary) to consider the actions both preceding and following interaction with the application in depicting the overall journey. I'll have to do more investigation to understand when I typically access my **TFSA** account and how this may influence the design. In general, I am certain that a **Mobile App** would be most accomodating for an enhanced user experience. For learning purposes, let's continue with the **Desktop App** due to reduced development effort.
### Journey Map
The following user journey map depicts potential workflows we're looking to accomplish through this application.
We intend to create a portfolio during our first interaction. From here on, we're looking to visualize our current portfolio upon starting the application.

- User Journey 0 :
- Create Portfolio
- Visualize Market History
- Analyze Potential Transactions (TBD)
- Make Stock Transactions
- User Journey 1 ... n :
- Visualize Portfolio
- Visualize Market History
- Analyze Potential Transactions (TBD)
- Make Stock Transactions ...
The pages have been wireframed based on the user journey. In general, we want related actions to be on a single page so that the app is accomodating to Jack's mental space.
Pages
Functionality
Create Portfolio
- Visualize Portfolio
-
Analyze Potential Transactions (TBD)
- Make Stock Transactions
Visualize Market History
Lets take a look at this **Data Flow Diagram (DFD)**:

We've designed the application backend to account for :
- Data Consistency (i.e. Between SQLite database -> GUI)
- Data Sparsity (i.e. Is the market closed? Has the stock gone public at this date?)
## Implementation
This **Desktop App** was preceded by an exploratory **Notebook** in the [(`Exploration`)](Exploration) repository. The application itself was developed off of reusable code from a previous [Electrical Company](https://github.com/Dipto9999/Electrical_Company) project. This was heavily refactored and modified to incorporate our intended functionality.
### Tradeoffs
During development testing, I realized that **Python** and **SQLite** data transfers result in high system latency. Although convenient for data analytics, visualization, as well as the local database connection, there are most likely faster alternatives for implementation.
### Classes
Through utilization of **Python**'s **Object Oriented Programming (OOP)** structure, we have abstracted the app functionality in the following components :
* [Market](market.py)
* [Porfolio](portfolio.py)
* [GUI](app.py)
The [(`app.py`)](app.py) Python file must be run to add, delete, or modify portfolios.
#### Current Portfolio
When running the application, we can see here that our portfolio is at a **$1272.8 USD** unrealized loss with a total value of **$2144.4 USD** and is composed exclusively of **TSLA** shares.
### SQLite Database
We have included the **SQL** tables in the [(`stock_trades.db`)](stock_trades.db) **SQLite** database.
We run the `sqlite3 stock_trades.db` and `.tables` commands to identify our table names as specified in the [(`market.py`)](market.py) and [(`portfolio.py`)](portfolio.py) modules.
Let's query the `Muntakim_balances` table.
We can see here that our **TSLA** balance (i.e. deposited amount) is **$3416.2**. This is consistent with the data from the portfolio visualization.
## Demonstration
Here is a quick demonstration of the application and creating a new portfolio.
https://user-images.githubusercontent.com/52113009/197423041-074e3278-a808-49dd-a7a9-8ad1b2a625b8.mp4
## Credit
The following links were consulted as reference in this exploration.
* [NeuralNine Youtube Channel](https://www.youtube.com/playlist?list=PL7yh-TELLS1HJzPsb6Xjdse2zbyQ-ocDH)