Skip to content

Data Types: Game

KCNilssen edited this page Dec 14, 2022 · 16 revisions

Usage that returns Game objects

To be added

Game Structure

Attributes are expandable and collapsable - Link to Game dataclass

gamepk : int
  • id number of this game
link : str
  • link to the api address for this game
copyright : str
  • MLB AM copyright information
metadata : MetaData
  • metaData of this game. Dataclass: MetaData
wait : int
  • No idea what this wait signifies
timestamp : str
  • The timeStamp
gameevents : List[str]
  • Current game events for this game
logicalevents : List[str]
  • Current logical events for this game
gamedata : GameData
  • gameData of this game. Dataclass: GameData
game : GameDataGame
pk : int
  • This game's game id
type : str
  • This game's game type code
doubleheader : str
  • Represents if this game is a double header or not
id : str
  • An unknown Id
gamedaytype : str
  • This game's gameday type code
tiebreaker : str
  • Is this game a tie breaker
gamenumber : int
  • The game number for this game. If double header will be 2.
calendareventid : str
  • The id for this calendar event
season : str
  • This game's season year
seasondisplay : str
  • This game's displayed season
datetime : GameDatetime
datetime : str
  • Date time for this game
originaldate : str
  • The original scheduled date for this game
officialdate : str
  • The current scheduled date for this game
daynight : str
  • The current lighting condition game type
time : str
  • The time
ampm : str
  • The games am or pm code
status : GameStatus
  • information on this game's status. Dataclass: GameStatus
abstractgamestate : str
  • The abstract game state
codedgamestate : str
  • The coded game state
detailedstate : str
  • The detailed game state
statuscode : str
  • Status code for this game
starttimetbd : bool
  • If the start time is TBD
abstractgamecode : str
  • The abstract game code
reason : str
  • reason for a state. Usually used for delays or cancellations
teams : GameTeams
  • Our two teams for this game, home and away. Dataclass: GameTeams
away : Team
  • Away team. Dataclass: Team
springleague : League
  • The spring league of the team. Dataclass: League
id : int
  • id number of the league
name : str
  • name of the league
link : str
  • link of the league
abbreviation : str
  • abbreviation the league
allstarstatus : str
  • The all status status of the team
id : int
  • id number of the team
name : str
  • name of the team
link : str
  • The API link for the team
season : str
  • The team's current season
venue : Venue
  • The team's home venue. Dataclass: Venue
id : int
  • id for this venue
name : str
  • Name for this venue
link : str
  • Link to venues endpoint
springvenue : Venue
  • The team's spring venue. Dataclass: Venue
id : int
  • id for this venue
link : str
  • Link to venues endpoint
teamcode : str
  • team code
filecode : str
  • filecode name of the team
abbreviation : str
  • The abbreviation of the team name
teamname : str
  • The team name
locationname : str
  • The location of the team
firstyearofplay : str
  • The first year the team began play
league : League
  • The league of the team. Dataclass: League
id : int
  • id number of the league
name : str
  • name of the league
link : str
  • link of the league
division : Division
  • The division the team is in. Dataclass: Division
id : int
  • id number of the divison
name : str
  • name of the division
link : str
  • link of the division
sport : Sport
  • The sport of the team. Dataclass: Sport
id : int
  • id number of the sport
name : str
  • name the sport
link : str
  • link of the sport
shortname : str
  • The shortname of the team
record : TeamRecord
gamesplayed : int
  • Number of game played by team
wildcardgamesback : str
  • Number of game back from wildcard
leaguegamesback : str
  • Number of league games back
springleaguegamesback : str
  • Number of game back in spring league
sportgamesback : str
  • Number of games back in sport
divisiongamesback : str
  • Number of games back in division
conferencegamesback : str
  • Number of games back in conference
leaguerecord : Dict
  • Record in league
records : Dict
  • Records
divisionleader : bool
  • Is this team a divison leader
wins : int
  • Number of wins
losses : int
  • Number of losses
winningpercentage : str
  • Winning percentage
franchisename : str
  • The franchisename of the team
clubname : str
  • The clubname of the team
active : str
  • Active status of the team
home : Team
  • Home team. Dataclass: Team
springleague : League
  • The spring league of the team. Dataclass: League
id : int
  • id number of the league
name : str
  • name of the league
link : str
  • link of the league
abbreviation : str
  • abbreviation the league
allstarstatus : str
  • The all status status of the team
id : int
  • id number of the team
name : str
  • name of the team
link : str
  • The API link for the team
season : str
  • The team's current season
venue : Venue
  • The team's home venue. Dataclass: Venue
id : int
  • id for this venue
name : str
  • Name for this venue
link : str
  • Link to venues endpoint
springvenue : Venue
  • The team's spring venue. Dataclass: Venue
id : int
  • id for this venue
link : str
  • Link to venues endpoint
teamcode : str
  • team code
filecode : str
  • filecode name of the team
abbreviation : str
  • The abbreviation of the team name
teamname : str
  • The team name
locationname : str
  • The location of the team
firstyearofplay : str
  • The first year the team began play
league : League
  • The league of the team. Dataclass: League
id : int
  • id number of the league
name : str
  • name of the league
link : str
  • link of the league
division : Division
  • The division the team is in. Dataclass: Division
id : int
  • id number of the divison
name : str
  • name of the division
link : str
  • link of the division
sport : Sport
  • The sport of the team. Dataclass: Sport
id : int
  • id number of the sport
name : str
  • name the sport
link : str
  • link of the sport
shortname : str
  • The shortname of the team
record : TeamRecord
gamesplayed : int
  • Number of game played by team
wildcardgamesback : str
  • Number of game back from wildcard
leaguegamesback : str
  • Number of league games back
springleaguegamesback : str
  • Number of game back in spring league
sportgamesback : str
  • Number of games back in sport
divisiongamesback : str
  • Number of games back in division
conferencegamesback : str
  • Number of games back in conference
leaguerecord : Dict
  • Record in league
records : Dict
  • Records
divisionleader : bool
  • Is this team a divison leader
wins : int
  • Number of wins
losses : int
  • Number of losses
winningpercentage : str
  • Winning percentage
franchisename : str
  • The franchisename of the team
clubname : str
  • The clubname of the team
active : str
  • Active status of the team
players : List[Person]
  • A list of all the players for this game. Dataclass: Person
id : int
  • id number of the person
full_name : str
  • full_name of the person
primaryposition : str
  • PrimaryPosition of the Person
pitchhand : str
  • PitchHand of the Person
batside : str
  • BatSide of the Person
fullname : str
  • full name of the Person
firstname : str
  • First name of the Person
lastname : str
  • Last name of the Person
primarynumber : str
  • Primary number of the Person
birthdate : str
  • Birth date of the Person
currentteam : str
  • The current Team of the Person
currentage : str
  • The current age of the Person
birthcity : str
  • The birthcity of the Person
birthstateprovince : str
  • The province of the birth state
height : str
  • The height of the Person
weight : str
  • The weight of the Person
active : str
  • The active status of the Person
usename : str
  • The use name of the Person
middlename : str
  • The middle name of the Person
boxscorename : str
  • The box score name of the Person
nickname : str
  • The nickname of the Person
draftyear : int
  • The draft year of the Person
mlbdebutdate : str
  • The MLB debut date of the Person
namefirstlast : str
  • The first and last name of the Person
nameslug : str
  • The name slug of the Person
firstlastname : str
  • The first and last name of the Person
lastfirstname : str
  • The last and first name of the Person
lastinitname : str
  • The last init name of the Person
initlastname : str
  • The init last name of the Person
fullfmlname : str
  • The full fml name of the Person
fulllfmname : str
  • The full lfm name of the Person
uselastname : str
  • The last name of the
birthcountry : str
  • The birth country of the Person
pronunciation : str
  • The pronuciation of the Person's name
strikezonetop : float
  • The strike zone top of the Person
strikezonebottom : float
  • The strike zone bottom of the Person
nametitle : str
  • The name title of the Person
gender : str
  • The gender of the Person
isplayer : bool
  • The player status of the Person
isverified : bool
  • The verification of the Person
namematrilineal : str
  • The name matrilineal of the Person
deathdate : str
  • The death date of the Person
deathcity : str
  • The death city of the Person
deathcountry : str
  • The death country of the Person
lastplayeddate : str
  • The last played date of the Person
namesuffix : str
  • The namesuffix of the Person
venue : GameVenue
  • Venue information for this game
officialvenue : Venue
  • The official venue for this game
weather : GameWeather
  • The weather for this game.
gameinfo : GameInfo
  • information on this game
review : GameReview
  • Game review info and team challenges
flags : GameFlags
  • Flag bools for this game
alerts : List[]
  • Alerts
probablepitchers : GameProbablePitchers
  • Home and away probable pitchers for this game
officialscorer : Person
  • The official scorer for this game
primarydatacaster : Person
  • The official dataCaster for this game
livedata : LiveData
  • liveData of this game

Example output from MLB stats api endpoint

Mlb stats api Query:

https://statsapi.mlb.com/api/v1.1/game/534196/feed/live

Equivelant with python-mlb-statsapi:

import mlbstatsapi

mlb = mlbstatsapi.Mlb()

mlb.get_game(game_id = 534196)

Clone this wiki locally