Skip to content

Statistics

Statistical functionality in Edgework.

Statistics Methods

Fetch skater stats for a report as SkaterStats objects.

Targets the documented /{lang}/skater/{report} route (registry key stats_skater_report); report names are validated against :mod:edgework.stats_reports.

Parameters:

Name Type Description Default
report str

Report name (default "summary").

'summary'
aggregate bool

Whether to aggregate the stats.

False
game bool

Whether to return game-level stats.

True
limit int

Number of results (-1 for all).

-1
start int

Starting index for pagination.

0
sort str

Field to sort by.

'points'
season Optional[int]

Season in YYYYYYYY format; defaults to the current season.

None
game_type Optional[int]

Optional game type (2=regular season, 3=playoffs) appended to the season filter.

None
direction Optional[str]

Optional sort direction ("ASC"/"DESC") for the dir query parameter.

None
cayenne_exp Optional[str]

Raw Cayenne filter expression (escape hatch that overrides the season/game-type expression).

None
fact_cayenne_exp Optional[Union[str, list[str]]]

Optional factCayenneExp query filter.

None
include Optional[Union[str, list[str]]]

Optional include query filter (string or list; a list is sent as repeated query parameters).

None
exclude Optional[Union[str, list[str]]]

Optional exclude query filter (string or list).

None
lang str

Language code for the Stats API request (default "en").

'en'
extra_params Optional[dict[str, Any]]

Raw escape hatch for additional query parameters, merged last.

None

Returns:

Type Description
list[SkaterStats]

List of SkaterStats objects (one per report row).

Fetch goalie stats for a report as GoalieStats objects.

Targets the documented /{lang}/goalie/{report} route (registry key stats_goalie_report); report names are validated against :mod:edgework.stats_reports.

Parameters:

Name Type Description Default
season Optional[int]

Season in YYYYYYYY format; defaults to the current season.

None
report str

Report name (default "summary").

'summary'
aggregate bool

Whether to aggregate the stats.

False
game bool

Whether to return game-level stats.

True
limit int

Number of results (-1 for all).

-1
start int

Starting index for pagination.

0
sort str

Field to sort by (default "wins").

'wins'
game_type Optional[int]

Optional game type (2=regular season, 3=playoffs) appended to the season filter.

None
direction Optional[str]

Optional sort direction ("ASC"/"DESC") for the dir query parameter.

None
cayenne_exp Optional[str]

Raw Cayenne filter expression (escape hatch that overrides the season/game-type expression).

None
fact_cayenne_exp Optional[Union[str, list[str]]]

Optional factCayenneExp query filter.

None
include Optional[Union[str, list[str]]]

Optional include query filter (string or list).

None
exclude Optional[Union[str, list[str]]]

Optional exclude query filter (string or list).

None
lang str

Language code for the Stats API request (default "en").

'en'
extra_params Optional[dict[str, Any]]

Raw escape hatch for additional query parameters, merged last.

None

Returns:

Type Description
list[GoalieStats]

List of GoalieStats objects (one per report row).

Fetch team stats for a report as TeamStats objects.

Targets the documented /{lang}/team/{report} route (registry key stats_team_report); report names are validated against :mod:edgework.stats_reports.

Parameters:

Name Type Description Default
season Optional[int]

Season in YYYYYYYY format; defaults to the current season.

None
report str

Report name (default "summary").

'summary'
aggregate bool

Whether to aggregate the stats.

False
game bool

Whether to return game-level stats.

True
limit int

Number of results (-1 for all).

-1
start int

Starting index for pagination.

0
sort str

Field to sort by (default "wins").

'wins'
game_type Optional[int]

Optional game type (2=regular season, 3=playoffs) appended to the season filter.

None
direction Optional[str]

Optional sort direction ("ASC"/"DESC") for the dir query parameter.

None
cayenne_exp Optional[str]

Raw Cayenne filter expression (escape hatch that overrides the season/game-type expression).

None
fact_cayenne_exp Optional[Union[str, list[str]]]

Optional factCayenneExp query filter.

None
include Optional[Union[str, list[str]]]

Optional include query filter (string or list).

None
exclude Optional[Union[str, list[str]]]

Optional exclude query filter (string or list).

None
lang str

Language code for the Stats API request (default "en").

'en'
extra_params Optional[dict[str, Any]]

Raw escape hatch for additional query parameters, merged last.

None

Returns:

Type Description
list[TeamStats]

List of TeamStats objects (one per report row).

Skater Statistics Model

edgework.models.stats.SkaterStats(edgework_client, obj_id=None, **kwargs)

Bases: BaseNHLModel

SkaterStats model to store skater statistics.

Initialize a SkaterStats object with dynamic attributes.

fetch_data(report='summary', season=None, aggregate=False, game=True, limit=-1, start=0, sort='points', direction='DESC', game_type=None)

Fetch the data for the skater stats.

Parameters:

Name Type Description Default
report str

The type of report to get (e.g. "summary", "bios", etc.)

'summary'
season int

The season to get stats for (e.g. 20232024)

None
aggregate bool

Whether to aggregate the stats

False
game bool

Whether to get game stats

True
limit int

Number of results to return (-1 for all)

-1
start int

Starting index for results

0
sort str | list[str]

Field to sort by

'points'
direction str | list[str]

Direction to sort (e.g. "DESC", "ASC")

'DESC'
game_type int

Type of game (e.g. 2 for regular season, 3 for playoffs)

None

Goalie Statistics Model

edgework.models.stats.GoalieStats(edgework_client, obj_id=None, **kwargs)

Bases: BaseNHLModel

GoalieStats model to store goalie statistics.

Initialize a GoalieStats object with dynamic attributes.

fetch_data(report='summary', season=None, aggregate=False, game=True, limit=-1, start=0, sort='wins', direction='DESC', game_type=None)

Fetch the data for the goalie stats.

Parameters:

Name Type Description Default
report str

The type of report to get (e.g. "summary", "advanced", etc.)

'summary'
season int

The season to get stats for (e.g. 20232024)

None
aggregate bool

Whether to aggregate the stats

False
game bool

Whether to get game stats

True
limit int

Number of results to return (-1 for all)

-1
start int

Starting index for results

0
sort str | list[str]

Field to sort by

'wins'
direction str | list[str]

Direction to sort (e.g. "DESC", "ASC")

'DESC'
game_type int | None

Type of game (e.g. 2 for regular season, 3 for playoffs)

None

Team Statistics Model

edgework.models.stats.TeamStats(edgework_client, obj_id=None, **kwargs)

Bases: BaseNHLModel

Team Stats model to store team statistics for a season.

Initialize a TeamStats object with dynamic attributes.

fetch_data(report='summary', season=None, aggregate=False, game=True, limit=-1, start=0, sort='wins', direction='DESC', game_type=2)

Fetch the data for the team stats.

Parameters:

Name Type Description Default
report str

The type of report to get (e.g. "summary", "faceoffpercentages", etc.)

'summary'
season int

The season to get stats for (e.g. 20232024)

None
aggregate bool

Whether to aggregate the stats

False
game bool

Whether to get game stats. If False, returns aggregate stats.

True
limit int

Number of results to return (-1 for all). Default is -1.

-1
start int

Starting index for results. Default is 0.

0
sort str

Field to sort by. Can be a string (e.g. "points") or a list of dicts for multiple fields. Default is "wins".

'wins'
direction str

Direction to sort (e.g. "DESC", "ASC"). Default is "DESC".

'DESC'
game_type int

Type of game (e.g. 2 for regular season, 3 for playoffs). Default is 2.

2

Statistics Client

edgework.clients.stats_client.StatsClient(client)

Client for the documented Stats API resources, reports and leaders.

Initialize the stats client.

Parameters:

Name Type Description Default
client HttpClient

HTTP client instance for making API requests.

required

get_skaters_stats(report='summary', aggregate=False, game=True, limit=-1, start=0, sort='points', season=None, game_type=None, direction=None, cayenne_exp=None, fact_cayenne_exp=None, include=None, exclude=None, lang='en', extra_params=None, **kwargs)

Fetch skater stats for a report as SkaterStats objects.

Targets the documented /{lang}/skater/{report} route (registry key stats_skater_report); report names are validated against :mod:edgework.stats_reports.

Parameters:

Name Type Description Default
report str

Report name (default "summary").

'summary'
aggregate bool

Whether to aggregate the stats.

False
game bool

Whether to return game-level stats.

True
limit int

Number of results (-1 for all).

-1
start int

Starting index for pagination.

0
sort str

Field to sort by.

'points'
season Optional[int]

Season in YYYYYYYY format; defaults to the current season.

None
game_type Optional[int]

Optional game type (2=regular season, 3=playoffs) appended to the season filter.

None
direction Optional[str]

Optional sort direction ("ASC"/"DESC") for the dir query parameter.

None
cayenne_exp Optional[str]

Raw Cayenne filter expression (escape hatch that overrides the season/game-type expression).

None
fact_cayenne_exp Optional[Union[str, list[str]]]

Optional factCayenneExp query filter.

None
include Optional[Union[str, list[str]]]

Optional include query filter (string or list; a list is sent as repeated query parameters).

None
exclude Optional[Union[str, list[str]]]

Optional exclude query filter (string or list).

None
lang str

Language code for the Stats API request (default "en").

'en'
extra_params Optional[dict[str, Any]]

Raw escape hatch for additional query parameters, merged last.

None

Returns:

Type Description
list[SkaterStats]

List of SkaterStats objects (one per report row).

get_goalies_stats(season=None, report='summary', aggregate=False, game=True, limit=-1, start=0, sort='wins', game_type=None, direction=None, cayenne_exp=None, fact_cayenne_exp=None, include=None, exclude=None, lang='en', extra_params=None, **kwargs)

Fetch goalie stats for a report as GoalieStats objects.

Targets the documented /{lang}/goalie/{report} route (registry key stats_goalie_report); report names are validated against :mod:edgework.stats_reports.

Parameters:

Name Type Description Default
season Optional[int]

Season in YYYYYYYY format; defaults to the current season.

None
report str

Report name (default "summary").

'summary'
aggregate bool

Whether to aggregate the stats.

False
game bool

Whether to return game-level stats.

True
limit int

Number of results (-1 for all).

-1
start int

Starting index for pagination.

0
sort str

Field to sort by (default "wins").

'wins'
game_type Optional[int]

Optional game type (2=regular season, 3=playoffs) appended to the season filter.

None
direction Optional[str]

Optional sort direction ("ASC"/"DESC") for the dir query parameter.

None
cayenne_exp Optional[str]

Raw Cayenne filter expression (escape hatch that overrides the season/game-type expression).

None
fact_cayenne_exp Optional[Union[str, list[str]]]

Optional factCayenneExp query filter.

None
include Optional[Union[str, list[str]]]

Optional include query filter (string or list).

None
exclude Optional[Union[str, list[str]]]

Optional exclude query filter (string or list).

None
lang str

Language code for the Stats API request (default "en").

'en'
extra_params Optional[dict[str, Any]]

Raw escape hatch for additional query parameters, merged last.

None

Returns:

Type Description
list[GoalieStats]

List of GoalieStats objects (one per report row).

get_team_stats(season=None, report='summary', aggregate=False, game=True, limit=-1, start=0, sort='wins', game_type=None, direction=None, cayenne_exp=None, fact_cayenne_exp=None, include=None, exclude=None, lang='en', extra_params=None, **kwargs)

Fetch team stats for a report as TeamStats objects.

Targets the documented /{lang}/team/{report} route (registry key stats_team_report); report names are validated against :mod:edgework.stats_reports.

Parameters:

Name Type Description Default
season Optional[int]

Season in YYYYYYYY format; defaults to the current season.

None
report str

Report name (default "summary").

'summary'
aggregate bool

Whether to aggregate the stats.

False
game bool

Whether to return game-level stats.

True
limit int

Number of results (-1 for all).

-1
start int

Starting index for pagination.

0
sort str

Field to sort by (default "wins").

'wins'
game_type Optional[int]

Optional game type (2=regular season, 3=playoffs) appended to the season filter.

None
direction Optional[str]

Optional sort direction ("ASC"/"DESC") for the dir query parameter.

None
cayenne_exp Optional[str]

Raw Cayenne filter expression (escape hatch that overrides the season/game-type expression).

None
fact_cayenne_exp Optional[Union[str, list[str]]]

Optional factCayenneExp query filter.

None
include Optional[Union[str, list[str]]]

Optional include query filter (string or list).

None
exclude Optional[Union[str, list[str]]]

Optional exclude query filter (string or list).

None
lang str

Language code for the Stats API request (default "en").

'en'
extra_params Optional[dict[str, Any]]

Raw escape hatch for additional query parameters, merged last.

None

Returns:

Type Description
list[TeamStats]

List of TeamStats objects (one per report row).

get_players(limit=None, start=None, lang='en', extra_params=None)

Fetch player information (documented truncated list with a total).

Targets the documented /{lang}/players route (registry key stats_players).

Parameters:

Name Type Description Default
limit Optional[int]

Optional pagination limit (only sent when provided).

None
start Optional[int]

Optional pagination start (only sent when provided).

None
lang str

Language code for the Stats API request (default "en").

'en'
extra_params Optional[dict[str, Any]]

Raw escape hatch for additional query parameters.

None

Returns:

Type Description
Union[dict[str, Any], list[Any]]

Raw JSON payload (dict or list).

get_skaters(lang='en', extra_params=None)

Fetch skater information.

Targets the documented /{lang}/skater route (registry key stats_skater). This is the skater listing; report-based stats live in :meth:get_skaters_stats.

Parameters:

Name Type Description Default
lang str

Language code for the Stats API request (default "en").

'en'
extra_params Optional[dict[str, Any]]

Raw escape hatch for additional query parameters.

None

Returns:

Type Description
Union[dict[str, Any], list[Any]]

Raw JSON payload (dict or list).

get_skater_leaders(attribute, lang='en', extra_params=None)

Fetch Stats API skater leaders for an attribute.

Targets the documented /{lang}/leaders/skaters/{attribute} route (registry key stats_skater_leaders). This is the Stats API leaders listing; the separate Web API leaderboards are served by :meth:get_skater_stats_leaders.

Parameters:

Name Type Description Default
attribute str

Leaderboard attribute (e.g. "points").

required
lang str

Language code for the Stats API request (default "en").

'en'
extra_params Optional[dict[str, Any]]

Raw escape hatch for additional query parameters.

None

Returns:

Type Description
Union[dict[str, Any], list[Any]]

Raw JSON payload (dict or list).

get_skater_milestones(lang='en', extra_params=None)

Fetch skater milestones.

Targets the documented /{lang}/milestones/skaters route (registry key stats_skater_milestones).

Parameters:

Name Type Description Default
lang str

Language code for the Stats API request (default "en").

'en'
extra_params Optional[dict[str, Any]]

Raw escape hatch for additional query parameters.

None

Returns:

Type Description
Union[dict[str, Any], list[Any]]

Raw JSON payload (dict or list).

get_goalie_leaders(attribute, lang='en', extra_params=None)

Fetch Stats API goalie leaders for an attribute.

Targets the documented /{lang}/leaders/goalies/{attribute} route (registry key stats_goalie_leaders).

Parameters:

Name Type Description Default
attribute str

Leaderboard attribute (e.g. "gaa").

required
lang str

Language code for the Stats API request (default "en").

'en'
extra_params Optional[dict[str, Any]]

Raw escape hatch for additional query parameters.

None

Returns:

Type Description
Union[dict[str, Any], list[Any]]

Raw JSON payload (dict or list).

get_goalie_milestones(lang='en', extra_params=None)

Fetch goalie milestones.

Targets the documented /{lang}/milestones/goalies route (registry key stats_goalie_milestones).

Parameters:

Name Type Description Default
lang str

Language code for the Stats API request (default "en").

'en'
extra_params Optional[dict[str, Any]]

Raw escape hatch for additional query parameters.

None

Returns:

Type Description
Union[dict[str, Any], list[Any]]

Raw JSON payload (dict or list).

get_draft(lang='en', extra_params=None)

Fetch draft information.

Targets the documented /{lang}/draft route (registry key stats_draft). Web API draft rankings/picks live in :class:~edgework.clients.draft_client.DraftClient.

Parameters:

Name Type Description Default
lang str

Language code for the Stats API request (default "en").

'en'
extra_params Optional[dict[str, Any]]

Raw escape hatch for additional query parameters.

None

Returns:

Type Description
Union[dict[str, Any], list[Any]]

Raw JSON payload (dict or list).

get_franchises(lang='en', extra_params=None)

Fetch the list of all franchises.

Targets the documented /{lang}/franchise route (registry key stats_franchise).

Parameters:

Name Type Description Default
lang str

Language code for the Stats API request (default "en").

'en'
extra_params Optional[dict[str, Any]]

Raw escape hatch for additional query parameters.

None

Returns:

Type Description
Union[dict[str, Any], list[Any]]

Raw JSON payload (dict or list).

get_component_seasons(lang='en', extra_params=None)

Fetch component season information.

Targets the documented /{lang}/componentSeason route (registry key stats_component_season).

Parameters:

Name Type Description Default
lang str

Language code for the Stats API request (default "en").

'en'
extra_params Optional[dict[str, Any]]

Raw escape hatch for additional query parameters.

None

Returns:

Type Description
Union[dict[str, Any], list[Any]]

Raw JSON payload (dict or list).

get_seasons(lang='en', extra_params=None)

Fetch season information.

Targets the documented /{lang}/season Stats API route (registry key stats_season). Note this is distinct from the Web API /v1/season route served by :meth:edgework.clients.utility_client.UtilityClient.get_season.

Parameters:

Name Type Description Default
lang str

Language code for the Stats API request (default "en").

'en'
extra_params Optional[dict[str, Any]]

Raw escape hatch for additional query parameters.

None

Returns:

Type Description
Union[dict[str, Any], list[Any]]

Raw JSON payload (dict or list).

get_games(lang='en', extra_params=None)

Fetch game information.

Targets the documented /{lang}/game route (registry key stats_game).

Parameters:

Name Type Description Default
lang str

Language code for the Stats API request (default "en").

'en'
extra_params Optional[dict[str, Any]]

Raw escape hatch for additional query parameters.

None

Returns:

Type Description
Union[dict[str, Any], list[Any]]

Raw JSON payload (dict or list).

get_game_meta(lang='en', extra_params=None)

Fetch game metadata.

Targets the documented /{lang}/game/meta route (registry key stats_game_meta).

Parameters:

Name Type Description Default
lang str

Language code for the Stats API request (default "en").

'en'
extra_params Optional[dict[str, Any]]

Raw escape hatch for additional query parameters.

None

Returns:

Type Description
Union[dict[str, Any], list[Any]]

Raw JSON payload (dict or list).

get_config(lang='en', extra_params=None)

Fetch configuration information.

Targets the documented /{lang}/config route (registry key stats_config). Note: edgework.models.config.Config fetches the same route lazily (see Task 5).

Parameters:

Name Type Description Default
lang str

Language code for the Stats API request (default "en").

'en'
extra_params Optional[dict[str, Any]]

Raw escape hatch for additional query parameters.

None

Returns:

Type Description
Union[dict[str, Any], list[Any]]

Raw JSON payload (dict or list).

get_countries(lang='en', extra_params=None)

Fetch country information (countries with a hockey presence).

Targets the documented /{lang}/country route (registry key stats_country).

Parameters:

Name Type Description Default
lang str

Language code for the Stats API request (default "en").

'en'
extra_params Optional[dict[str, Any]]

Raw escape hatch for additional query parameters.

None

Returns:

Type Description
Union[dict[str, Any], list[Any]]

Raw JSON payload (dict or list).

get_content_module(template_key, lang='en', extra_params=None)

Fetch content module information for a template.

Targets the documented /{lang}/content/module/{templateKey} route (registry key stats_content_module).

Parameters:

Name Type Description Default
template_key str

Content module template key/name.

required
lang str

Language code for the Stats API request (default "en").

'en'
extra_params Optional[dict[str, Any]]

Raw escape hatch for additional query parameters.

None

Returns:

Type Description
Union[dict[str, Any], list[Any]]

Raw JSON payload (dict or list).

ping()

Ping the Stats API server to check connectivity.

Targets the documented root /ping route (registry key stats_ping), which — unlike the other Stats API routes — is not language-prefixed.

Returns:

Type Description
Union[dict[str, Any], list[Any]]

Raw JSON payload (dict or list).

get_skater_stats_leaders(categories=None, limit=None, game_type=None)

Fetch current skater statistics leaders (Web API).

Targets the documented /v1/skater-stats-leaders/current route (registry key skater_stats_now). This is the Web API leaderboard; the Stats API /{lang}/leaders/skaters/{attribute} listing is served by :meth:get_skater_leaders.

Parameters:

Name Type Description Default
categories Optional[Union[str, list[str]]]

Single category ("goals") or list of categories (["goals", "assists"], joined with commas). Omitted when None.

None
limit Optional[int]

Positive result-count limit. Omitted when None.

None
game_type Optional[int]

Deprecated / unused. The /current route has no game-type segment; the argument is accepted for backward compatibility and ignored (raises DeprecationWarning). Use :meth:get_skater_stats_leaders_by_season for season/game-type leaderboards.

None

Returns:

Type Description
dict[str, Any]

Dictionary with current skater leaders.

get_goalie_stats_leaders(categories=None, limit=None, game_type=None)

Fetch current goalie statistics leaders (Web API).

Targets the documented /v1/goalie-stats-leaders/current route (registry key goalie_stats_now).

Parameters:

Name Type Description Default
categories Optional[Union[str, list[str]]]

Single category ("wins") or list of categories. Omitted when None.

None
limit Optional[int]

Positive result-count limit. Omitted when None.

None
game_type Optional[int]

Deprecated / unused. The /current route has no game-type segment; the argument is accepted for backward compatibility and ignored (raises DeprecationWarning).

None

Returns:

Type Description
dict[str, Any]

Dictionary with current goalie leaders.

get_skater_stats_leaders_by_season(season, game_type=2, categories=None, limit=None)

Fetch skater statistics leaders for a season and game type.

Targets the documented /v1/skater-stats-leaders/{season}/{game-type} route (registry key skater_stats_season_game_type).

Parameters:

Name Type Description Default
season str

Season in format "YYYY-YYYY" (e.g., "2023-2024").

required
game_type int

Game type ID (2=Regular Season, 3=Playoffs).

2
categories Optional[Union[str, list[str]]]

Single category or list of categories (joined with commas). Omitted when None.

None
limit Optional[int]

Positive result-count limit. Omitted when None.

None

Returns:

Type Description
dict[str, Any]

Dictionary with skater leaders for the specified season.

Raises:

Type Description
ValueError

If the season format is invalid.

get_goalie_stats_leaders_by_season(season, game_type=2, categories=None, limit=None)

Fetch goalie statistics leaders for a season and game type.

Targets the documented /v1/goalie-stats-leaders/{season}/{game-type} route (registry key goalie_stats_season_game_type).

Parameters:

Name Type Description Default
season str

Season in format "YYYY-YYYY" (e.g., "2023-2024").

required
game_type int

Game type ID (2=Regular Season, 3=Playoffs).

2
categories Optional[Union[str, list[str]]]

Single category or list of categories (joined with commas). Omitted when None.

None
limit Optional[int]

Positive result-count limit. Omitted when None.

None

Returns:

Type Description
dict[str, Any]

Dictionary with goalie leaders for the specified season.

Raises:

Type Description
ValueError

If the season format is invalid.

Skater Statistics

edgework.models.stats.SkaterStats(edgework_client, obj_id=None, **kwargs)

Bases: BaseNHLModel

SkaterStats model to store skater statistics.

Initialize a SkaterStats object with dynamic attributes.

fetch_data(report='summary', season=None, aggregate=False, game=True, limit=-1, start=0, sort='points', direction='DESC', game_type=None)

Fetch the data for the skater stats.

Parameters:

Name Type Description Default
report str

The type of report to get (e.g. "summary", "bios", etc.)

'summary'
season int

The season to get stats for (e.g. 20232024)

None
aggregate bool

Whether to aggregate the stats

False
game bool

Whether to get game stats

True
limit int

Number of results to return (-1 for all)

-1
start int

Starting index for results

0
sort str | list[str]

Field to sort by

'points'
direction str | list[str]

Direction to sort (e.g. "DESC", "ASC")

'DESC'
game_type int

Type of game (e.g. 2 for regular season, 3 for playoffs)

None

Goalie Statistics

edgework.models.stats.GoalieStats(edgework_client, obj_id=None, **kwargs)

Bases: BaseNHLModel

GoalieStats model to store goalie statistics.

Initialize a GoalieStats object with dynamic attributes.

fetch_data(report='summary', season=None, aggregate=False, game=True, limit=-1, start=0, sort='wins', direction='DESC', game_type=None)

Fetch the data for the goalie stats.

Parameters:

Name Type Description Default
report str

The type of report to get (e.g. "summary", "advanced", etc.)

'summary'
season int

The season to get stats for (e.g. 20232024)

None
aggregate bool

Whether to aggregate the stats

False
game bool

Whether to get game stats

True
limit int

Number of results to return (-1 for all)

-1
start int

Starting index for results

0
sort str | list[str]

Field to sort by

'wins'
direction str | list[str]

Direction to sort (e.g. "DESC", "ASC")

'DESC'
game_type int | None

Type of game (e.g. 2 for regular season, 3 for playoffs)

None

Team Statistics

edgework.models.stats.TeamStats(edgework_client, obj_id=None, **kwargs)

Bases: BaseNHLModel

Team Stats model to store team statistics for a season.

Initialize a TeamStats object with dynamic attributes.

fetch_data(report='summary', season=None, aggregate=False, game=True, limit=-1, start=0, sort='wins', direction='DESC', game_type=2)

Fetch the data for the team stats.

Parameters:

Name Type Description Default
report str

The type of report to get (e.g. "summary", "faceoffpercentages", etc.)

'summary'
season int

The season to get stats for (e.g. 20232024)

None
aggregate bool

Whether to aggregate the stats

False
game bool

Whether to get game stats. If False, returns aggregate stats.

True
limit int

Number of results to return (-1 for all). Default is -1.

-1
start int

Starting index for results. Default is 0.

0
sort str

Field to sort by. Can be a string (e.g. "points") or a list of dicts for multiple fields. Default is "wins".

'wins'
direction str

Direction to sort (e.g. "DESC", "ASC"). Default is "DESC".

'DESC'
game_type int

Type of game (e.g. 2 for regular season, 3 for playoffs). Default is 2.

2

Usage Examples

Skater Statistics

from edgework import Edgework

client = Edgework()

# Get top point scorers
top_scorers = client.skater_stats(
    season="2023-2024",
    sort="points",
    direction="DESC",
    limit=10
)

print("Top 10 Point Scorers:")
for i, player in enumerate(top_scorers, 1):
    print(f"{i}. {player.name}: {player.points} points ({player.goals}G, {player.assists}A)")

Advanced Skater Stats

# Get assists leaders
assist_leaders = client.skater_stats(
    season="2023-2024",
    sort="assists",
    limit=10
)

# Get goal scorers
goal_leaders = client.skater_stats(
    season="2023-2024",
    sort="goals",
    limit=10
)

# Get plus/minus leaders
plus_minus_leaders = client.skater_stats(
    season="2023-2024",
    sort="plusMinus",
    limit=10
)

Goalie Statistics

# Get top goalies by wins
top_goalies = client.goalie_stats(
    season="2023-2024",
    sort="wins",
    limit=10
)

print("Top 10 Goalies by Wins:")
for i, goalie in enumerate(top_goalies, 1):
    print(f"{i}. {goalie.name}: {goalie.wins} wins")
    print(f"   GAA: {goalie.goals_against_average:.2f}, SV%: {goalie.save_percentage:.3f}")

Team Statistics

# Get team standings
team_standings = client.team_stats(
    season="2023-2024",
    sort="points",
    limit=32  # All NHL teams
)

print("NHL Standings:")
for i, team in enumerate(team_standings, 1):
    print(f"{i}. {team.team_name}: {team.points} points ({team.wins}-{team.losses}-{team.ot_losses})")

Statistical Categories

Skater Stats

  • Scoring: Goals, Assists, Points
  • Shooting: Shots, Shooting Percentage
  • Time: Games Played, Time on Ice
  • Advanced: Plus/Minus, Penalty Minutes, Power Play Points, Short Handed Points
  • Faceoffs: Faceoff Wins, Faceoff Win Percentage
  • Hits: Hits, Blocked Shots

Goalie Stats

  • Record: Wins, Losses, Overtime Losses
  • Save Stats: Saves, Save Percentage
  • Goals: Goals Against, Goals Against Average
  • Shutouts: Shutout wins
  • Time: Games Played, Time on Ice

Team Stats

  • Record: Wins, Losses, Overtime Losses, Points
  • Scoring: Goals For, Goals Against, Goal Differential
  • Special Teams: Power Play %, Penalty Kill %
  • Shot Stats: Shots For, Shots Against
  • Discipline: Penalty Minutes

Sorting and Filtering

Multiple Sort Criteria

# Sort by multiple criteria (if supported by API)
stats = client.skater_stats(
    season="2023-2024",
    sort=["points", "goals"],
    direction=["DESC", "DESC"],
    limit=20
)

Different Report Types

# Summary report (default)
summary_stats = client.skater_stats(
    season="2023-2024",
    report="summary"
)

# Advanced stats (if available)
advanced_stats = client.skater_stats(
    season="2023-2024",
    report="advanced"
)

Game Type Filtering

# Regular season stats (default)
regular_season = client.skater_stats(
    season="2023-2024",
    game_type=2
)

# Playoff stats
playoff_stats = client.skater_stats(
    season="2023-2024",
    game_type=3
)

Advanced Usage

Statistical Analysis

from edgework import Edgework

client = Edgework()

# Get comprehensive stats
all_skaters = client.skater_stats(
    season="2023-2024",
    limit=100
)

# Calculate team-based statistics
team_scoring = {}
for player in all_skaters:
    team = player.team_abbrev
    if team not in team_scoring:
        team_scoring[team] = {'goals': 0, 'assists': 0, 'points': 0, 'players': 0}

    team_scoring[team]['goals'] += player.goals
    team_scoring[team]['assists'] += player.assists
    team_scoring[team]['points'] += player.points
    team_scoring[team]['players'] += 1

# Display team offensive statistics
for team, stats in sorted(team_scoring.items(), key=lambda x: x[1]['points'], reverse=True):
    avg_points = stats['points'] / stats['players']
    print(f"{team}: {stats['points']} total points, {avg_points:.1f} avg per player")

Comparative Analysis

# Compare current season to previous season
current_season = client.skater_stats(season="2023-2024", limit=50)
previous_season = client.skater_stats(season="2022-2023", limit=50)

# Find players in both seasons
current_players = {p.player_id: p for p in current_season}
previous_players = {p.player_id: p for p in previous_season}

print("Players with improved scoring:")
for player_id in current_players:
    if player_id in previous_players:
        current = current_players[player_id]
        previous = previous_players[player_id]

        if current.points > previous.points:
            improvement = current.points - previous.points
            print(f"{current.name}: +{improvement} points ({previous.points} → {current.points})")

Custom Statistics

# Calculate custom metrics
def calculate_efficiency_rating(player):
    """Calculate a custom efficiency rating."""
    if player.games_played == 0:
        return 0

    points_per_game = player.points / player.games_played
    shot_efficiency = player.goals / player.shots if player.shots > 0 else 0

    return (points_per_game * 10) + (shot_efficiency * 100)

# Apply to all players
stats = client.skater_stats(season="2023-2024", limit=100)
efficient_players = []

for player in stats:
    efficiency = calculate_efficiency_rating(player)
    efficient_players.append((player, efficiency))

# Sort by efficiency
efficient_players.sort(key=lambda x: x[1], reverse=True)

print("Most Efficient Players:")
for i, (player, efficiency) in enumerate(efficient_players[:10], 1):
    print(f"{i}. {player.name}: {efficiency:.2f} efficiency rating")