-
Notifications
You must be signed in to change notification settings - Fork 0
Routes
NathanFrank285 edited this page Apr 23, 2021
·
4 revisions
- GET /dashboard
- only for logged in users
- GET /
- splash page, info about site, exclusively for logged out users, only option is to login which then redirects you to Dashboard login
- GET /Price
- returns a list of coins (each row a component with name, ticker, price, change, market cap, watchlist button) on the platform
- each component links to the coins
- returns a list of coins (each row a component with name, ticker, price, change, market cap, watchlist button) on the platform
- GET /watchlist
- POST /watchlist/<int:coinId>
- DELETE /watchlist/<int:coinId>
- GET /price/<str:coinName>
- includes price graph, 24h coin data
- GET /portfolio
- POST /portfolio/:coinId
- on a purchase or sale, check if the user already owns the coin, if they do, recalculate average cost with the new current quantity and rolling average price with the new purchase quantity and price
- Buying: Calcing new cost per share
- Order of operations: old avg. price / old quantity = total cost per share(tcps)
- tcps + (new quantity * new price) = new total cost per share(ntcps)
- ntcps/old quantity + new trade quanity = new avg. price
- Selling: Calcing new cost per share
- avg. cost should be the same, just subtract the number of coins being sold
- DELETE /portfolio/:coinId