A Ruby Gem for Fantasy Football Data

Last week I released my first Ruby gem - a wrapper for the Fantasy Football Nerd API.

I started playing fantasy football last year, not because I was an NFL fan, but because of the data. Inspired by Moneyball, I had a hunch that a data-driven approach would give me an edge over those who make decisions based on emotion, team allegiances and gut feelings. It seemed inefficient to watch twelve-hours of games on Sunday and to wade through half-a-dozen sites for news and analysis. I thought that there should be a better way to play the game - a way to filter out the noise and efficiently make objective decisions.

The first step was to find an easy-to-consume source of fantasy football data, which led me to Fantasy Football Nerd - a site that aggregates projections from twenty-six sources and weights them based on historical accuracy. Their “wisdom of the crowds” approach mitigates the risk of relying on a single pundit, similar to polling the audience in Who Wants to be a Millionaire.

I used the projections and player data from the Fantasy Football Nerd API ($9/season for full access) in conjunction with the Yahoo Fantasy Sports API to build an information dashboard in Ruby on Rails to pull all the relevant information about my team into one location, while ignoring the rest.

My app let me juke and jive. I identified undervalued players and started guys from my bench if they faced a weak defense that week. I picked up kickers expected to perform well one week, and ditched them the next. By the end of the season I had made over 60 “moves” (adding and dropping players), whereas the rest of the league averaged less than twenty.

How did it work out? I won my league… not bad considering I couldn’t name five quarterbacks before the start of the season. I admit that I came to love the excitement of watching my players on Sunday, and the camaraderie of  discussing the game with fellow managers during the week. I realize now that I had never become a football fan because I make a poor spectator -  fantasy football gave me a way to participate.

The 2012 season starts in one week, and I can’t wait. I’ve joined a more competitive league, refactored my tools, and I’m hoping to repeat my success. It’s far from guaranteed - football has a huge variance due to a small sample size of sixteen games and an unbelievably high rate injury rate (only half the players I drafted made it through the season unscathed). But, this data-driven approach provides a compelling programming challenge, a non-trivial edge on the fantasy football field, and a reason for a geek like me to participate in America’s favorite cultural obsession.