Skip to content

League Class

Christian Wendt edited this page Sep 28, 2019 · 18 revisions

Documentation of all Variables and usable functions for League Class

League

The League Object is used for getting all of your ESPN Fantasy data including settings, teams, roster, players, free agents, box scores/match ups, and power rankings.

Usage

from ff_espn_api import League
league = League(league_id: int, year: int, espn_s2: str = None, swid: str = None)

Links

Team Class, Pick Class, Settings Class

Variables

league_id: int
year: int
settings: Settings
teams: List[Team]
draft: List[Pick]
current_week: int # current fantasy football week
nfl_week: int # current nfl week

Functions

Returns basic information on a match up for a current week. This can be used for previous years

def scoreboard(week: int = None) -> List[Matchup]

Returns more specific information on week match ups and can only be used with current season

def box_scores(week: int = None) -> List[BoxScore]

Calculates week power rankings using two step dominance. Returns a list of tuples with first position being score and second the Team Class

def power_rankings(week: int=None) -> List[Tuples(str, Team)]

Returns a list of free agents
position inputs: 'QB', 'RB', 'WR', 'TE', 'D/ST', 'K', 'FLEX'

def free_agents(week: int = None, size: int = 50, position: str = None) -> List[BoxPlayer]:

Helper functions

def standings() -> List[Team]:
def top_scorer() -> Team:
def least_scorer() -> Team:
def most_points_against() -> Team:
def top_scored_week() -> Tuple(Team, int):
def least_scored_week() -> Tuple(Team, int):
def get_team_data(team_id: int) -> Team: