I Made a Flask website to track my stocks profit/loss

This is an improved version for the previous project I uploaded here a while ago.

I switched to Bootstrap (from materialized CSS) and to Flask-SQLAlchemy (from MongoDB) and re-organized the project to be more readable).

I am currently working on implementing user management functionality which allows users to sign up and have their own portfolio using [Okta](https://www.okta.com/).

https://reddit.com/link/i3mdmo/video/ye9h47rnh0f51/player

Github: [https://github.com/AcrobaticPanicc/stocks-manager](https://github.com/AcrobaticPanicc/stocks-manager)

I would **very much** appreciate any comments, suggestions, or just impressions for this project!

6 thoughts on “I Made a Flask website to track my stocks profit/loss”

  1. Why its not dockerized? Why do you send a model to html template? Why do you have your styles called untitled + untitled-1? I can go on… 🙂

    Reply
  2. I have added a reply to your earlier comment about how to automatically refresh the page, and I hope you find that useful.

    I’m very interested to know how you plan to implement Okta authentication. Are you planning to integrate with flask-login? I had a look at doing this (with a Firebase Auth), and got stuck at implementing the user class by inheriting usermixin.

    In the meantime, I have ‘rolled my own’ authentication using Firebase Auth and Pyrebase, but it’s far too messy for my liking; flask-login has some great features that I’d like to use, and I am sure that it is much more reliable than my hacked-together solution.

    Firebase Auth is good for free, but I think there are serious limitations relating to some features such as email verification; i.e. you can customise email templates (such as password reset), but for email verification emails, you are stuck with their template wording; you can’t even add a link to your sign-in page once a user has verified. I am currently investigating alternatives such as Okta.

    AWS Cognito seems to be an over-complex coding nightmare. Apparently, once it’s working it’s great, but everywhere I have looked, the general consensus is that it is ridiculously complex to implement and the documentation is not good. Perhaps it’s fine if you have an enterprise team of developers!

    Reply
  3. Very good work. Please don’t take the following as criticism.

    This is personal preference stuff, but I would:

    * Allow for shorter names, if the user enters them. Amazon, Apple, Adobe, NVIDIA, etc is sufficient, quicker to read, and doesn’t take up so much space. I’d also left justify the names so they’re easier to read as a list.
    * Format numbers for commas (or whatever is the local separator).
    * Be consistent in your formatting. If you’re going to include $ in the profit/loss column, do the same in the value column.
    * Don’t be redundant in your formatting. If you show $ and % with your numbers, don’t show them in the title line.
    * Positive values are implied, so no need to show +. Showing negative values in red is useful, but consider also showing them in parentheses to make it very clear there’s a loss.
    * Right justify numbers so their respective magnitudes are more apparent, and they’re easier to scan in a list.
    * Total shares are not especially useful, but there’s nothing wrong with showing them.
    * For total change, use a weighted average total.
    * Add share price, probably between Quantity and Value.

    If you want to take it (a lot) further:

    * Allow columns to be sorted.
    * Allow stock purchase and sale information to be input. This would allow you to break out long-term vs short-term capital gains/losses. This also means keeping track of multiple purchases and sales for the same stock, and deciding on a cost method (FIFO, average, etc). Definitely doable, definitely more complex. (Useful in USA, not sure about tax implications in other countries.) Allows for better reporting.
    * Show total gains and separately, total losses. More useful if you track purchase/sale dates so you can breakout L/T vs S/T. Useful for tax loss harvesting.
    * Allow for bonds, options, etc.
    * Have you allowed for stock splits?

    Reply
  4. When you add the stock information, I would also recommend adding a Fees/Commissions area. Sometimes they are explicit, sometimes implicit, but always there.

    Reply

Leave a Comment