Aggregated Statistics Queries
Hudl Statsbomb provides a set of statistics about each match that can be queried at any time split by player and team.
Player statistics
View statistics over a players history such as passes attempted and pass success ratio.
query PlayerStats {
live_player_match_aggregated_stat(where: {match_id: {_eq: 117974}}) {
stat_name
match_id
player_id
team_id
value
}
}
stat_name
describes the statistic
value
is the sum or ratio for the player for the statistic
{
"data": {
"live_player_match_aggregated_stat": [
{
"stat_name": "passes-attempted",
"match_id": 117974,
"player_id": 27559,
"team_id": 212,
"value": 18
},
{
"stat_name": "pass-success-ratio",
"match_id": 117974,
"player_id": 27559,
"team_id": 212,
"value": 0.896551724137931
}
]
}
}
In this example player 27559 has completed 18 passes and their pass success ratio is 90% (rounded up).
It's also possible to filter for specific players and stats. For example, if you wanted to know the number of goals scored by a player:
Goals Scored by Player
query GoalsForPlayer {
live_player_match_aggregated_stat(
where: {match_id: {_eq: 102855},
player_id: {_eq: 29724},
stat_name: {_eq: "goals"}})
{
stat_name
match_id
player_id
team_id
value
}
}
Team statistics
query TeamStats {
live_team_match_aggregated_stat(
where: {match_id: {_eq: 102855}})
{
stat_name
team_id
match_id
value
}
}
stat_name
describes the statistic
value
is the sum or ratio for the team for the statistic
{
"data": {
"live_team_match_aggregated_stat": [
{
"stat_name": "possession",
"team_id": 133,
"match_id": 102855,
"value": 0.784455958549223
},
{
"stat_name": "possession",
"team_id": 131,
"match_id": 102855,
"value": 0.215544041450777
}
]
}
}
In this example team 133 has had 78% possession and team 131 has had 22% possession.
Goals Per Team
Discover the total number of goals scored per team by specifying the stat_name
with a value equal to "goals"
query GoalsPerTeam {
live_team_match_aggregated_stat(
where: {match_id: {_eq: 117972},
stat_name: {_eq: "goals"}})
{
stat_name
team_id
match_id
value
}
}