Stock Analysis – Development Update Part 2

Following on from challenge 1, which was to acquire S&P 500 tickers and get them into a database to be used more frequently. I now have to face the next challenge, which is to use them to gather more information about each ticker on a daily basis.

Challenge 2: Getting stock data relating to each S&P 500 ticker

There are two fantastic resources available for me to use here. The first is the data resource and the second is communicating with that resource to bring the data back.

Resource 1: Stock Market API

Stock Market APIs that can be queried to get information regarding the stock markets. There are different levels and suppliers, so it’s very important to review the pricing model because this will dictate frequency and markets that you can query.

My plan is to only query an api server once a day, and to do so over a period of time, once the market has closed. This means I will only be doing “end of day” analysis, and not intra-day. I am also building this project on my Raspberry Pi 2B (which isnt very fast), as a prototype. I will migrate to a VPS at a later date (but I could artificially choke this communication to slow it down if needed.

Resource 2: httpie

The software I utilise on my host, is httpie. It’s a free open source API client, that can be installed on most systems, which I can control via a command line/terminal. Check it out, it’s a highly powerful and lightweight software. Brilliant!

The task, will then be to combine the two. Use httpie to api query the stock market api provider, and store the results into a location locally. This could be a text file, csv file etc per ticker and then to format the results to something friendly I can use elsewhere (likely store them into a database).

I dont feel like it is wise to dig further into the details of how this works, more than I have done. Both httpie and API suppliers have extensive documentation if you need to learn more.