NBA.Stats.PlayerCompare (nba_api_ex v0.1.0)

View Source

Provides functions to interact with the NBA stats API for PlayerCompare.

See get/2 for parameter and usage details.

Summary

Functions

get(params \\ [LastNGames: 0, MeasureType: "Base", Month: 0, OpponentTeamID: 0, PaceAdjust: "N", PerMode: "PerGame", Period: 0, PlayerIDList: nil, PlusMinus: "N", Rank: "N", Season: nil, SeasonType: "Regular Season", VsPlayerIDList: nil, VsDivision: nil, VsConference: nil, ShotClockRange: nil, SeasonSegment: nil, Outcome: nil, Location: nil, LeagueID: "00", GameSegment: nil, Division: nil, DateTo: nil, DateFrom: nil, Conference: nil], opts \\ [])

(since 0.1.0)

Fetches PlayerCompare data.

Parameters

  • params: A keyword list of parameters to filter the data.

    • PlayerIDList: (Required) Comma-separated list of player IDs.

      • Type(s): String
      • Example: PlayerIDList: "201939,202691"
      • Default: nil
    • Season: (Required) The season.

      • Type(s): String
      • Example: Season: "2024-25"
      • Default: nil
    • VsPlayerIDList: (Required) Comma-separated list of vs player IDs.

      • Type(s): String
      • Example: VsPlayerIDList: "201939,202691"
      • Default: nil
    • LastNGames: Number of last games to include.

      • Type(s): Integer
      • Example: LastNGames: 10
      • Default: 0
    • MeasureType: The type of measure.

      • Type(s): String
      • Example: MeasureType: "Base"
      • Default: "Base"
      • Valueset:
        • "Base"
        • "Advanced"
        • "Misc"
        • "Four Factors"
        • "Scoring"
        • "Opponent"
        • "Usage"
        • "Defense"
    • Month: The month number.

      • Type(s): Integer
      • Example: Month: 1
      • Default: 0
    • OpponentTeamID: The opponent team ID.

      • Type(s): Integer | String

      • Example: OpponentTeamID: 1610612737
      • Default: 0
    • PaceAdjust: Whether to adjust for pace.

      • Type(s): String
      • Example: PaceAdjust: "Y"
      • Default: "N"
      • Valueset:
        • "Y"
        • "N"
    • PerMode: How to aggregate stats.

      • Type(s): String
      • Example: PerMode: "PerGame"
      • Default: "PerGame"
      • Valueset:
        • "Totals"
        • "PerGame"
        • "MinutesPer"
        • "Per48"
        • "Per40"
        • "Per36"
        • "PerMinute"
        • "PerPossession"
        • "PerPlay"
        • "Per100Possessions"
        • "Per100Plays"
    • Period: The period number.

      • Type(s): Integer
      • Example: Period: 1
      • Default: 0
    • PlusMinus: Whether to include plus/minus.

      • Type(s): String
      • Example: PlusMinus: "Y"
      • Default: "N"
      • Valueset:
        • "Y"
        • "N"
    • Rank: Whether to include rank.

      • Type(s): String
      • Example: Rank: "Y"
      • Default: "N"
      • Valueset:
        • "Y"
        • "N"
    • SeasonType: The type of season.

      • Type(s): String
      • Example: SeasonType: "Regular Season"
      • Default: "Regular Season"
      • Valueset:
        • "Regular Season"
        • "Pre Season"
        • "Playoffs"
    • VsDivision: The vs division.

      • Type(s): String
      • Example: VsDivision: "Atlantic"
      • Default: nil
      • Valueset:
        • "Atlantic"
        • "Central"
        • "Northwest"
        • "Pacific"
        • "Southeast"
        • "Southwest"
        • "East"
        • "West"
    • VsConference: The vs conference.

      • Type(s): String
      • Example: VsConference: "East"
      • Default: nil
      • Valueset:
        • "East"
        • "West"
    • ShotClockRange: The shot clock range.

      • Type(s): String
      • Example: ShotClockRange: "24-22"
      • Default: nil
    • SeasonSegment: The season segment.

      • Type(s): String
      • Example: SeasonSegment: "Pre All-Star"
      • Default: nil
      • Valueset:
        • "Post All-Star"
        • "Pre All-Star"
    • Outcome: The outcome.

      • Type(s): String
      • Example: Outcome: "W"
      • Default: nil
      • Valueset:
        • "W"
        • "L"
    • Location: The location.

      • Type(s): String
      • Example: Location: "Home"
      • Default: nil
      • Valueset:
        • "Home"
        • "Road"
    • LeagueID: The league ID.

      • Type(s): String
      • Example: LeagueID: "00"
      • Default: "00"
      • Valueset:
        • "00" (NBA)
        • "01" (ABA)
        • "10" (WNBA)
        • "20" (G League)
    • GameSegment: The game segment.

      • Type(s): String
      • Example: GameSegment: "First Half"
      • Default: nil
      • Valueset:
        • "First Half"
        • "Overtime"
        • "Second Half"
    • Division: The division.

      • Type(s): String
      • Example: Division: "Atlantic"
      • Default: nil
    • DateTo: The end date.

      • Type(s): String
      • Example: DateTo: "2024-01-31"
      • Default: nil
    • DateFrom: The start date.

      • Type(s): String
      • Example: DateFrom: "2024-01-01"
      • Default: nil
    • Conference: The conference.

      • Type(s): String
      • Example: Conference: "East"
      • Default: nil
      • Valueset:
        • "East"
        • "West"
  • opts: A keyword list of additional options for the request, such as headers or timeout settings.

Returns

  • {:ok, data}: On success, returns the data from the API.
  • {:error, reason}: On failure, returns an error tuple with the reason.

Example

iex> NBA.Stats.PlayerCompare.get(LastNGames: 10, MeasureType: "Base", Month: 1, OpponentTeamID: 1610612737, PaceAdjust: "N", PerMode: "PerGame", Period: 1, PlayerIDList: "201939,202691", PlusMinus: "N", Rank: "N", Season: "2024-25", SeasonType: "Regular Season", VsPlayerIDList: "201939,202691")
{:ok, %{"PlayerCompare" => [%{...}, ...]}}

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

(since 0.1.0)