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

Backend planning. #25

Open
2 tasks
jgabriel1 opened this issue Oct 29, 2020 · 0 comments
Open
2 tasks

Backend planning. #25

jgabriel1 opened this issue Oct 29, 2020 · 0 comments

Comments

@jgabriel1
Copy link
Owner

The next important features to be included in the backend are:

  • 1 - Consider the extra costs in the Stock Wallet calculation.

The value assigned as extra cost is considered "wasted" and should be considered when calculating the current profit the user can make from their transactions. Basically, it's supposed to be added to the bought price of the income transactions, as if they were more expensive than they actually were.

In the same way, it should be subtracted from the sold price in outcome transactions, as if they were worth less than what they actually were sold for.

This calculation should probably be made separately in the Mongo pipeline aggregation query and then added (or subtracted) at the end from the total values.

  • 2 - Make it possible to show the current already accomplished profit (or loss) the user made from a given stock.

This should be fairly easy and it should be given by the formula:

total value from all outcome transactions
- (MINUS)
total number of shares for all outcome transactions X average bought price for all income transactions

The product is basically all the money invested to buy all those shares that were sold. Then you subtract that from the total recieved value for all the sold shares.

P.S.: It is very important to remember the extra costs here. They should absolutely be considered in this calculation.

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