September is here, the NFL has kicked off and the fantasy season is in full swing. Kareem Hunt is a beast, Zeke is gonna serve a 6 week suspension, there’s so much going on! In this post we’ll show you how to build a price tracker for your favorite daily fantasy sports website with Ruby. It will help you stay on top of the competition and receive price alerts as soon as they happen.

Tech-wise, we will use SQLite, an embedded database, and Sequel, a lightweight database toolkit for Ruby, to store all the data downloaded for easy accessing and querying. We will then setup a recurring task that downloads the CSV every “x” amount of time, like, say, two hours, and compares the entries with the ones received in the previous update. You will then receive a recap of all changes via MMS on your phone which could look like this:

All the code is in this GitHub repo for you to follow along.

Development Environment Setup

Start by getting your machine ready to run Ruby code. You will need Bundler to manage the dependencies for this code; if you have used Ruby before you probably installed it already, but if you haven’t just type gem install bundler on the command line (doesn’t matter in what directory since it installs it globally on your machine).

You will now need to install SQLite and ImageMagick. How you do this depends a lot on what OS and package manager you’re running; on Mac brew you can use brew install sqlite and brew install imagemagick . If you’re running a Ubuntu, you can run sudo apt-get install sqlite and sudo apt-get install imagemagick libmagickwand-dev or the equivalent for your distro.

Create a project folder wherever you prefer on your computer and navigate to it. We will now refer to it as the project root folder. Now create a file called “Gemfile” in the root folder and include all these dependencies we need in it: