Tank01 NFL Live In-Game Real Time Statistics NFL

FREEMIUM
Verified
By tank01 | Updated 3 days ago | Sports
Popularity

9.8 / 10

Latency

376ms

Service Level

100%

Health Check

N/A

Back to All Tutorials (1)

Typical flow for grabbing live stats

The Tank01 APIs were originally built to support developers who wanted to build real time fantasy sports apps without having to spend a crazy monthly fee to the major stats providers. Those providers will charge about $2,000 per month for live stats. Most of our users are fine with the $25/month plan, and they see similar value.

Over the past few years, users have suggested extra features and asked us to support various other use cases. But providing real-time, in-game, stats is our bread and butter.

The Tank01 creators have built various personal hobbyist type fantasy sites for our friends and families based off of the Tank01 APIs. The following flow/architecture design is essentially how all of our sites run, and this is our suggested flow to follow.

First off, the flow isn’t possible without your system knowing what games are being played every day, and the times that they start.

Schedules are updated between 6-7am Eastern daily, so the best practice is to call for daily schedules every morning at 7am EST. This one call will give you a list of all games played for the day and their gameID’s.

Once you get the gameIDs, you should call for “general game info” for each game you want. This will give you a lot of information regarding that game but the important information for this flow will be the gameTime or gameTime_epoch. Times are always in Eastern time zone, but we also provide a gameTime_epoch element, which is in epoch time, so you don’t have to worry about time zone conversion.

Once game time hits, start calling the box score API for live stats. The box score API will return a “no game” error until the game actually starts. Keep in mind that NFL games typically start right on time, but nationally televised games typically don’t start until 5-10 minutes after the official start time. So, if you don’t see any data coming back for a specific game right away, don’t worry, it will start populating for you.

Each playerStats element in the box score will refer to “playerID” elements. To connect a playerID with all of his metadata, you’ll want an updated copy of the roster. There are various ways and endpoints to retrieve rosters, depending on your need. Please check out the examples and spotlights for more specific info on that. On the back end, our rosters are updated hourly. At most, you should call for rosters once an hour. Store them locally so you don’t have to keep making calls.

How often you call the API for live stats will depend on your application need. Do you need all games to be updated immediately? If so, then the MEGA plan (500k hits per day) is appropriate for you. Can you live with grabbing updates for every game only every 15 seconds or even less than that? Then you can most likely be ok with the ULTRA plan (15k hits per day). Are you running an extremely niche site or app that only cares about one team or doesn’t need updates as they happen? If so, then you probably will be fine with the PRO plan (1k hits per day). We can also create custom plans and custom endpoints by request if what we have doesn’t specifically fit your needs.

You can tell when the game is over when the “gameStatus” field in the box score says “Completed”, “Postponed”, or “Suspended”.

Feel free to email us at support@tank01.com with suggestions or requests. Thanks!