NBA.Stats.ShotChartDetail (nba_api_ex v0.1.0)

View Source

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

See get/2 for parameter and usage details.

Summary

Functions

get(params \\ [ContextMeasure: "FGA", LastNGames: 0, LeagueID: "00", Month: 0, OpponentTeamID: 0, Period: 0, PlayerID: nil, SeasonType: "Regular Season", TeamID: nil, VsDivision: nil, VsConference: nil, StartRange: nil, StartPeriod: nil, SeasonSegment: nil, Season: nil, RookieYear: nil, RangeType: nil, Position: nil, PointDiff: nil, PlayerPosition: nil, Outcome: nil, Location: nil, GameSegment: nil, GameID: nil, EndRange: nil, EndPeriod: nil, DateTo: nil, DateFrom: nil, ContextFilter: nil, ClutchTime: nil, AheadBehind: nil], opts \\ [])

(since 0.1.0)

Fetches ShotChartDetail data.

Parameters

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

    • PlayerID: (Required) The player ID.

    • Season: (Required) The season.

      • Type(s): String
      • Example: Season: "2024-25"
      • Default: nil
    • AheadBehind: The ahead/behind context.

      • Type(s): String
      • Example: AheadBehind: "Ahead or Tied"
      • Default: nil
      • Valueset:
        • "Ahead or Behind"
        • "Ahead or Tied"
        • "Behind or Tied"
    • ClutchTime: The clutch time.

      • Type(s): String
      • Example: ClutchTime: "Last 5 Minutes"
      • Default: nil
      • Valueset:
        • "Last 5 Minutes"
        • "Last 4 Minutes"
        • "Last 3 Minutes"
        • "Last 2 Minutes"
        • "Last 1 Minute"
        • "Last 30 Seconds"
        • "Last 10 Seconds"
    • ContextFilter: The context filter.

      • Type(s): String
      • Example: ContextFilter: ""
      • Default: nil
    • ContextMeasure: The context measure.

      • Type(s): String
      • Example: ContextMeasure: "FGA"
      • Default: "FGA"
      • Valueset:
        • "PTS"
        • "FGM"
        • "FGA"
        • "FG_PCT"
        • "FG3M"
        • "FG3A"
        • "FG3_PCT"
        • "PF"
        • "EFG_PCT"
        • "TS_PCT"
        • "PTS_FB"
        • "PTS_OFF_TOV"
        • "PTS_2ND_CHANCE"
    • DateFrom: The start date (YYYY-MM-DD).

      • Type(s): String
      • Example: DateFrom: "2025-01-01"
      • Default: nil
    • DateTo: The end date (YYYY-MM-DD).

      • Type(s): String
      • Example: DateTo: "2025-03-01"
      • Default: nil
    • EndPeriod: The end period.

      • Type(s): Integer
      • Example: EndPeriod: 4
      • Default: nil
    • EndRange: The end range.

    • GameID: The game ID. 10-digit string or nil.

      • Type(s): String
      • Example: GameID: "0022100001"
      • Default: nil
    • GameSegment: The game segment.

      • Type(s): String
      • Example: GameSegment: "First Half"
      • Default: nil
      • Valueset:
        • "First Half"
        • "Overtime"
        • "Second Half"
    • LastNGames: Number of last games to include.

      • Type(s): Integer
      • Example: LastNGames: 0
      • Default: 0
    • LeagueID: The league ID.

      • Type(s): String
      • Example: LeagueID: "00"
      • Default: "00"
    • Location: The game location.

      • Type(s): String
      • Example: Location: "Home"
      • Default: nil
      • Valueset:
        • "Home"
        • "Road"
    • Month: The month (1-12, 0 for all).

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

      • Type(s): Integer | String

      • Example: OpponentTeamID: 1610612737
      • Default: 0
    • Outcome: The game outcome.

      • Type(s): String
      • Example: Outcome: "W"
      • Default: nil
      • Valueset:
        • "W"
        • "L"
    • Period: The period (0 for all).

      • Type(s): Integer
      • Example: Period: 0
      • Default: 0
    • PlayerPosition: The player position.

      • Type(s): String
      • Example: PlayerPosition: "Guard"
      • Default: nil
      • Valueset:
        • "Guard"
        • "Center"
        • "Forward"
    • PointDiff: The point differential.

    • Position: The position.

      • Type(s): String
      • Example: Position: "Guard"
      • Default: nil
    • RangeType: The range type.

    • RookieYear: The rookie year.

      • Type(s): String
      • Example: RookieYear: "2019"
      • Default: nil
    • SeasonSegment: The season segment.

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

      • Type(s): Integer
      • Example: StartPeriod: 1
      • Default: nil
    • StartRange: The start range.

    • TeamID: The team ID.

    • VsConference: The opposing conference.

      • Type(s): String
      • Example: VsConference: "West"
      • Default: nil
      • Valueset:
        • "East"
        • "West"
    • VsDivision: The opposing division.

      • Type(s): String
      • Example: VsDivision: "Pacific"
      • Default: nil
      • Valueset:
        • "Atlantic"
        • "Central"
        • "Northwest"
        • "Pacific"
        • "Southeast"
        • "Southwest"
        • "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.ShotChartDetail.get(ContextMeasure: "FGA", LastNGames: 0, LeagueID: "00", Month: 0, OpponentTeamID: 0, Period: 0, PlayerID: 201939, SeasonType: "Regular Season", TeamID: 1610612737)
{:ok, %{"ShotChartDetail" => [%{...}, ...]}}

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

(since 0.1.0)