NBA.Stats.LeagueLeaders (nba_api_ex v0.1.0)

View Source

Fetches all-time leaders data for NBA players.

Summary

Functions

get(params \\ [LeagueID: "00", PerMode: "Totals", StatCategory: "PTS", Season: "All Time", SeasonType: "Regular Season", Scope: "S", ActiveFlag: "No"], opts \\ [])

(since 0.1.0)

Fetches league leaders data.

Parameters

  • params: Optional parameters for the request (e.g., PlayerID, Season).
    • LeagueID: The league ID.
      • Type(s): String
      • Default: "00" (NBA)
      • Example: LeagueID: "10"
      • Valueset:
        • "00" (NBA)
        • "01" (ABA)
        • "10" (WNBA)
        • "20" (G-League)
    • PerMode: The mode for per-game stats (e.g., "PerGame", "Totals").
      • Type(s): String
      • Default: "Totals"
      • Example: PerMode: "PerGame"
      • Valueset:
        • "Totals" (Total stats)
        • "PerGame" (Per game stats)
        • "Per48" (Per 48 minutes stats)
        • "Per100Possessions" (Per 100 possessions stats)
        • "Per40Minutes" (Per 40 minutes stats)
        • "Per36Minutes" (Per 36 minutes stats)
        • "PerMinute" (Per minute stats)
        • "PerPossession" (Per possession stats)
    • StatCategory: The category of stats to filter by (e.g., "PTS", "REB").
      • Type(s): String
      • Default: "PTS" (Points)
      • Example: StatCategory: "REB" (Rebounds)
      • Valueset:
        • "PTS" (Points)
        • "REB" (Rebounds)
        • "AST" (Assists)
        • "STL" (Steals)
        • "BLK" (Blocks)
        • "TO" (Turnovers)
        • "FGM" (Field Goals Made)
        • "FGA" (Field Goals Attempted)
        • "FG_PCT" (Field Goal Percentage)
        • ... and more.
    • Season: The season to filter the data by (e.g., "2022-23").
      • Type(s): String
      • Default: "All Time" (for all-time leaders)
      • Example: Season: "2022-23"
      • Valueset:
        • "All Time" (for all-time leaders)
        • Specific seasons (e.g, "2024-25").
    • SeasonType: The type of season (e.g., "Regular Season", "Playoffs").
      • Type(s): String
      • Default: "Regular Season"
      • Example: SeasonType: "Playoffs"
      • Valueset:
        • "Regular Season" (Regular season stats)
        • "Playoffs" (Playoff stats)
    • Scope: The scope of the data (e.g., "All", "Home", "Away").
      • Type(s): String
      • Default: "S" (for all players)
      • Example: Scope: "Rookies"
      • Valueset:
        • "S" (all players)
        • "Rookies"
        • "RS"
    • ActiveFlag: A flag to indicate if only active players should be included.
      • Type(s): String
      • Default: "No" (include all players)
      • Example: ActiveFlag: "Yes" (only active players)
      • Valueset:
        • "Yes" (only active players)
        • "No" (all players, including retired)
  • opts: A keyword list of additional options for the request, such as headers or timeout settings.

Returns

  • {:ok, leaders}: A map of all-time leaders data.
  • {:error, reason}: An error tuple with the reason for failure.

Notes

  • Data availability depends on the league, season type, stat category, and other parameters. Some combinations may return no data.
  • For All-Time Leaders, the Season parameter can be set to "All Time".

Example

iex> NBA.Stats.LeagueLeaders.get()
{:ok, [%{"PLAYER_ID" => 2544, ...}, ...]}

get!(params \\ [], opts \\ [])

(since 0.1.0)