Beispiel #1
0
def all_players(season, all_time=False):
    """
    return all players
    args:
        season: format ex: '1999-00', also accepts 1999 or 99
    returns:
        players (list)

    each player is a dict with the following available keys
    ["PERSON_ID","DISPLAY_LAST_COMMA_FIRST","ROSTERSTATUS","FROM_YEAR",
    "TO_YEAR","PLAYERCODE"]

    """

    # IsOnlyCurrentSeason: 0 is false 1 is true
    cur_season = 1
    if all_time:
        cur_season = 0

    endpoint = 'http://stats.nba.com/stats/commonallplayers'
    payload = {
        "LeagueID": "00",
        "Season": utils.cleanse_season(season),
        "IsOnlyCurrentSeason": cur_season
    }
    response = utils.get_response(endpoint, payload)
    return response['CommonAllPlayers']
Beispiel #2
0
def all_players(season, all_time=False):
    """
    return all players
    args:
        season: format ex: '1999-00', also accepts 1999 or 99
    returns:
        players (list)

    each player is a dict with the following available keys
    ["PERSON_ID","DISPLAY_LAST_COMMA_FIRST","ROSTERSTATUS","FROM_YEAR",
    "TO_YEAR","PLAYERCODE"]

    """

    # IsOnlyCurrentSeason: 0 is false 1 is true
    cur_season = 1
    if all_time:
        cur_season = 0

    endpoint = 'http://stats.nba.com/stats/commonallplayers'
    payload = {
        "LeagueID": "00",
        "Season": utils.cleanse_season(season),
        "IsOnlyCurrentSeason": cur_season
    }
    response = utils.get_response(endpoint, payload)
    return response['CommonAllPlayers']
Beispiel #3
0
def standings_from_date(date):
    """
    return the standing on a given date
    args:
        date (string): format=mm/dd/yyyy
    returns:
        standings (dict) keys are 'EAST', and 'WEST'
            values are teams

    teams (list): games that happen that day

    each team is a dict with the following available keys
    ["TEAM_ID","LEAGUE_ID","SEASON_ID","STANDINGSDATE","CONFERENCE","TEAM",
    "G","W","L","W_PCT","HOME_RECORD","ROAD_RECORD"]

    """
    endpoint = 'http://stats.nba.com/stats/scoreboardv2'
    payload = {
        'DayOffset': '0',
        'LeagueID': '00',
        'gameDate': date
    }
    response = utils.get_response(endpoint, payload)
    return {
        'EAST': response['EastConfStandingsByDay'],
        'WEST': response['WestConfStandingsByDay']
    }
Beispiel #4
0
def player_game_log(player_id, season):
    """
    return games that a player has already played in given season
    args:
        player_id (int)
        season: format ex: '1999-00', also accepts 1999 or 99
    returns:
        games (list): games a player has played in given season

    each game is a dict with the following available keys
    ["SEASON_ID","PLAYER_ID","GAME_ID","GAME_DATE","MATCHUP","WL","MIN",
    "FGM","FGA","FG_PCT","FG3M","FG3A","FG3_PCT","FTM","FTA","FT_PCT",
    "OREB","DREB","REB","AST","STL","BLK","TOV","PF","PTS","PLUS_MINUS",
    "VIDEO_AVAILABLE"]

    """
    endpoint = 'http://stats.nba.com/stats/playergamelog'
    payload = {
        "PlayerID": player_id,
        "LeagueID": "00",
        "Season": utils.cleanse_season(season),
        "SeasonType": "Regular Season"
    }
    response = utils.get_response(endpoint, payload)
    return response['PlayerGameLog']
Beispiel #5
0
def team_game_log(team_id, season):
    """
    return games that a team has already played in given season
    args:
        team_id (int)
        season: format ex: '1999-00', also accepts 1999 or 99
    returns:
        games (list): games a team has played in given season

    each game is a dict with the following available keys
    ["TEAM_ID","GAME_ID","GAME_DATE","MATCHUP","WL","MIN",
    "FGM","FGA","FG_PCT","FG3M","FG3A","FG3_PCT","FTM",
    "FTA","FT_PCT","OREB","DREB","REB","AST","STL","BLK",
    "TOV","PF","PTS"]

    """
    endpoint = 'http://stats.nba.com/stats/teamgamelog'
    payload = {
        "TeamID": team_id,
        "LeagueID": "00",
        "Season": utils.cleanse_season(season),
        "SeasonType": "Regular Season"
    }
    response = utils.get_response(endpoint, payload)
    return response['TeamGameLog']
Beispiel #6
0
def play_by_play(game_id):
    """
    return play by play data for a given game
    args:
        game_id (int)
    returns:
        plays (list)

    each player is a dict with the following available keys
    ["GAME_ID","EVENTNUM","EVENTMSGTYPE","EVENTMSGACTIONTYPE","PERIOD",
    "WCTIMESTRING","PCTIMESTRING","HOMEDESCRIPTION","NEUTRALDESCRIPTION",
    "VISITORDESCRIPTION","SCORE","SCOREMARGIN","PERSON1TYPE","PLAYER1_ID",
    "PLAYER1_NAME","PLAYER1_TEAM_ID","PLAYER1_TEAM_CITY",
    "PLAYER1_TEAM_NICKNAME","PLAYER1_TEAM_ABBREVIATION","PERSON2TYPE",
    "PLAYER2_ID","PLAYER2_NAME","PLAYER2_TEAM_ID","PLAYER2_TEAM_CITY",
    "PLAYER2_TEAM_NICKNAME","PLAYER2_TEAM_ABBREVIATION","PERSON3TYPE",
    "PLAYER3_ID","PLAYER3_NAME","PLAYER3_TEAM_ID","PLAYER3_TEAM_CITY",
    "PLAYER3_TEAM_NICKNAME","PLAYER3_TEAM_ABBREVIATION"]

    """
    endpoint = 'http://stats.nba.com/stats/playbyplayv2'
    payload = {
        'GameID': game_id,
        'StartPeriod': 1,
        'EndPeriod': 10,
        'StartRange': 0,
        'EndRange': 28800,
        'RangeType': 0
    }
    response = utils.get_response(endpoint, payload)
    return response['PlayerStats']
Beispiel #7
0
def team_game_log(team_id, season):
    """
    return games that a team has already played in given season
    args:
        team_id (int)
        season: format ex: '1999-00', also accepts 1999 or 99
    returns:
        games (list): games a team has played in given season

    each game is a dict with the following available keys
    ["TEAM_ID","GAME_ID","GAME_DATE","MATCHUP","WL","MIN",
    "FGM","FGA","FG_PCT","FG3M","FG3A","FG3_PCT","FTM",
    "FTA","FT_PCT","OREB","DREB","REB","AST","STL","BLK",
    "TOV","PF","PTS"]

    """
    endpoint = 'http://stats.nba.com/stats/teamgamelog'
    payload = {
        "TeamID": team_id,
        "LeagueID": "00",
        "Season": utils.cleanse_season(season),
        "SeasonType": "Regular Season"
    }
    response = utils.get_response(endpoint, payload)
    return response['TeamGameLog']
Beispiel #8
0
def player_game_log(player_id, season):
    """
    return games that a player has already played in given season
    args:
        player_id (int)
        season: format ex: '1999-00', also accepts 1999 or 99
    returns:
        games (list): games a player has played in given season

    each game is a dict with the following available keys
    ["SEASON_ID","PLAYER_ID","GAME_ID","GAME_DATE","MATCHUP","WL","MIN",
    "FGM","FGA","FG_PCT","FG3M","FG3A","FG3_PCT","FTM","FTA","FT_PCT",
    "OREB","DREB","REB","AST","STL","BLK","TOV","PF","PTS","PLUS_MINUS",
    "VIDEO_AVAILABLE"]

    """
    endpoint = 'http://stats.nba.com/stats/playergamelog'
    payload = {
        "PlayerID": player_id,
        "LeagueID": "00",
        "Season": utils.cleanse_season(season),
        "SeasonType": "Regular Season"
    }
    response = utils.get_response(endpoint, payload)
    return response['PlayerGameLog']
Beispiel #9
0
def play_by_play(game_id):
    """
    return play by play data for a given game
    args:
        game_id (int)
    returns:
        plays (list)

    each player is a dict with the following available keys
    ["GAME_ID","EVENTNUM","EVENTMSGTYPE","EVENTMSGACTIONTYPE","PERIOD",
    "WCTIMESTRING","PCTIMESTRING","HOMEDESCRIPTION","NEUTRALDESCRIPTION",
    "VISITORDESCRIPTION","SCORE","SCOREMARGIN","PERSON1TYPE","PLAYER1_ID",
    "PLAYER1_NAME","PLAYER1_TEAM_ID","PLAYER1_TEAM_CITY",
    "PLAYER1_TEAM_NICKNAME","PLAYER1_TEAM_ABBREVIATION","PERSON2TYPE",
    "PLAYER2_ID","PLAYER2_NAME","PLAYER2_TEAM_ID","PLAYER2_TEAM_CITY",
    "PLAYER2_TEAM_NICKNAME","PLAYER2_TEAM_ABBREVIATION","PERSON3TYPE",
    "PLAYER3_ID","PLAYER3_NAME","PLAYER3_TEAM_ID","PLAYER3_TEAM_CITY",
    "PLAYER3_TEAM_NICKNAME","PLAYER3_TEAM_ABBREVIATION"]

    """
    endpoint = 'http://stats.nba.com/stats/playbyplayv2'
    payload = {
        'GameID': game_id,
        'StartPeriod': 1,
        'EndPeriod': 10,
        'StartRange': 0,
        'EndRange': 28800,
        'RangeType': 0
    }
    response = utils.get_response(endpoint, payload)
    return response['PlayerStats']
Beispiel #10
0
def player_game_shot_chart(game_id, team_id, player_id):
    # TODO check to make sure correct
    """
    return player tracking information for a given game
    args:
        game_id (int)
        #TODO get team_id from player_id
        team_id (int)
        player_id (int)
    returns:
        shots (list): shots a player attempted during a game

    each player is a dict with the following available keys
    ["GRID_TYPE","GAME_ID","GAME_EVENT_ID","PLAYER_ID","PLAYER_NAME","TEAM_ID",
    "TEAM_NAME","PERIOD","MINUTES_REMAINING","SECONDS_REMAINING","EVENT_TYPE",
    "ACTION_TYPE","SHOT_TYPE","SHOT_ZONE_BASIC","SHOT_ZONE_AREA",
    "SHOT_ZONE_RANGE","SHOT_DISTANCE","LOC_X","LOC_Y","SHOT_ATTEMPTED_FLAG",
    "SHOT_MADE_FLAG"]

    """
    endpoint = 'http://stats.nba.com/stats/shotchartdetail'
    payload = {
        "LeagueID": "00",
        #see if need season or can get from game_id
        "Season": "2014-15",
        "SeasonType": "Regular Season",
        "TeamID": team_id,
        "PlayerID": player_id,
        "GameID": game_id,
        "Outcome": None,
        "Location": None,
        "Month": 0,
        "SeasonSegment": None,
        "DateFrom": None,
        "DateTo": None,
        "OpponentTeamID": 0,
        "VsConference": None,
        "VsDivision": None,
        "Position": None,
        "RookieYear": None,
        "GameSegment": None,
        "Period": 0,
        "LastNGames": 0,
        "ClutchTime": None,
        "AheadBehind": None,
        "PointDiff": None,
        "RangeType": 2,
        "StartPeriod": 1,
        "EndPeriod": 10,
        "StartRange": 0,
        "EndRange": 28800,
        "ContextFilter": "",
        "ContextMeasure": "FGA"
    }
    response = utils.get_response(endpoint, payload)
    return response['Shot_Chart_Detail']
Beispiel #11
0
def player_game_shot_chart(game_id, team_id, player_id):
    # TODO check to make sure correct 
    """
    return player tracking information for a given game
    args:
        game_id (int)
        #TODO get team_id from player_id
        team_id (int)
        player_id (int)
    returns:
        shots (list): shots a player attempted during a game

    each player is a dict with the following available keys
    ["GRID_TYPE","GAME_ID","GAME_EVENT_ID","PLAYER_ID","PLAYER_NAME","TEAM_ID",
    "TEAM_NAME","PERIOD","MINUTES_REMAINING","SECONDS_REMAINING","EVENT_TYPE",
    "ACTION_TYPE","SHOT_TYPE","SHOT_ZONE_BASIC","SHOT_ZONE_AREA",
    "SHOT_ZONE_RANGE","SHOT_DISTANCE","LOC_X","LOC_Y","SHOT_ATTEMPTED_FLAG",
    "SHOT_MADE_FLAG"]

    """
    endpoint = 'http://stats.nba.com/stats/shotchartdetail'
    payload = {
        "LeagueID": "00",
        #see if need season or can get from game_id
        "Season": "2014-15",
        "SeasonType": "Regular Season",
        "TeamID": team_id,
        "PlayerID": player_id,
        "GameID": game_id,
        "Outcome": None,
        "Location": None,
        "Month": 0,
        "SeasonSegment": None,
        "DateFrom": None,
        "DateTo": None,
        "OpponentTeamID": 0,
        "VsConference": None,
        "VsDivision": None,
        "Position": None,
        "RookieYear": None,
        "GameSegment": None,
        "Period": 0,
        "LastNGames": 0,
        "ClutchTime": None,
        "AheadBehind": None,
        "PointDiff": None,
        "RangeType": 2,
        "StartPeriod": 1,
        "EndPeriod": 10,
        "StartRange": 0,
        "EndRange": 28800,
        "ContextFilter": "",
        "ContextMeasure": "FGA"
    }
    response = utils.get_response(endpoint, payload)
    return response['Shot_Chart_Detail']
Beispiel #12
0
def league_leaders(season):
    # TODO document
    endpoint = 'http://stats.nba.com/stats/leagueleaders'
    payload = {
        "LeagueID": "00",
        "PerMode": "PerGame",
        "StatCategory": "PTS",
        "Season": util.cleanse_season(season),
        "SeasonType": "Regular Season",
        "Scope": "S"
    }
    response = utils.get_response(endpoint, payload)
    return response['LeagueLeaders']
Beispiel #13
0
def league_leaders(season):
    # TODO document
    endpoint = 'http://stats.nba.com/stats/leagueleaders'
    payload = {
        "LeagueID": "00",
        "PerMode": "PerGame",
        "StatCategory": "PTS",
        "Season": util.cleanse_season(season),
        "SeasonType": "Regular Season",
        "Scope": "S"
    }
    response = utils.get_response(endpoint, payload)
    return response['LeagueLeaders']
Beispiel #14
0
def team_screen_def():
    """
    returns synergy screen data for all teams this season
    returns:
        teams (list): offensive stats for off screen plays for all teams

    each team is a dict with the following available keys
    ["TeamIDSID","TeamName","TeamNameAbbreviation","TeamShortName","GP","Poss",
    "Time","Points","FGA","FGM","PPP","WorsePPP","BetterPPP","PossG","PPG",
    "FGAG","FGMG","FGmG","FGm","FG","aFG","FT","TO","SF","PlusOne","Score"]

    """
    endpoint = 'http://stats.nba.com/js/data/playtype/team_OffScreen.js'
    response = utils.get_response(endpoint, None)
    return response['Defensive']
Beispiel #15
0
def team_screen_def():
    """
    returns synergy screen data for all teams this season
    returns:
        teams (list): offensive stats for off screen plays for all teams

    each team is a dict with the following available keys
    ["TeamIDSID","TeamName","TeamNameAbbreviation","TeamShortName","GP","Poss",
    "Time","Points","FGA","FGM","PPP","WorsePPP","BetterPPP","PossG","PPG",
    "FGAG","FGMG","FGmG","FGm","FG","aFG","FT","TO","SF","PlusOne","Score"]

    """
    endpoint = 'http://stats.nba.com/js/data/playtype/team_OffScreen.js'
    response = utils.get_response(endpoint, None)
    return response['Defensive']
Beispiel #16
0
def team_drive(season):
    """
    returns sportsvu driving data for all teams
    args:
        season
    returns:
        teams (list): driving data for all teams

    each team is a dict with the following available keys
    ["TEAM_ID","TEAM_CITY","TEAM_NAME","TEAM_ABBREVIATION","TEAM_CODE","GP",
    "MIN","DVS","DPP","DTP","FG_PCT","PTS_48","DPP_TOT","DVS_TOT"]

    """
    endpoint = 'http://stats.nba.com/js/data/sportvu/%s/drivesTeamData.json' % util.season_to_int(season)
    response = utils.get_response(endpoint, None)
    return response['TeamTrackingDrivesStats']
Beispiel #17
0
def player_pnr_handler_off():
    """
    returns synergy PnR ball handler data for all players this season
    returns:
        players (list): data for all players

    each player is a dict with the following available keys
    ["PlayerIDSID","PlayerFirstName","PlayerLastName","PlayerNumber","P",
    "TeamIDSID","TeamName","TeamNameAbbreviation","TeamShortName","GP","Poss",
    "Time","Points","FGA","FGM","PPP","WorsePPP","BetterPPP","PossG","PPG",
    "FGAG","FGMG","FGmG","FGm","FG","aFG","FT","TO","SF","PlusOne","Score"]

    """
    endpoint = 'http://stats.nba.com/js/data/playtype/player_PRBallHandler.js'
    response = utils.get_response(endpoint, None)
    return response['Offensive']
Beispiel #18
0
def player_drive(season):
    """
    returns sportsvu driving data for all players
    args:
        season
    returns:
        players (list): driving data for all players

    each player is a dict with the following available keys
    ["PLAYER_ID","PLAYER","FIRST_NAME","LAST_NAME","TEAM_ABBREVIATION","GP",
    "MIN","DVS","DPP","DTP","FG_PCT","PTS_48","DPP_TOT","DVS_TOT"]

    """
    endpoint = 'http://stats.nba.com/js/data/sportvu/%s/drivesData.json' % util.season_to_int(season)
    response = utils.get_response(endpoint, None)
    return response['PlayerTrackingDrivesStats']
Beispiel #19
0
def player_pnr_handler_off():
    """
    returns synergy PnR ball handler data for all players this season
    returns:
        players (list): data for all players

    each player is a dict with the following available keys
    ["PlayerIDSID","PlayerFirstName","PlayerLastName","PlayerNumber","P",
    "TeamIDSID","TeamName","TeamNameAbbreviation","TeamShortName","GP","Poss",
    "Time","Points","FGA","FGM","PPP","WorsePPP","BetterPPP","PossG","PPG",
    "FGAG","FGMG","FGmG","FGm","FG","aFG","FT","TO","SF","PlusOne","Score"]

    """
    endpoint = 'http://stats.nba.com/js/data/playtype/player_PRBallHandler.js'
    response = utils.get_response(endpoint, None)
    return response['Offensive']
Beispiel #20
0
def team_passing(season):
    """
    returns sportsvu passing data for all teams
    args:
        season
    returns:
        teams (list): passing data for all teams

    each team is a dict with the following available keys
    ["TEAM_ID","TEAM_CITY","TEAM_NAME","TEAM_ABBREVIATION","TEAM_CODE","GP",
    "MIN","PASS","AST","AST_FT","AST_SEC","AST_POT","PTS_CRT","PTS_CRT_48",
    "AST_TOT"]

    """
    endpoint = 'http://stats.nba.com/js/data/sportvu/%s/passingTeamData.json' % util.season_to_int(season)
    response = utils.get_response(endpoint, None)
    return response['TeamTrackingPassingStats']
Beispiel #21
0
def team_touches(season):
    """
    returns sportsvu touches data for all teams
    args:
        season
    returns:
        teams (list): touches data for all teams

    each team is a dict with the following available keys
    ["TEAM_ID","TEAM_CITY","TEAM_NAME","TEAM_ABBREVIATION","TEAM_CODE","GP",
    "MIN","TCH","FC_TCH","TOP","CL_TCH","EL_TCH","PTS","PTS_TCH","PTS_HCCT",
    "TCH_TOT"]

    """
    endpoint = 'http://stats.nba.com/js/data/sportvu/%s/touchesTeamData.json' % util.season_to_int(season)
    response = utils.get_response(endpoint, None)
    return response['TeamTrackingTouchesStats']
Beispiel #22
0
def team_drive(season):
    """
    returns sportsvu driving data for all teams
    args:
        season
    returns:
        teams (list): driving data for all teams

    each team is a dict with the following available keys
    ["TEAM_ID","TEAM_CITY","TEAM_NAME","TEAM_ABBREVIATION","TEAM_CODE","GP",
    "MIN","DVS","DPP","DTP","FG_PCT","PTS_48","DPP_TOT","DVS_TOT"]

    """
    endpoint = 'http://stats.nba.com/js/data/sportvu/%s/drivesTeamData.json' % util.season_to_int(
        season)
    response = utils.get_response(endpoint, None)
    return response['TeamTrackingDrivesStats']
Beispiel #23
0
def player_screen_def():
    """
    returns synergy off screen defense data for all players this season
    returns:
        players (list): all qualified player's off screen defense stats

    each player is a dict with the following available keys
    ["PlayerIDSID","PlayerFirstName","PlayerLastName","PlayerNumber","P",
    "TeamIDSID","TeamName","TeamNameAbbreviation","TeamShortName","GP","Poss",
    "Time","Points","FGA","FGM","PPP","WorsePPP","BetterPPP","PossG","PPG",
    "FGAG","FGMG","FGmG","FGm","FG","aFG","FT","TO","SF","PlusOne","Score"]

    """
    endpoint = 'http://stats.nba.com/js/data/playtype/player_OffScreen.js'
    response = utils.get_response(endpoint, None)
    # yes there is a typo in the endpoint
    return response['Deffensive']
Beispiel #24
0
def player_drive(season):
    """
    returns sportsvu driving data for all players
    args:
        season
    returns:
        players (list): driving data for all players

    each player is a dict with the following available keys
    ["PLAYER_ID","PLAYER","FIRST_NAME","LAST_NAME","TEAM_ABBREVIATION","GP",
    "MIN","DVS","DPP","DTP","FG_PCT","PTS_48","DPP_TOT","DVS_TOT"]

    """
    endpoint = 'http://stats.nba.com/js/data/sportvu/%s/drivesData.json' % util.season_to_int(
        season)
    response = utils.get_response(endpoint, None)
    return response['PlayerTrackingDrivesStats']
Beispiel #25
0
def player_pull_up(season):
    """
    returns sportsvu pull up shooting data for all players
    args:
        season
    returns:
        players (list): pull up shooting data for all players

    each player is a dict with the following available keys
    ["PLAYER_ID","PLAYER","FIRST_NAME","LAST_NAME","TEAM_ABBREVIATION","GP",
    "MIN","PTS","FGM","FGA","FG_PCT","FG3M","FG3A","FG3_PCT","EFG_PCT",
    "PTS_TOT"]

    """
    endpoint = 'http://stats.nba.com/js/data/sportvu/%s/pullUpShootData.json' % util.season_to_int(season)
    response = utils.get_response(endpoint, None)
    return response['PlayerTrackingPullUpShootStats']
Beispiel #26
0
def all_players_stats(season):
    # TODO all users to specify what type of stats
    """
    return basic stats for all players in a season
    args:
        season: format ex: '1999-00', also accepts 1999 or 99
    returns:
        players (list): players and their stats for the season

    each player is a dict with the following available keys
    ["PLAYER_ID","PLAYER_NAME","TEAM_ID","TEAM_ABBREVIATION","GP","W","L",
    "W_PCT","MIN","FGM","FGA","FG_PCT","FG3M","FG3A","FG3_PCT","FTM","FTA",
    "FT_PCT","OREB","DREB","REB","AST","TOV","STL","BLK","BLKA","PF","PFD",
    "PTS","PLUS_MINUS","DD2","TD3","CFID","CFPARAMS"]

    """
    endpoint = 'http://stats.nba.com/stats/leaguedashplayerstats'
    payload = {
        "MeasureType":"Base",
        "PerMode":"PerGame",
        "PlusMinus":"N",
        "PaceAdjust":"N",
        "Rank":"N",
        "LeagueID":"00",
        "Season":utils.cleanse_season(season),
        "SeasonType":"Regular Season",
        "Outcome": None,
        "Location": None,
        "Month":0,
        "SeasonSegment": None,
        "DateFrom": None,
        "DateTo": None,
        "OpponentTeamID":0,
        "VsConference": None,
        "VsDivision": None,
        "GameSegment": None,
        "Period":0,
        "LastNGames":0,
        "GameScope": None,
        "PlayerExperience": None,
        "PlayerPosition": None,
        "StarterBench": None
    }
    response = utils.get_response(endpoint, payload)
    # TODO get corrent name
    return response['LeagueDashPlayerStats']
Beispiel #27
0
def team_catch_shoot(season):
    """
    returns sportsvu catch and shoot data for all teams
    args:
        season
    returns:
        teams (list): catch and shoot data for all teams

    each team is a dict with the following available keys
    ["TEAM_ID","TEAM_CITY","TEAM_NAME","TEAM_ABBREVIATION","TEAM_CODE","GP",
    "MIN","PTS","FGM","FGA","FG_PCT","FG3M","FG3A","FG3_PCT","EFG_PCT",
    "PTS_TOT"]

    """
    endpoint = 'http://stats.nba.com/js/data/sportvu/%s/catchShootTeamData.json' % util.season_to_int(season)
    response = utils.get_response(endpoint, None)
    return response['TeamTrackingCatchShootStats']
Beispiel #28
0
def team_speed(season):
    """
    returns sportsvu speed data for all teams
    args:
        season
    returns:
        teams (list): speed data for all teams

    each team is a dict with the following available keys
    ["TEAM_ID","TEAM_CITY","TEAM_NAME","TEAM_ABBREVIATION","TEAM_CODE","GP",
    "MIN","DIST","AV_SPD","DIST_PG","DIST_48","DIST_OFF","DIST_DEF",
    "AV_SPD_OFF","AV_SPD_DEF"]

    """
    endpoint = 'http://stats.nba.com/js/data/sportvu/%s/speedTeamData.json' % util.season_to_int(season)
    response = utils.get_response(endpoint, None)
    return response['TeamTrackingSpeedStats']
Beispiel #29
0
def player_passing(season):
    """
    returns sportsvu passing data for all players
    args:
        season
    returns:
        players (list): passing data for all players

    each player is a dict with the following available keys
    ["PLAYER_ID","PLAYER","FIRST_NAME","LAST_NAME","TEAM_ABBREVIATION","GP",
    "MIN","PASS","AST","AST_FT","AST_SEC","AST_POT","PTS_CRT","PTS_CRT_48",
    "AST_TOT"]

    """
    endpoint = 'http://stats.nba.com/js/data/sportvu/%s/passingData.json' % util.season_to_int(season)
    response = utils.get_response(endpoint, None)
    return response['PlayerTrackingPassingStats']
Beispiel #30
0
def team_defense(season):
    """
    returns sportsvu defense data for all teams
    args:
        season
    returns:
        teams (list): defense data for all teams

    each team is a dict with the following available keys
    ["TEAM_ID","TEAM_CITY","TEAM_NAME","TEAM_ABBREVIATION","TEAM_CODE","GP",
    "MIN","BLK","STL","FGM_DEFEND_RIM","FGA_DEFEND_RIM","FGP_DEFEND_RIM",
    "BLK_TOT"]

    """
    endpoint = 'http://stats.nba.com/js/data/sportvu/%s/defenseTeamData.json' % util.season_to_int(season)
    response = utils.get_response(endpoint, None)
    return response['TeamTrackingDefenseStats']
Beispiel #31
0
def all_players_stats(season):
    # TODO all users to specify what type of stats
    """
    return basic stats for all players in a season
    args:
        season: format ex: '1999-00', also accepts 1999 or 99
    returns:
        players (list): players and their stats for the season

    each player is a dict with the following available keys
    ["PLAYER_ID","PLAYER_NAME","TEAM_ID","TEAM_ABBREVIATION","GP","W","L",
    "W_PCT","MIN","FGM","FGA","FG_PCT","FG3M","FG3A","FG3_PCT","FTM","FTA",
    "FT_PCT","OREB","DREB","REB","AST","TOV","STL","BLK","BLKA","PF","PFD",
    "PTS","PLUS_MINUS","DD2","TD3","CFID","CFPARAMS"]

    """
    endpoint = 'http://stats.nba.com/stats/leaguedashplayerstats'
    payload = {
        "MeasureType": "Base",
        "PerMode": "PerGame",
        "PlusMinus": "N",
        "PaceAdjust": "N",
        "Rank": "N",
        "LeagueID": "00",
        "Season": utils.cleanse_season(season),
        "SeasonType": "Regular Season",
        "Outcome": None,
        "Location": None,
        "Month": 0,
        "SeasonSegment": None,
        "DateFrom": None,
        "DateTo": None,
        "OpponentTeamID": 0,
        "VsConference": None,
        "VsDivision": None,
        "GameSegment": None,
        "Period": 0,
        "LastNGames": 0,
        "GameScope": None,
        "PlayerExperience": None,
        "PlayerPosition": None,
        "StarterBench": None
    }
    response = utils.get_response(endpoint, payload)
    # TODO get corrent name
    return response['LeagueDashPlayerStats']
Beispiel #32
0
def player_touches(season):
    """
    returns sportsvu touches data for all players
    args:
        season
    returns:
        players (list): touches data for all players

    each player is a dict with the following available keys
    ["PLAYER_ID","PLAYER","FIRST_NAME","LAST_NAME","TEAM_ABBREVIATION","GP",
    "MIN","TCH","FC_TCH","TOP","CL_TCH","EL_TCH","PTS","PTS_TCH","PTS_HCCT",
    "TCH_TOT"]

    """
    endpoint = 'http://stats.nba.com/js/data/sportvu/%s/touchesData.json' % util.season_to_int(season)
    response = utils.get_response(endpoint, None)
    return response['PlayerTrackingTouchesStats']
Beispiel #33
0
def player_defense(season):
    """
    returns sportsvu defense data for all players
    args:
        season
    returns:
        players (list): defense data for all players

    each player is a dict with the following available keys
    ["PLAYER_ID","PLAYER","FIRST_NAME","LAST_NAME","TEAM_ABBREVIATION","GP",
    "MIN","BLK","STL","FGM_DEFEND_RIM","FGA_DEFEND_RIM","FGP_DEFEND_RIM",
    "BLK_TOT"]

    """
    endpoint = 'http://stats.nba.com/js/data/sportvu/%s/defenseData.json' % util.season_to_int(season)
    response = utils.get_response(endpoint, None)
    return response['PlayerTrackingDefenseStats']
Beispiel #34
0
def player_speed(season):
    """
    returns sportsvu speed data for all players
    args:
        season
    returns:
        players (list): speed data for all players

    each player is a dict with the following available keys
    ["PLAYER_ID","PLAYER","FIRST_NAME","LAST_NAME","TEAM_ABBREVIATION","GP",
    "MIN","DIST","AV_SPD","DIST_PG","DIST_48","DIST_OFF","DIST_DEF",
    "AV_SPD_OFF","AV_SPD_DEF"]

    """
    endpoint = 'http://stats.nba.com/js/data/sportvu/%s/speedData.json' % util.season_to_int(season)
    response = utils.get_response(endpoint, None)
    return response['PlayerTrackingSpeedStats']
Beispiel #35
0
def player_screen_def():
    """
    returns synergy off screen defense data for all players this season
    returns:
        players (list): all qualified player's off screen defense stats

    each player is a dict with the following available keys
    ["PlayerIDSID","PlayerFirstName","PlayerLastName","PlayerNumber","P",
    "TeamIDSID","TeamName","TeamNameAbbreviation","TeamShortName","GP","Poss",
    "Time","Points","FGA","FGM","PPP","WorsePPP","BetterPPP","PossG","PPG",
    "FGAG","FGMG","FGmG","FGm","FG","aFG","FT","TO","SF","PlusOne","Score"]

    """
    endpoint = 'http://stats.nba.com/js/data/playtype/player_OffScreen.js'
    response = utils.get_response(endpoint, None)
    # yes there is a typo in the endpoint
    return response['Deffensive']
Beispiel #36
0
def team_touches(season):
    """
    returns sportsvu touches data for all teams
    args:
        season
    returns:
        teams (list): touches data for all teams

    each team is a dict with the following available keys
    ["TEAM_ID","TEAM_CITY","TEAM_NAME","TEAM_ABBREVIATION","TEAM_CODE","GP",
    "MIN","TCH","FC_TCH","TOP","CL_TCH","EL_TCH","PTS","PTS_TCH","PTS_HCCT",
    "TCH_TOT"]

    """
    endpoint = 'http://stats.nba.com/js/data/sportvu/%s/touchesTeamData.json' % util.season_to_int(
        season)
    response = utils.get_response(endpoint, None)
    return response['TeamTrackingTouchesStats']
Beispiel #37
0
def team_speed(season):
    """
    returns sportsvu speed data for all teams
    args:
        season
    returns:
        teams (list): speed data for all teams

    each team is a dict with the following available keys
    ["TEAM_ID","TEAM_CITY","TEAM_NAME","TEAM_ABBREVIATION","TEAM_CODE","GP",
    "MIN","DIST","AV_SPD","DIST_PG","DIST_48","DIST_OFF","DIST_DEF",
    "AV_SPD_OFF","AV_SPD_DEF"]

    """
    endpoint = 'http://stats.nba.com/js/data/sportvu/%s/speedTeamData.json' % util.season_to_int(
        season)
    response = utils.get_response(endpoint, None)
    return response['TeamTrackingSpeedStats']
Beispiel #38
0
def player_speed(season):
    """
    returns sportsvu speed data for all players
    args:
        season
    returns:
        players (list): speed data for all players

    each player is a dict with the following available keys
    ["PLAYER_ID","PLAYER","FIRST_NAME","LAST_NAME","TEAM_ABBREVIATION","GP",
    "MIN","DIST","AV_SPD","DIST_PG","DIST_48","DIST_OFF","DIST_DEF",
    "AV_SPD_OFF","AV_SPD_DEF"]

    """
    endpoint = 'http://stats.nba.com/js/data/sportvu/%s/speedData.json' % util.season_to_int(
        season)
    response = utils.get_response(endpoint, None)
    return response['PlayerTrackingSpeedStats']
Beispiel #39
0
def player_defense(season):
    """
    returns sportsvu defense data for all players
    args:
        season
    returns:
        players (list): defense data for all players

    each player is a dict with the following available keys
    ["PLAYER_ID","PLAYER","FIRST_NAME","LAST_NAME","TEAM_ABBREVIATION","GP",
    "MIN","BLK","STL","FGM_DEFEND_RIM","FGA_DEFEND_RIM","FGP_DEFEND_RIM",
    "BLK_TOT"]

    """
    endpoint = 'http://stats.nba.com/js/data/sportvu/%s/defenseData.json' % util.season_to_int(
        season)
    response = utils.get_response(endpoint, None)
    return response['PlayerTrackingDefenseStats']
Beispiel #40
0
def team_passing(season):
    """
    returns sportsvu passing data for all teams
    args:
        season
    returns:
        teams (list): passing data for all teams

    each team is a dict with the following available keys
    ["TEAM_ID","TEAM_CITY","TEAM_NAME","TEAM_ABBREVIATION","TEAM_CODE","GP",
    "MIN","PASS","AST","AST_FT","AST_SEC","AST_POT","PTS_CRT","PTS_CRT_48",
    "AST_TOT"]

    """
    endpoint = 'http://stats.nba.com/js/data/sportvu/%s/passingTeamData.json' % util.season_to_int(
        season)
    response = utils.get_response(endpoint, None)
    return response['TeamTrackingPassingStats']
Beispiel #41
0
def player_pull_up(season):
    """
    returns sportsvu pull up shooting data for all players
    args:
        season
    returns:
        players (list): pull up shooting data for all players

    each player is a dict with the following available keys
    ["PLAYER_ID","PLAYER","FIRST_NAME","LAST_NAME","TEAM_ABBREVIATION","GP",
    "MIN","PTS","FGM","FGA","FG_PCT","FG3M","FG3A","FG3_PCT","EFG_PCT",
    "PTS_TOT"]

    """
    endpoint = 'http://stats.nba.com/js/data/sportvu/%s/pullUpShootData.json' % util.season_to_int(
        season)
    response = utils.get_response(endpoint, None)
    return response['PlayerTrackingPullUpShootStats']
Beispiel #42
0
def player_touches(season):
    """
    returns sportsvu touches data for all players
    args:
        season
    returns:
        players (list): touches data for all players

    each player is a dict with the following available keys
    ["PLAYER_ID","PLAYER","FIRST_NAME","LAST_NAME","TEAM_ABBREVIATION","GP",
    "MIN","TCH","FC_TCH","TOP","CL_TCH","EL_TCH","PTS","PTS_TCH","PTS_HCCT",
    "TCH_TOT"]

    """
    endpoint = 'http://stats.nba.com/js/data/sportvu/%s/touchesData.json' % util.season_to_int(
        season)
    response = utils.get_response(endpoint, None)
    return response['PlayerTrackingTouchesStats']
Beispiel #43
0
def team_defense(season):
    """
    returns sportsvu defense data for all teams
    args:
        season
    returns:
        teams (list): defense data for all teams

    each team is a dict with the following available keys
    ["TEAM_ID","TEAM_CITY","TEAM_NAME","TEAM_ABBREVIATION","TEAM_CODE","GP",
    "MIN","BLK","STL","FGM_DEFEND_RIM","FGA_DEFEND_RIM","FGP_DEFEND_RIM",
    "BLK_TOT"]

    """
    endpoint = 'http://stats.nba.com/js/data/sportvu/%s/defenseTeamData.json' % util.season_to_int(
        season)
    response = utils.get_response(endpoint, None)
    return response['TeamTrackingDefenseStats']
Beispiel #44
0
def player_passing(season):
    """
    returns sportsvu passing data for all players
    args:
        season
    returns:
        players (list): passing data for all players

    each player is a dict with the following available keys
    ["PLAYER_ID","PLAYER","FIRST_NAME","LAST_NAME","TEAM_ABBREVIATION","GP",
    "MIN","PASS","AST","AST_FT","AST_SEC","AST_POT","PTS_CRT","PTS_CRT_48",
    "AST_TOT"]

    """
    endpoint = 'http://stats.nba.com/js/data/sportvu/%s/passingData.json' % util.season_to_int(
        season)
    response = utils.get_response(endpoint, None)
    return response['PlayerTrackingPassingStats']
Beispiel #45
0
def team_catch_shoot(season):
    """
    returns sportsvu catch and shoot data for all teams
    args:
        season
    returns:
        teams (list): catch and shoot data for all teams

    each team is a dict with the following available keys
    ["TEAM_ID","TEAM_CITY","TEAM_NAME","TEAM_ABBREVIATION","TEAM_CODE","GP",
    "MIN","PTS","FGM","FGA","FG_PCT","FG3M","FG3A","FG3_PCT","EFG_PCT",
    "PTS_TOT"]

    """
    endpoint = 'http://stats.nba.com/js/data/sportvu/%s/catchShootTeamData.json' % util.season_to_int(
        season)
    response = utils.get_response(endpoint, None)
    return response['TeamTrackingCatchShootStats']
Beispiel #46
0
def boxscore(game_id):
    """
    return boxscore for a given game
    args:
        game_id (int)
    returns:
        players (list): players that played in given game and their stats

    each player is a dict with the following available keys
    ["GAME_ID","TEAM_ID","TEAM_ABBREVIATION","TEAM_CITY","PLAYER_ID",
    "PLAYER_NAME","START_POSITION","COMMENT","MIN","FGM","FGA","FG_PCT",
    "FG3M","FG3A","FG3_PCT","FTM","FTA","FT_PCT","OREB","DREB","REB",
    "AST","STL","BLK","TO","PF","PTS","PLUS_MINUS"]

    """
    endpoint = 'http://stats.nba.com/stats/boxscoretraditionalv2'
    payload = {"GameID": game_id, "StartPeriod": 1, "EndPeriod": 10}
    response = utils.get_response(endpoint, payload)
    return response['PlayByPlay']
Beispiel #47
0
def team_leaders_from_date(date):
    """
    return statistical leaders for teams that play on given date
    args:
        date (string): format=mm/dd/yyyy
    returns:
        teams (list): teams that played on the given date and their statistical
            leaders

    each team is a dict with the following available keys
    ["GAME_ID","TEAM_ID","TEAM_CITY","TEAM_NICKNAME","TEAM_ABBREVIATION",
    "PTS_PLAYER_ID","PTS_PLAYER_NAME","PTS","REB_PLAYER_ID","REB_PLAYER_NAME",
    "REB","AST_PLAYER_ID","AST_PLAYER_NAME","AST"]

    """
    endpoint = 'http://stats.nba.com/stats/scoreboardv2'
    payload = {'DayOffset': '0', 'LeagueID': '00', 'gameDate': date}
    response = utils.get_response(endpoint, payload)
    return response['TeamLeaders']
Beispiel #48
0
def player_shooting(season):
    """
    returns sportsvu shooting data for all players
    args:
        season
    returns:
        players (list): shooting data for all players

    each player is a dict with the following available keys
    ["PLAYER_ID","PLAYER","FIRST_NAME","LAST_NAME","TEAM_ABBREVIATION","GP",
    "MIN","PTS","PTS_DRIVE","FGP_DRIVE","PTS_CLOSE","FGP_CLOSE",
    "PTS_CATCH_SHOOT","FGP_CATCH_SHOOT","PTS_PULL_UP","FGP_PULL_UP",
    "FGA_DRIVE","FGA_CLOSE","FGA_CATCH_SHOOT","FGA_PULL_UP","EFG_PCT","CFGM",
    "CFGA","CFGP","UFGM","UFGA","UFGP","CFG3M","CFG3A","CFG3P","UFG3M",
    "UFG3A","UFG3P"]

    """
    endpoint = 'http://stats.nba.com/js/data/sportvu/%s/shootingData.json' % util.season_to_int(season)
    response = utils.get_response(endpoint, None)
    return response['PlayerTrackingShootingEfficiencyStats']
Beispiel #49
0
def schedule_from_date(date):
    """
    return games that happen on given date
    args:
        date (string): format=mm/dd/yyyy
    returns:
        games (list): games that happen that day

    each game is a dict with the following available keys
    ["GAME_DATE_EST","GAME_SEQUENCE","GAME_ID","GAME_STATUS_ID",
    "GAME_STATUS_TEXT","GAMECODE","HOME_TEAM_ID","VISITOR_TEAM_ID",
    "SEASON","LIVE_PERIOD","LIVE_PC_TIME",
    "NATL_TV_BROADCASTER_ABBREVIATION","LIVE_PERIOD_TIME_BCAST",
    "WH_STATUS"]

    """
    endpoint = 'http://stats.nba.com/stats/scoreboardv2'
    payload = {'DayOffset': '0', 'LeagueID': '00', 'gameDate': date}
    response = utils.get_response(endpoint, payload)
    return response['GameHeader']
Beispiel #50
0
def player_rebounding(season):
    """
    returns sportsvu rebounding data for all players
    args:
        season
    returns:
        players (list): rebounding data for all players

    each player is a dict with the following available keys
    ["PLAYER_ID","PLAYER","FIRST_NAME","LAST_NAME","TEAM_ABBREVIATION","GP",
    "MIN","REB","REB_CHANCE","REB_COL_PCT","REB_CONTESTED","REB_UNCONTESTED",
    "REB_UNCONTESTED_PCT","REB_TOT","OREB","OREB_CHANCE","OREB_COL_PCT",
    "OREB_CONTESTED","OREB_UNCONTESTED","OREB_UNCONTESTED_PCT","DREB",
    "DREB_CHANCE","DREB_COL_PCT","DREB_CONTESTED","DREB_UNCONTESTED",
    "DREB_UNCONTESTED_PCT"]

    """
    endpoint = 'http://stats.nba.com/js/data/sportvu/%s/reboundingData.json' % util.season_to_int(season)
    response = utils.get_response(endpoint, None)
    return response['PlayerTrackingReboundingStats']
Beispiel #51
0
def team_shooting(season):
    """
    returns sportsvu shooting data for all teams
    args:
        season
    returns:
        teams (list): shooting data for all teams

    each team is a dict with the following available keys
    ["TEAM_ID","TEAM_CITY","TEAM_NAME","TEAM_ABBREVIATION","TEAM_CODE","GP",
    "MIN","PTS","PTS_DRIVE","FGP_DRIVE","PTS_CLOSE","FGP_CLOSE",
    "PTS_CATCH_SHOOT","FGP_CATCH_SHOOT","PTS_PULL_UP","FGP_PULL_UP",
    "FGA_DRIVE","FGA_CLOSE","FGA_CATCH_SHOOT","FGA_PULL_UP","EFG_PCT",
    "CFGM","CFGA","CFGP","UFGM","UFGA","UFGP","CFG3M","CFG3A","CFG3P",
    "UFG3M","UFG3A","UFG3P"]

    """
    endpoint = 'http://stats.nba.com/js/data/sportvu/%s/shootingTeamData.json' % util.season_to_int(season)
    response = utils.get_response(endpoint, None)
    return response['TeamTrackingShootingEfficiencyStats']
Beispiel #52
0
def team_rebounding(season):
    """
    returns sportsvu rebounding data for all teams
    args:
        season
    returns:
        teams (list): rebounding data for all teams

    each team is a dict with the following available keys
    ["TEAM_ID","TEAM_CITY","TEAM_NAME","TEAM_ABBREVIATION","TEAM_CODE","GP",
    "MIN","REB","REB_CHANCE","REB_COL_PCT","REB_CONTESTED","REB_UNCONTESTED",
    "REB_UNCONTESTED_PCT","REB_TOT","OREB","OREB_CHANCE","OREB_COL_PCT",
    "OREB_CONTESTED","OREB_UNCONTESTED","OREB_UNCONTESTED_PCT","DREB",
    "DREB_CHANCE","DREB_COL_PCT","DREB_CONTESTED","DREB_UNCONTESTED",
    "DREB_UNCONTESTED_PCT"]

    """
    endpoint = 'http://stats.nba.com/js/data/sportvu/%s/reboundingTeamData.json' % util.season_to_int(season)
    response = utils.get_response(endpoint, None)
    return response['TeamTrackingReboundingStats']
Beispiel #53
0
def league_lineups(season):
    """
    return lineups that have played in given season
    args:
        season: format ex: '1999-00', also accepts 1999 or 99
    returns:
        lineups (list): lineups that have played in the season

    each lineup is a dict with the following available keys
    ["GROUP_SET","GROUP_ID","GROUP_NAME","TEAM_ID","TEAM_ABBREVIATION","GP",
    "W","L","W_PCT","MIN","FGM","FGA","FG_PCT","FG3M","FG3A","FG3_PCT","FTM",
    "FTA","FT_PCT","OREB","DREB","REB","AST","TOV","STL","BLK","BLKA","PF",
    "PFD","PTS","PLUS_MINUS"]

    """
    endpoint = 'http://stats.nba.com/stats/leaguedashlineups'
    payload = {
        "MeasureType": "Base",
        "PerMode": "PerGame",
        "PlusMinus": "N",
        "PaceAdjust": "N",
        "Rank": "N",
        "LeagueID": "00",
        "Season": util.cleanse_season(season),
        "SeasonType": "Regular Season",
        "Outcome": None,
        "Location": None,
        "Month": 0,
        "SeasonSegment": None,
        "DateFrom": None,
        "DateTo": None,
        "OpponentTeamID": 0,
        "VsConference": None,
        "VsDivision": None,
        "GameSegment": None,
        "Period": 0,
        "LastNGames": 0,
        "GroupQuantity": 5
    }
    response = utils.get_response(endpoint, payload)
    return response['Lineups']
Beispiel #54
0
def league_lineups(season):
    """
    return lineups that have played in given season
    args:
        season: format ex: '1999-00', also accepts 1999 or 99
    returns:
        lineups (list): lineups that have played in the season

    each lineup is a dict with the following available keys
    ["GROUP_SET","GROUP_ID","GROUP_NAME","TEAM_ID","TEAM_ABBREVIATION","GP",
    "W","L","W_PCT","MIN","FGM","FGA","FG_PCT","FG3M","FG3A","FG3_PCT","FTM",
    "FTA","FT_PCT","OREB","DREB","REB","AST","TOV","STL","BLK","BLKA","PF",
    "PFD","PTS","PLUS_MINUS"]

    """
    endpoint = 'http://stats.nba.com/stats/leaguedashlineups'
    payload = {
        "MeasureType": "Base",
        "PerMode": "PerGame",
        "PlusMinus": "N",
        "PaceAdjust": "N",
        "Rank": "N",
        "LeagueID": "00",
        "Season": util.cleanse_season(season),
        "SeasonType": "Regular Season",
        "Outcome": None,
        "Location": None,
        "Month": 0,
        "SeasonSegment": None,
        "DateFrom": None,
        "DateTo": None,
        "OpponentTeamID": 0,
        "VsConference": None,
        "VsDivision": None,
        "GameSegment": None,
        "Period": 0,
        "LastNGames": 0,
        "GroupQuantity": 5
    }
    response = utils.get_response(endpoint, payload)
    return response['Lineups']
Beispiel #55
0
def player_info(player_id):
    """
    return a players information
    args:
        player_id (int)
    returns:
        info (dict)

    info is a dict with the following available keys
    ["PERSON_ID","FIRST_NAME","LAST_NAME","DISPLAY_FIRST_LAST",
    "DISPLAY_LAST_COMMA_FIRST","DISPLAY_FI_LAST","BIRTHDATE","SCHOOL",
    "COUNTRY","LAST_AFFILIATION","HEIGHT","WEIGHT","SEASON_EXP","JERSEY",
    "POSITION","ROSTERSTATUS","TEAM_ID","TEAM_NAME","TEAM_ABBREVIATION",
    "TEAM_CODE","TEAM_CITY","PLAYERCODE","FROM_YEAR","TO_YEAR",
    "DLEAGUE_FLAG"]

    """
    endpoint = 'http://stats.nba.com/stats/commonplayerinfo'
    payload = {"PlayerID": player_id, "LeagueID": "00"}
    response = utils.get_response(endpoint, payload)
    return response['CommonPlayerInfo']
Beispiel #56
0
def team_shooting(season):
    """
    returns sportsvu shooting data for all teams
    args:
        season
    returns:
        teams (list): shooting data for all teams

    each team is a dict with the following available keys
    ["TEAM_ID","TEAM_CITY","TEAM_NAME","TEAM_ABBREVIATION","TEAM_CODE","GP",
    "MIN","PTS","PTS_DRIVE","FGP_DRIVE","PTS_CLOSE","FGP_CLOSE",
    "PTS_CATCH_SHOOT","FGP_CATCH_SHOOT","PTS_PULL_UP","FGP_PULL_UP",
    "FGA_DRIVE","FGA_CLOSE","FGA_CATCH_SHOOT","FGA_PULL_UP","EFG_PCT",
    "CFGM","CFGA","CFGP","UFGM","UFGA","UFGP","CFG3M","CFG3A","CFG3P",
    "UFG3M","UFG3A","UFG3P"]

    """
    endpoint = 'http://stats.nba.com/js/data/sportvu/%s/shootingTeamData.json' % util.season_to_int(
        season)
    response = utils.get_response(endpoint, None)
    return response['TeamTrackingShootingEfficiencyStats']
Beispiel #57
0
def player_rebounding(season):
    """
    returns sportsvu rebounding data for all players
    args:
        season
    returns:
        players (list): rebounding data for all players

    each player is a dict with the following available keys
    ["PLAYER_ID","PLAYER","FIRST_NAME","LAST_NAME","TEAM_ABBREVIATION","GP",
    "MIN","REB","REB_CHANCE","REB_COL_PCT","REB_CONTESTED","REB_UNCONTESTED",
    "REB_UNCONTESTED_PCT","REB_TOT","OREB","OREB_CHANCE","OREB_COL_PCT",
    "OREB_CONTESTED","OREB_UNCONTESTED","OREB_UNCONTESTED_PCT","DREB",
    "DREB_CHANCE","DREB_COL_PCT","DREB_CONTESTED","DREB_UNCONTESTED",
    "DREB_UNCONTESTED_PCT"]

    """
    endpoint = 'http://stats.nba.com/js/data/sportvu/%s/reboundingData.json' % util.season_to_int(
        season)
    response = utils.get_response(endpoint, None)
    return response['PlayerTrackingReboundingStats']
Beispiel #58
0
def player_shooting(season):
    """
    returns sportsvu shooting data for all players
    args:
        season
    returns:
        players (list): shooting data for all players

    each player is a dict with the following available keys
    ["PLAYER_ID","PLAYER","FIRST_NAME","LAST_NAME","TEAM_ABBREVIATION","GP",
    "MIN","PTS","PTS_DRIVE","FGP_DRIVE","PTS_CLOSE","FGP_CLOSE",
    "PTS_CATCH_SHOOT","FGP_CATCH_SHOOT","PTS_PULL_UP","FGP_PULL_UP",
    "FGA_DRIVE","FGA_CLOSE","FGA_CATCH_SHOOT","FGA_PULL_UP","EFG_PCT","CFGM",
    "CFGA","CFGP","UFGM","UFGA","UFGP","CFG3M","CFG3A","CFG3P","UFG3M",
    "UFG3A","UFG3P"]

    """
    endpoint = 'http://stats.nba.com/js/data/sportvu/%s/shootingData.json' % util.season_to_int(
        season)
    response = utils.get_response(endpoint, None)
    return response['PlayerTrackingShootingEfficiencyStats']
Beispiel #59
0
def team_coaching_staff(team_id, season):
    """
    return a given team's coaching staff
    args:
        team_id (int)
        season: format ex: '1999-00', also accepts 1999 or 99
    returns:
        coaches (list): 

    each coach is a dict with the following available keys
    ["TEAM_ID","SEASON","COACH_ID","FIRST_NAME","LAST_NAME","COACH_NAME",
    "COACH_CODE","IS_ASSISTANT","COACH_TYPE","SCHOOL","SORT_SEQUENCE"]

    """
    endpoint = 'http://stats.nba.com/stats/commonteamroster'
    payload = {
        "TeamID": team_id,
        "LeagueID": "00",
        "Season": utils.cleanse_season(season)
    }
    response = utils.get_response(endpoint, payload)
    return response['CommonTeamRoster']
Beispiel #60
0
def team_roster(team_id, season):
    """
    return players on a team (only current players if this season)
    args:
        team_id (int)
        season: format ex: '1999-00', also accepts 1999 or 99
    returns:
        players (list): players on roster

    each player is a dict with the following available keys
    ["TeamID","SEASON","LeagueID","PLAYER","NUM","POSITION","HEIGHT",
    "WEIGHT","BIRTH_DATE","AGE","EXP","SCHOOL","PLAYER_ID"]

    """
    endpoint = 'http://stats.nba.com/stats/commonteamroster'
    payload = {
        "TeamID": team_id,
        "LeagueID": "00",
        "Season": utils.cleanse_season(season)
    }
    response = utils.get_response(endpoint, payload)
    return response['CommonTeamRoster']