API Documentation - Sheeptoaster/Capstone GitHub Wiki

API Routes

Users


GET /api/users/:userId Will return user information.

PUT /api/users/edit/:userId Allows user to update their information.

Portfolios


GET /api/portfolios/:userId Allows user to view their portfolio.

PUT /api/portfolios/add/:stockId/:userId Run when user purchases additional or sells partial amount of stock owned.

DELETE /api/portfolios/:userId Run when user sells all of a particular stock in portfolio.

Watchlist


GET /api/watchlists/:userId Allows user to view their watchlist.

POST /api/watchlists/:userId Allows user to add stock to their watchlist.

PUT /api/watchlists/change/:stockId/:userId Will allow user to update price alert value on stock currently in watchlist.

DELETE /api/watchlists/change/:stockId/:userId Removes a stock from user`s watchlist.

GET /api/watchlists/alert/:userId Checks to see if any of the user's watchlist stocks have dropped under the price alert value.

Stocks


GET /api/stocks/ Updates the stock's price and weight, stores the updated values in the price history table, and purges data entries over 90 price histories old.

GET /api/stocks/all/:userId Returns overview of all stocks and if user owns/watches those stocks.

POST /api/stocks/buy/:stockId/:userId Allows user to purchase a stock.

PUT /api/stocks/buy/:stockId/:userId Allows a user to buy additional stocks that they already own.

DELETE /api/stocks/sell/:stockId/:userId Allows user to sell partial amount of stock they own.

DELETE /api/stocks/sell/:stockId/:userId Allows a user to sell all of a stock they currently own.

GET /api/stocks/daily-change Returns stocks that have gone up or down the most in value.

GET /api/stocks/growth/:stockId Returns stock information in format able to be used by charts.

GET/api/stocks/get/:stockId Returns stock information.

POST /api/stocks/post/new Allows users to create and list a new company.

Transactions

GET /api/transactions/get/:userId/ Returns transaction details for a user.