A portfolio management website made with Python, Flask, SQLite, Javascript, HTML, CSS, and Yahoo Finance APIs
13
stars
2
forks
source link
MyShare Portfolio Manager
DESCRIPTION
This website manages users' stock portfolios - showing holdings, lots, and sells.
It shows users the profit they have made from selling, and the value increase of their current holdings.
It also gives users access to live stock information of any symbol.
The website is hosted locally by running as a Python Flask app.
The Flask app hosts all the pages of the app, along with API endpoints used by the front end.
Yahoo Finance APIs are used to get current stock information.
FILE INFO
MyShareApi.py3 defines logic for API endpoints and hosts the website.
User information is gathered and stored by connecting to the MyShare database.
Live stock information is gathered from Yahoo Finance APIs.
Passwords are encrypted using passlib.hash.sha256_crypt
before being inserted into the database.
The API is hosted on localhost port 1817.
The database folder contains the MyShare database (SQLite) and the SQL used to create it. The database includes:
a Users
table
a Holdings
table
a PasswordReset
table
a trigger which automatically removes password reset codes that are more than 5 minutes old
multiple indexes to make common queries more efficient
The templates folder contains the HTML files for all front end webpages.
The static/js folder contains the JavaScript files for all front end webpages.
The static/css folder contains the CSS files for all front end webpages.
API FUNCTIONALITY
PROGRAM SETUP
Download this repo and make sure python3 and pip3 are installed on your machine.
Run PipInstalls.sh to make sure all required python dependencies are installed.
To enable password recovery through email (optional) :
Set up a Gmail account to be used as the MyShare system email (using a personal email is not reccomended, as security settings will need to be turned off).
Go to https://myaccount.google.com/lesssecureapps and turn "Allow less secure apps" on.
Put the account's email address as the ADMIN_EMAIL_ADDRESS
value and the account's password as the ADMIN_EMAIL_PASSWORD
value in lines 19 and 20 of MyShareApi.py3 .
Navigate to this directory and run the Flask app:
$ python3 MyShareApi.py3
Visit the MyShare home page http://localhost:1817/myshare/home
Symbol Lookup
Live Stock Prices
Holdings
Lots
Sell Lots
Create Account
Password Recovery
Login
Update Account Info