This code generates a pseudo-random team for the Fantasy Premier League It makes use of the FPL API to generate a team removing all the players who are injured or suspended and mazimising the total amount of money spent.
In the latest version it also allows to remove specific players, for example I found useful to see the algorithm response applying a veto on Haaland at the end of the 2023-2024 season, when it was considered a big risk!
Generate FPL team locally
Setup
python -m venv .venv && source .venv/bin/activate
pip install .
Run
randomfpl
Team of the day!
Team generated on 2025-08-20
Total expense is 93.7 out of a total budget of 100
Player | Price | Goals | Goals/90mins | Assists | Assists/90mins | Goals Conceded | Goals Conc/90mins |
---|---|---|---|---|---|---|---|
Aït-Nouri | 6.0 | 0 | 0.0 | 0 | 0.0 | 0 | 0.0 |
Shaw | 4.5 | 0 | 0.0 | 0 | 0.0 | 1 | 1.14 |
Ballard | 4.6 | 1 | 1.0 | 0 | 0.0 | 0 | 0.0 |
Andersen | 4.5 | 0 | 0.0 | 0 | 0.0 | 1 | 1.0 |
Calafiori | 5.5 | 1 | 1.27 | 0 | 0.0 | 0 | 0.0 |
Rogers | 7.0 | 0 | 0.0 | 0 | 0.0 | 0 | 0.0 |
Wharton | 5.0 | 0 | 0.0 | 0 | 0.0 | 0 | 0.0 |
Bobb | 5.5 | 0 | 0.0 | 1 | 1.0 | 0 | 0.0 |
Hughes | 5.0 | 0 | 0.0 | 0 | 0.0 | 0 | 0.0 |
Haaland | 14.0 | 2 | 2.5 | 0 | 0.0 | 0 | 0.0 |
Strand Larsen | 6.5 | 0 | 0.0 | 0 | 0.0 | 4 | 4.44 |
Ekitiké | 8.6 | 1 | 1.27 | 1 | 1.27 | 1 | 1.27 |
Georginio | 6.0 | 0 | 0.0 | 1 | 1.32 | 0 | 0.0 |
A.Becker | 5.5 | 0 | 0.0 | 0 | 0.0 | 2 | 2.0 |
Raya | 5.5 | 0 | 0.0 | 0 | 0.0 | 0 | 0.0 |