cwendt94 / espn-api

ESPN Fantasy API! (Football, Basketball)
MIT License
628 stars 199 forks source link

box_scores : any information on whether a player's score is final? #44

Closed joshbis closed 5 years ago

joshbis commented 5 years ago

Does any part of the box_scores return how many players points are final (e.g., game in progress, final, not started) for a given week?

cwendt94 commented 5 years ago

I haven’t checked this but I would think the box_player projected and actual are the same. But for in progress and not started not at the moment. I can check if that information is part of the API data

joshbis commented 5 years ago

I'm not sure that's right. For a player whose game hasn't started, box_scores[i].home_lineup[j].points = 0 and box_scores[i].home_lineup[j].projected_points = ESPN's projection. After the game, the projected and actual points are different.

Is there a projected points for the matchup overall? In that case, I think you're right that projected and actual are the same once all players' games are final. (At least that's the behavior of the website and app).

cwendt94 commented 5 years ago

For the players that haven’t started I would have to check the API to see if any of the fields indicate this.

So after the players finish their game the projected scores do not update to the actual scores?

joshbis commented 5 years ago

Doesn't look that way. For this week, almost none of the points and projected match.

joshbis commented 5 years ago

fwiw, I pulled them like this -- possibly inefficient but ¯_(ツ)_/¯ :

`box_scores = league.box_scores(week) player = [] position = [] points = [] projected = [] teamname = []

for i in range(0,6):
for j in range(0,len(box_scores[i].home_lineup)): teamname.append(box_scores[i].home_team.team_name) player.append(box_scores[i].home_lineup[j].name) position.append(box_scores[i].home_lineup[j].slot_position) points.append(box_scores[i].home_lineup[j].points) projected.append(box_scores[i].home_lineup[j].projected_points)

for i in range(0,6): for j in range(0,len(box_scores[i].away_lineup)): teamname.append(box_scores[i].away_team.team_name) player.append(box_scores[i].away_lineup[j].name) position.append(box_scores[i].away_lineup[j].slot_position) points.append(box_scores[i].away_lineup[j].points) projected.append(box_scores[i].away_lineup[j].projected_points)`

result: https://www.dropbox.com/s/qp4lwa3xta0rkyu/w2_proj_points.png?dl=0

cwendt94 commented 5 years ago

Interesting, I will take a look at the API and see if I can find any way to tell if a player has played/progress/done.

cwendt94 commented 5 years ago

@joshbis @dtcarls would a Boolean to let you know a player is finished or not be enough for this feature?

joshbis commented 5 years ago

I think so.

I wonder if the same thing would also be useful for each team’s overall score (not sure if this pulled directly or if it is calculated from the individual player scores on each team.)

dtcarls commented 5 years ago

A boolean would certainly be sufficient; however, if the data is available to make it a number 0-100 being percentage of game played that would be even better. Or even making the "boolean" 0 or 100 with the possibility of future implementation.

cwendt94 commented 5 years ago

As of right now I can add 0 or 100 and see if there is a way of getting a percentage of game played. I would have to look at the data during a game and see if I can find that information.

I am also going to be adding the professional team the player is going against and there rank against that position.

Would it make sense for players on bye week that game played would be at 100? I think that would be easiest.

joshbis commented 5 years ago

My guess is minutes left for each player might be hard since it comes from NFL feeds?

On overall league scoreboard, I do think there’s a players left and minutes left. Those could be fun?

cwendt94 commented 5 years ago

Yeah, I believe it’s only in the “fantasy cast” where they show that information. I would have to look during a live game and see if it is possible.

But for right now I can add the 0 or 100 game played value so we can have some information on it.

drippyer commented 5 years ago

Just wanted to add to this that I'm also finding projected scores are set prior to gametime and are fixed at that value throughout the game. This could be useful in determining actual/forecast ratios but doesn't seem to be at all useful in maintaining a live scoreboard.

I'm trying to dig into the API but haven't found anything that would indicate a live projection as of yet.

joshbis commented 5 years ago

fwiw, I don't mind the current behavior. After a particularly terrible week, I was "interested" to see how badly the pre-game projections failed my teams's actual performance.

cwendt94 commented 5 years ago

I haven’t been able to find a way so far to get the projections that are continuously updating. It only shows when your viewing in matchup or fantasy cast and both those do not call ESPN’s API.

cwendt94 commented 5 years ago

For up to date box score projections look at this issue