-
Notifications
You must be signed in to change notification settings - Fork 225
Basketball Intro
Christian Wendt edited this page Feb 10, 2021
·
4 revisions
Intro to the Fantasy Basketball Interface
Below are examples of some of the features espn_api has to offer! For more in depth details about each class check out the API links on the right!
>>> league.teams
[Team(Team 1), Team(Team 2), Team(FANTASY GOD), Team(THE KING), Team(Team 5), Team(Team Viking Queen), Team(Team 7), Team(Team 8), Team(Team Mizrachi), Team(Team 10)]
>>> team = league.teams[0]
>>> team.roster
[Player(Damian Lillard), Player(Russell Westbrook), Player(Jimmy Butler), Player(Bam Adebayo), Player(T.J. Warren), Player(Mitchell Robinson), Player(John Wall), Player(LaMarcus Aldridge),
Player(Tyrese Haliburton), Player(Mason Plumlee), Player(Ivica Zubac), Player(Otto Porter Jr.), Player(Killian Hayes)]
>>> team.wins
10
>>> team.losses
3
>>> team.final_standing
4
>>> team.team_name
'Team 1'
>>> team = league.teams[0]
>>> player = team.roster[0]
>>> player
Player(Damian Lillard)
>>> player.name
'Damian Lillard'
>>> player.playerId
6606
>>> player.position
'PG'
>>> player.proTeam
'POR'
>>> player.eligibleSlots
['PG', 'G', 'G/F', 'UT', 'BE', 'IR']
>>> player.acquisitionType
'DRAFT'
>>> league.scoreboard()
[Matchup(Team(Team 8), Team(THE KING)), Matchup(Team(Team 7), Team(Team 1)), Matchup(Team(Team 2), Team(Team Viking Queen)), Matchup(Team(Team Mizrachi), Team(FANTASY GOD)), Matchup(Team(Team 10), Team(Team 5))]
>>> week = 3
>>> matchups = league.scoreboard(week)
>>> matchups[0].home_score
89.2
>>> matchups[0].away_score
88.62
>>> matchups
[Matchup(Team(Team 1), Team(Team 10)), Matchup(Team(FANTASY GOD), Team(THE KING)), Matchup(Team(Team 7), Team(Team Viking Queen)), Matchup(Team(Team 5), Team(Team 2)), Matchup(Team(Team Mizrachi), Team(Team 8))]
>>> matchups[0].home_team
Team(Team 1)
>>> matchups[0].away_team
Team(Team 10)