Open austinegri opened 3 years ago
That's a good idea. Looking at some of the API calls it seems like we are able to get that data. This is the API call for the watson data
https://watsonfantasyfootball.espn.com/espnpartner/dallas/projections/projections_<playerId>_ESPNFantasyFootball_2020.json
So for example if you want to look at the JSON response, this is the GET call for Josh Jacobs https://watsonfantasyfootball.espn.com/espnpartner/dallas/projections/projections_4047365_ESPNFantasyFootball_2020.json
Awesome thank you! I will check it out
How did you determine the request? Do you know how this request changes for PPR, .5PPR, standard leagues?
That's a great question because it doesn't look like there is any distinction between scoring. I will try to look into more as well!
There is also a player endpoint for the watson data and it looks like it gives the overall data from the games. It shows actual points compared to the projections Here is Josh Jacobs player overview: https://watsonfantasyfootball.espn.com/espnpartner/dallas/players/players_4047365_ESPNFantasyFootball_2020.json You can see from the data it has his first game and now second game information.
The distributions are based on PPR scoring formats. Looks like ESPN applies an adjustment for HPPR and Standard leagues. Finally, note that while the output of the above Watson endpoint resp['SCORE_DISTRIBUTION']
will allow you to plot the distribution generated by ESPN/Watson, it will need to be further normalized in order to used for CDF calculations. You can use the below function to do so.
def smooth(arr, precision=100):
""" smooth watson distribution to ensure there is even space between pdf values """
# loop through arr and look for numbers in intervals of 0.25 and take the mean of any points w/in that interval
# ie.
# 14.5, 14.51, 14.52, 14.7, 14.9
# .066 .066 .067 .054 .049
# 14.5 14.75 15.0
# .066 .054 .049
mmin = arr[0][0]
mmax = arr[-1][0]
final = []
for new_x in np.linspace(mmin, mmax, precision):
closest_y_arr = arr[find_nearest_argmin(arr[:, 0], new_x)]
closest_y = closest_y_arr[1]
final.append([new_x, closest_y])
return np.array(final)
I am curious, is it possible to pull the data from ESPN and Watson's partnership? I am most hoping to get the projected points distribution for a player to can calculate Win Probability for a matchup.
I have examined BoxScores and BoxPlayers in the package, but the most granular breakdown I have seen is a singular projected points and projected points breakdown. It would be awesome to view the data behind the distribution for Watson's player projections
For example, the following is the UI rendering of the data I would like to access.
Please let me know if you have any ideas!