core
core
¶
Matchweek
dataclass
¶
Matchweek(
gameweek: int,
date: datetime,
fixtures: list[dict],
team_difficulty: dict[str, float],
)
Represents a matchweek with global context.
| ATTRIBUTE | DESCRIPTION |
|---|---|
gameweek |
Gameweek number
TYPE:
|
date |
Date of the gameweek
TYPE:
|
fixtures |
List of fixtures
TYPE:
|
team_difficulty |
Team-level difficulty ratings
TYPE:
|
Player
dataclass
¶
Player(
id: int,
name: str,
team: str,
position: str,
price: float,
timeseries: DataFrame,
news: Optional[dict] = None,
)
Represents a Fantasy Premier League player.
| ATTRIBUTE | DESCRIPTION |
|---|---|
id |
Unique player identifier
TYPE:
|
name |
Player full name
TYPE:
|
team |
Current team
TYPE:
|
position |
Position (GK, DEF, MID, FWD)
TYPE:
|
price |
Current price in FPL
TYPE:
|
timeseries |
Historical stats (points, xG, minutes, etc.)
TYPE:
|
news |
Latest news/injury information
TYPE:
|
FullSquad
dataclass
¶
FullSquad(
squad_players: list[Player],
lineup: Squad,
bench: list[Player] = list(),
squad_cost: float = 0.0,
expected_points: float = 0.0,
)
Represents a 15-player FPL squad with a selected 11-player lineup.
The two-level FPL structure: Level 1: 15-player squad (2 GK, 5 DEF, 5 MID, 3 FWD) under budget. Level 2: 11-player starting lineup chosen from the squad each gameweek.
| ATTRIBUTE | DESCRIPTION |
|---|---|
squad_players |
All 15 squad members.
TYPE:
|
lineup |
The 11-player starting lineup (subset of squad_players).
TYPE:
|
bench |
The 4 bench players.
TYPE:
|
squad_cost |
Total cost of all 15 players.
TYPE:
|
expected_points |
Expected points for the starting 11.
TYPE:
|
summary
¶
Returns a formatted string summary of the full squad.
Source code in fplx/core/squad.py
Squad
dataclass
¶
Squad(
players: list[Player],
formation: str,
total_cost: float,
expected_points: float,
captain: Optional[Player] = None,
)
Represents an 11-player starting lineup.
| ATTRIBUTE | DESCRIPTION |
|---|---|
players |
Selected starters (exactly 11).
TYPE:
|
formation |
Formation string (e.g., "3-4-3").
TYPE:
|
total_cost |
Total cost of the starting 11.
TYPE:
|
expected_points |
Expected total points for the starting 11.
TYPE:
|
captain |
Captain selection (earns double points).
TYPE:
|
summary
¶
Returns a formatted string summary of the lineup.