Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a basic schema for storing trading data #3

Open
DanielPointon opened this issue Aug 13, 2022 · 0 comments
Open

Create a basic schema for storing trading data #3

DanielPointon opened this issue Aug 13, 2022 · 0 comments

Comments

@DanielPointon
Copy link
Owner

We'll need to store data on stock prices and purchases over time in the database. This will require a database schema. I'm guessing:

  • stocks table (ID, stock_name, exchange)
  • stock_values (stock_id, value, time)
  • user_purchases (id, user, stock_id, quantity)
  • users (id, email, password_hash) - can be extended if we want profiles etc
  • user_portfolio_entries (id, user_id, stock_id, quantity)

Note duplication of data between user_purchases and user_portfolio_entries is to avoid recalculating a user's current portfolio based on their historical purchases every time they load the app. Can be thought of as a changelog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant