I am making a mock stock trading website. and for a real experience, I want users to be able to own stock and sell it.
The problem I have is I don’t know what to use or how to keep track of all the stocks a user owns.
for example, A user buys 10 Apple stock and then 10 more. Then he tries to sell 25, the website says, you only have 20. Also, the user should be able to hold multiple stocks of different number each. like 5 stocks of apple, 6 of Tesla, 18 of Ford etc. and upon buying more these number get incremented. i cant figure out how to create a model which keeps track of what and how many shares a user owns.