My Book!

Simple Stock Ticker App

Share this article: TwitterFacebookGoogle+Diaspora*Email

This was just a very simple learning project I did as part of The Data Incubator program.

The project itself was just a simple stock ticker. It requires as input the ticker, and produces a graph of the stock prices over time. Here is the finished product. You can also see the code for it here.

Flask Framework

Flask is a lightweight Python framework. It's pretty simple to use. Set up some template html files, define some GET and POST methods, and you're good to go.

The Data Incubator provded a pretty simple template for getting started. It provided some sample files, but the app itself just returned whatever the index template was.

The modified the template to have two pages: the index page, which just has a GET command, and a graph page, which has POST.

On the index page, the user inputs the ticker they want. This is used in the POST command, which requests and then plots the data.

Requesting Data

The data I used for my stock ticker came from Quandl. I used Python's Requests library to make API requests.

Plotting Data

After requesting the data and getting it into a usable format, I plotted it using Bokeh.

Overall I really like Bokeh - some things are easier to do in Bokeh than in either Seaborn or matplotlib. But it definitely isn't perfect, and some things that feel like they should be trivial end up being more work than you would expect.

But the real power of Bokeh is that the figures it produces can be output into javascript format so they can easily be placed into a website. So the code for the Bokeh figure is easily just placed into the graph.html template as javascript code, and it appears, all while staying in Python world.

Comments !