Lines image

Self-Service App for Daily NBA Fantasy Analysis

Fantasy Sports involves competitors (usually between 8-20) selecting a virtual team of real players from a real sport (in this case, American Basketball AKA the NBA). These virtual teams will verse each other, usually over the course of 1 week, with the players performance in real life converted to fantasy points for the virtual team. Whichever team has the most points over the week will win the matchup. This occurs throughout the season of the chosen sport, with the winner being the virtual team with the most wins. 

In the world of fantasy sports, competitors are always seeking innovative ways to beat their competition. This case study outlines how FME was used to create a dynamic workflow that converts daily NBA player statistics into fantasy points that can be accessed remotely. The workflow involves extracting data from an API, transforming it into fantasy points, and generating a CSV file for distribution via the FME web app.

Challenge

A fantasy managers ability to analyse player performance & manage their “team” is restricted to the platform they are using to support the fantasy competition. In this case, the ESPN Fantasy Sports App. The platform provides a game-by-game analysis of total fantasy points scored by each player. This is useful, however, it does not suit a Category format of Fantasy Sports, where a team’s success is measured by how well your players perform in each statistical category, rather than the total performance of all categories measured with a single figure. For example, you have two players. One scores 5 points, 5 rebounds and 5 assists. The other scores 3 points, 6 rebounds and 6 assists. Even though they both tie at 15 points, the second player would win the category matchup, as they have outscored the first player 2 categories to 1. A method of turning daily statistics into a measurement of performance for the Category format is highly advantageous. This analysis increases in value, as it captures percentage-based statistics, which is not captured in the ESPN app which that fantasy competition uses.

It is all well and good to have advanced analysis on who is playing well and knowing who’s injured, but the trick is to be the FIRST one to know. A player can only be used once in Category formats, so if they are selected for a team, no one else can acquire them for their own. This becomes more complex, as there can be as many as 15 games happening in one day, with games being played every day during the season. Many times, one of my key players would get injured in a game, and by the time I found out, sometimes just a couple hours after, another competitor had picked up the player that would replace them and step into a larger role than usual. This results in having to replace your player with someone with little-no little contribution and can cost you wins, sometimes the entire season.

The challenges are endless. Many have determined winning Fantasy Sports as luck-driven as a result: picking up a player just as their hitting unexpected form, not having many minimal injuries, having a strong balance of players contributing to all categories. My challenge is to turn “luck” into “systems and processes” and eventually into winnings!

Solution

Data Pull: An API was found that published highly detailed per-game statistics, including player performance for all statistical categories measured in my Fantasy Sports competition, as well as all injuries sustained. It was discovered that only 1 player per page could be pulled into FME so players could be created as features. As a result, a series of attribute creators paired with a date stamper were used to build the URL used for the API call. A cloner was also used to repeat & increase the page number by 1, allowing the entire day of player performances to be pulled into FME. Post-processing includes exposing only the stats measured for my fantasy from the JSON & combining the player's first & last name into one attribute. This record of daily player performances is saved as a CSV file locally, with the file name being a function of its own date. This workspace is scheduled for 5: 45pm every night, right after the last game finishes in the USA.

Fantasy Point Conversion & Injury Report: A second workspace is established (for reasons explained in “Mobile Accessibility”) to turn the daily results into fantasy points. This is a four-step process:

  1. Using attribute creators to multiply each statistical category by the fantasy points it equates to my competition using Attribute Creators.
  2. Ranking this fantasy score using the Rank Calculator against the rest of the players from the day.
  3. Dividing the ranking for each statistical category by the number of categories to give a final “Fantasy Value”.
  4. Rank the Fantasy Value for each player in Ascending order.

Using the same API, the injury report is accessed & pulled into the workspace. The injury date, type and status are exposed so that fantasy managers can see how recent the injury is and if it’s severe enough to replace them.  All injuries are also pulled in so that players on the mend can be detected. This is scheduled for 6pm every night.

Mobile Accessibility: The fantasy analysis & injury report are then pulled into an Emailer transformer so it can be delivered & accessed remotely. Using FME Flow, a Self-Service App is developed to produce any-time analysis of NBA Fantasy. User parameters are put on the CSV reader of the daily reports to allow the user to analyse one or multiple days, and then the emailer to send to whatever email the user has access to. An aggregator has been added to the workspace to handle multi-day analysis.

“This tool has been of great help, both in drafting a high-performing team at the start of the season and managing the team throughout. I have found the most value has come out of the multi-day analysis, where I can see who has done well for a period of time and omit players who have had a one-off game. With some further web development and formatting, this would be a good investment for NBA Fantasy Managers.”

– Michael Studdert, Business Development Consultant, 1Spatial Australia

Download PDF