Stock Price Checker
User Stories
- Set the content security policies to only allow loading of scripts and css from the server.
- GET /api/stock-prices with form data containing a Nasdaq stock ticker and recieve back an object stockData.
- stockData contains the stock(string, the ticker), price(decimal in string format), and likes(int).
- My like can be added to the stock(s), by passing along field
like
as true(boolean). Only 1 like per IP would be accepted. - If 2 stocks are passed along, the return object will be an array with both stock's info, but instead of likes, it will display rel_likes(the difference between the likes on both) on both.
- A good way to receive current price is the following external API(replacing 'GOOG' with your stock): https://api.iextrading.com/1.0/stock/goog/price
- All 5 functional tests are complete and passing.
Example usage:
/api/stock-prices?stock=goog /api/stock-prices?stock=goog&like=true /api/stock-prices?stock=goog&stock=msft /api/stock-prices?stock=goog&stock=msft&like=true
Example return:
{"stockData":{"stock":"GOOG","price":"786.90","likes":1}}
{"stockData":{"stock":"MSFT","price":"62.30","rel_likes":-1},"stock":"GOOG","price":"786.90","rel_likes":1}]}