Python stock price checker

Test this API:

  • stocks must be valid NASDAQ ticker symbols (case doesn't matter), and at least one is required.
  • like must be either blank or true. Sending true will add one "like" in the database to the stock(s) included in the query (though only one like can be recorded for each IP).
API output:

View the source on GitHub or

This is a Python port of my Node.js stock price checker, built with Flask and SQLite. The above front end API test also uses Bootstrap, jQuery, and highlight.js. The API fulfills the following user stories:

  1. I can GET /api/stock-prices with form data containing a Nasdaq stock ticker and recieve back an object stockData.
  2. In stockData, I can see the stock (string, the ticker), price (decimal in string format), and likes (int).
  3. I can also pass along field like as true (boolean) to have my like added to the stock(s). Only 1 like per IP should be accepted.
  4. If I pass along 2 stocks, the return object will be an array with both stocks' info, but instead of likes, it will display rel_likes (the difference between the likes on both) on both.
  5. A good way to receive current price is the following external API (replacing 'GOOG' with your stock):