yfpy.models.Team

class Team(extracted_data)[source]

Bases: yfpy.models.YahooFantasyObject

Model class for “team” data key.

Instantiate the Team child class of YahooFantasyObject.

Parameters

extracted_data (dict) – Parsed and cleaned JSON data retrieved from the Yahoo Fantasy Sports REST API.

clinched_playoffs

Numeric boolean (0 or 1) representing if the team has clinched a playoff berth.

Type

int

division_id

The unique ID number of the division containing the team (if applicable).

Type

str

draft_grade

The letter grade assigned to the draft completed by the team (“A+”, “A”, …, “F-“).

Type

str

draft_position

The draft order/position of the team.

Type

int

draft_recap_url

The direct URL of the draft recap for the team.

Type

str

draft_results

A list of YFPY DraftResult instances.

Type

list[DraftResult]

faab_balance

The available balance of FAAB (Free Agent Acquisition Budget) (if applicable).

Type

int

has_draft_grade

Numeric boolean (0 or 1) representing if the team has a draft grade available.

Type

int

league_scoring_type

Value designating the type of scoring used by the league (“head” for head-to-head, etc.).

Type

str

managers

A list or dict (depending on source data) of YFPY Manager instances.

Type

list[Manager] | dict[str, Manager]

matchups

A list of YFPY Matchup instances.

Type

list[Matchup]

name

The team name.

Type

str

number_of_moves

The number of moves made by the team (adds/drops/trades/etc.).

Type

int

number_of_trades

The number of trades made by the team.

Type

int

roster

A YFPY Roster instance.

Type

Roster

players

A list of YFPY Player instances.

Type

list[Player]

roster_adds

A YFPY RosterAdds instance.

Type

RosterAdds

roster_adds_value

The number of roster adds made by the team.

Type

int

team_id

The unique team ID in the league.

Type

int

team_key

The Yahoo team key.

Type

str

team_logos

A list of YFPY TeamLogo instances.

Type

list[TeamLogo]

team_points

A YFPY TeamPoints instance.

Type

TeamPoints

points

The total points scored by the team.

Type

float

team_projected_points

A YFPY TeamProjectedPoints instance.

Type

TeamProjectedPoints

projected_points

The total projected points for the team.

Type

float

team_standings

A YFPY TeamStandings instance.

Type

TeamStandings

wins

The number of wins by the team.

Type

int

losses

The number of losses by the team.

Type

int

ties

The number of ties by the team.

Type

int

percentage

The win percentage of the team.

Type

float

playoff_seed

The playoff seed of the team.

Type

int

points_against

The total team points against.

Type

float

points_for

The total team points for.

Type

float

rank

The rank of the team in the league standings.

Type

int

streak_type

The active team win/loss/tie streak.

Type

str

streak_length

The length of the streak.

Type

int

url

The direct URL to the team.

Type

str

waiver_priority

The waiver priority of the team.

Type

int

win_probability

The active win probability of the team in its current matchup (ranges from 0.0 to 1.0).

Type

float

Methods

clean_data_dict

Recursive method to un-type custom class type objects for serialization.

from_json

Deserialize JSON to a class object.

serialized

Pack up all object content into nested dictionaries for JSON serialization.

subclass_dict

Derive snake case dictionary keys from custom object type camel case class names.

to_json

Serialize the class object to JSON.

clean_data_dict()

Recursive method to un-type custom class type objects for serialization.

Returns

Dictionary that extracts serializable data from custom objects.

Return type

dict

classmethod from_json(json_data)

Deserialize JSON to a class object.

Returns

Class object derived from JSON data.

Return type

object

serialized()

Pack up all object content into nested dictionaries for JSON serialization.

Returns

Serializable dictionary.

Return type

dict

subclass_dict()

Derive snake case dictionary keys from custom object type camel case class names.

Returns

Dictionary with snake case strings of all subclasses of YahooFantasyObject as keys and subclasses as values.

Return type

dict

to_json()

Serialize the class object to JSON.

Returns

JSON string derived from the serializable version of the class object.

Return type

str