Skip to content

Data Types: Standings

KCNilssen edited this page Dec 16, 2022 · 3 revisions

Standings Structure

Attributes are expandable and collapsable - Link to Standings dataclass

standingstype : str
  • A string indicating the type of standings.
league : league
  • An object containing information about the league. Dataclass: League
id : int
  • id number of the league
link : str
  • link of the league
division : Division
  • An object containing information about the division. Dataclass: Sport
id : int
  • id number of the division
link : str
  • link of the divison
sport : Sport
  • An object containing information about the sport. Dataclass: Sport
id : int
  • id number of the sport
link : str
  • link of the sport
lastupdated : str
  • A string indicating the last time the standing was updated.
teamrecords : List[Teamrecords]
  • A list of Teamrecord objects containing the data for the teams standings. Dataclass: Teamrecords
team: Team
  • The team for which the data belongs to. Dataclass: Team
id : int
  • id number of the team
name : str
  • name of the team
link : str
  • The API link for the team
season: int
  • The season for which the data belongs to.
streak: Streak
  • The streak of the team. Dataclass: Streak
streaktype : str
  • Steak type
streaknumber : int
  • Streak number
streakcode : str
  • Steak code
divisionrank: str
  • The rank of the team in their division.
leaguerank: str
  • The rank of the team in their league.
sportrank: str
  • The rank of the team in their sport.
gamesplayed: int
  • The number of games played by the team.
gamesback: str
  • The number of games behind the leader in the division.
wildcardgamesback: str
  • The number of games behind the leader in the wild card race.
leaguegamesback: str
  • The number of games behind the leader in the league.
springleaguegamesback: str
  • The number of games behind the leader in the spring league.
sportgamesback: str
  • The number of games behind the leader in the sport.
divisiongamesback: str
  • The number of games behind the leader in the division.
conferencegamesback: str
  • The number of games behind the leader in the conference.
leaguerecord: OverallleagueRecord
wins : int
  • Overall number of wins in league
losses : int
  • Overall number of losses in league
pct : str
  • Overall percentage in league
lastupdated: str
  • The date when the data was last updated.
records: Records
  • The records of the team. Dataclass: Records
splitrecords : Typerecords
wins : int
  • Number of wins in type
losses : int
  • Number of losses in type
pct : str
  • Percentage in type
type : str
  • Type of record
divisionrecords : Divisionrecords
wins : int
  • Number of wins in division
losses : int
  • Number of losses in division
pct : str
  • Percentage in division
division : Divison
id : int
  • id number of the divison
name : str
  • name of the division
link : str
  • link of the division
overallrecords : Typerecords
wins : int
  • Number of wins in type
losses : int
  • Number of losses in type
pct : str
  • Percentage in type
type : str
  • Type of record
leaguerecords : Leaguerecords
wins : int
  • Number of wins in league
losses : int
  • Number of losses in league
pct : str
  • Percentage in league
league : League
id : int
  • id number of the league
name : str
  • name of the league
link : str
  • link of the league
expectedrecords : Typerecords
wins : int
  • Number of wins in type
losses : int
  • Number of losses in type
pct : str
  • Percentage in type
type : str
  • Type of record
runsallowed: int
  • The number of runs allowed by the team.
runsscored: int
  • The number of runs scored by the team.
divisionchamp: bool
  • A flag indicating whether the team is the division champion.
divisionleader: bool
  • A flag indicating whether the team is the leader in their division.
haswildcard: bool
  • A flag indicating whether the team has a wild card spot.
clinched: bool
  • A flag indicating whether the team has clinched a spot in the playoffs.
eliminationnumber: str
  • The number of games the team needs to win or the number of games their opponents need to lose in order to be eliminated from playoff contention.
wildcardeliminationnumber: str
  • The number of games the team needs to win or the number of games their opponents need to lose in order to be eliminated from wild card contention.
wins: int
  • The number of wins of the team.
losses: int
  • The number of losses of the team.
rundifferential: int
  • The run differential of the team (runs scored minus runs allowed).
winningpercentage: str
  • The winning percentage of the team.
wildcardrank: str
  • The rank of the team in the wild card race.
wildcardleader: bool
  • A flag indicating whether the team is the leader in the wild card race.
magicnumber: str
  • The number of games the team needs to win or the number of games their opponents need to lose in order to clinch a spot in the playoffs.
clinchindicator: str
  • Clinch indicator.

Usage that returns Standings objects

get_standings

Description: Return

Parameters:

Name Type Required Description Default
league_id string/int Yes Insert leagueId to return all standings based on a particular standingType for a specific league.
season string Yes Insert year to return all standings based on a particular year.

Other Parameters:

Name Type Required Description Default
standingsTypes string No Insert standingType to return all standings based on a particular year. Find standingTypes at https://statsapi.mlb.com/api/v1/standingsTypes
date string Yes Insert date to return standing information for on a particular date. Format: MM/DD/YYYY

Example output from MLB stats api endpoint

Mlb stats api Query:

https://statsapi.mlb.com/api/v1/standings?leagueId=103&season=2018

Equivelant with python-mlb-statsapi:

import mlbstatsapi

mlb = mlbstatsapi.Mlb()

mlb.get_standings(league_id = 103, season = 2018)