/Stock_Portfolio_App

Tkinter application which enables users to analyze stock purchase transactions and simulate profits with previous market data.

Primary LanguageJupyter Notebook

Stock Portfolio App

Contents

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) repository. The application itself was developed off of reusable code from a previous 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 :

The (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) SQLite database.

We run the sqlite3 stock_trades.db and .tables commands to identify our table names as specified in the (market.py) and (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.

Portfolio_App.mp4

Credit

The following links were consulted as reference in this exploration.