All Projects → amosbastian → FPLbot

amosbastian / FPLbot

Licence: MIT license
A bot made for /r/FantasyPL

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to FPLbot

fplscrapR
This package enables those interested in Fantasy Premier League to perform detailed data analysis of the game, using the FPL's JSON API. The fplscrapR functions help R users collect and parse data from the Official Fantasy Premier League website.
Stars: ✭ 64 (+18.52%)
Mutual labels:  fantasy-football, football, fpl, fantasy-premier-league
fantasy-premier-league
Fantasy Premier League Stats, Visualizations & Analysis. ⚽ 📊 📈
Stars: ✭ 31 (-42.59%)
Mutual labels:  football, fpl, fantasy-premier-league
fplbot
🤖 Chatbot for Fantasy Premier League (Slack/Discord)
Stars: ✭ 14 (-74.07%)
Mutual labels:  fpl, fantasy-premier-league
league-page
Create a custom league page for your Sleeper fantasy football league!
Stars: ✭ 52 (-3.7%)
Mutual labels:  fantasy-football, football
FantasyPremierLeague.py
⚽ Statistics for your mini leagues.
Stars: ✭ 123 (+127.78%)
Mutual labels:  fantasy-football, fantasy-premier-league
ff
A fantasy football draft assistant with projections from ESPN, CBS, and NFL
Stars: ✭ 30 (-44.44%)
Mutual labels:  fantasy-football, football
fantasy-tools
A suite of tools for fantasy football players
Stars: ✭ 37 (-31.48%)
Mutual labels:  fantasy-football, football
espana
Free open public domain football data (football.db) for España (Spain) / Europe - Primera División / La Liga, etc.
Stars: ✭ 64 (+18.52%)
Mutual labels:  football
understatr
fetch understat data
Stars: ✭ 72 (+33.33%)
Mutual labels:  football
Football-Analytics-With-Python
A repository for football analytics
Stars: ✭ 28 (-48.15%)
Mutual labels:  football
football-peek
[JavaScript - NodeJS] Application to access football scores
Stars: ✭ 14 (-74.07%)
Mutual labels:  football
Football Prediction Project
This project will pull past game data from api-football, and use these statistics to predict the outcome of future premier league matches through machine learning.
Stars: ✭ 44 (-18.52%)
Mutual labels:  football
fpl-optimiser
Optimise FPL squads
Stars: ✭ 50 (-7.41%)
Mutual labels:  fantasy-premier-league
sports.py
A simple Python package to gather live sports scores
Stars: ✭ 51 (-5.56%)
Mutual labels:  football
fflproject
Fantasy Football League Project
Stars: ✭ 32 (-40.74%)
Mutual labels:  fantasy-football
sportyR
R package for drawing regulation playing surfaces for several sports
Stars: ✭ 84 (+55.56%)
Mutual labels:  football
react-native-football
React Native Premier League Football App ⚽ 👟🏆🏅
Stars: ✭ 61 (+12.96%)
Mutual labels:  football
ffscrapr
R API Client for Fantasy Football League Platforms
Stars: ✭ 55 (+1.85%)
Mutual labels:  fantasy-football
soccer-bookmaker-odds
Historical data of bookmaker odds for some of the major soccer European leagues.
Stars: ✭ 16 (-70.37%)
Mutual labels:  football
livescore-cli
commandline football (soccer) livescore and *news for linux/mac user
Stars: ✭ 63 (+16.67%)
Mutual labels:  football

FPLbot

FPLbot is a bot made for the subreddit /r/FantasyPL. It can also be used for other subreddits by changing the values in the configuration file.

Its current features are:

  • Posting the price changes of Fantasy Premier League players
  • Comparing the performance of a player vs. a team
  • Comparing the performance of a player vs. another player

Installation

FPLbot uses MongoDB to store players in a database, and so it is required to have MongoDB installed. Other than that, it uses fpl to retrieve information from Fantasy Premier League's API, and thus requires Python 3.6+.

git clone [email protected]:amosbastian/FPLbot.git
cd FPLbot
pip install -r requirements.txt

To initialise the database with text indexes you should do the following:

python FPLbot/init.py

Once this has been done, you should create your own config.json with the correct values (see configuration). With this filled in, you can run the bot using

python FPLbot/bot.py

As for the price changes, you should schedule a cron job, like this for example:

25 1 * * * /home/amos/FPLbot/venv/bin/python /home/amos/FPLbot/FPLbot/price_changes.py

Usage

The bot can be called on /r/FantasyPL using the following two commands:

  1. !fplbot <player_name> vs. <team_name> <optional: number of fixtures>
  2. !fplbot <player_name> vs. <player_name> <optional: number of fixtures>

The bot uses text indexes to search for the player(s) and using a manually created mapping (so you don't have to use e.g. "man utd" exactly, but other variations are fine as well, like "man u" or "manchester united"). The number of fixtures is completely optional, and if not specified, it simply uses all fixtures that are considered relevant. All the data is taken from FPL's API & Understat. Here are two examples:

!fplbot heung-min son vs. mane 5

Son (£8.9) vs. Mané (£9.6) (last 5 fixtures)

xA A xG G MP Fixture Fixture MP G xG A xA
0.13 0 0.42 1 90 Spurs 3-1 Leicester Liverpool 3-0 Bournemouth 89 1 0.58 0 0.12
0.70 0 0.19 1 90 Spurs 1-0 Newcastle United West Ham 1-1 Liverpool 90 1 0.64 0 0.00
0.00 0 0.20 1 90 Spurs 2-1 Watford Liverpool 1-1 Leicester 90 1 0.18 0 0.10
0.38 0 0.05 0 90 Spurs 0-1 Man Utd Liverpool 4-3 Crystal Palace 90 1 0.47 0 0.01
0.08 1 0.50 1 77 Cardiff 0-3 Spurs Brighton 0-1 Liverpool 90 0 0.10 0 0.10
1.29 1 1.36 4 437 449 4 1.97 0 0.34

!fplbot rashford vs. liverpool

Rashford vs. Liverpool (last 4 fixtures)

Fixture Date MP G xG A xA NPG NPxG KP
Liverpool 3-1 Man Utd 2018-12-16 90 0 0.02 0 0.00 0 0.02 0
Man Utd 2-1 Liverpool 2018-03-10 72 2 0.17 0 0.00 2 0.17 0
Liverpool 0-0 Man Utd 2017-10-14 24 0 0.00 0 0.00 0 0.00 0
Liverpool 0-0 Man Utd 2016-10-17 78 0 0.00 0 0.00 0 0.00 0
264 2 0.19 0 0.00 2.0 0.19 0

Configuration

Option Value
USERNAME The bot's username
PASSWORD The bot's password
CLIENT_ID The bot's client ID
CLIENT_SECRET The bot's client secret
USER_AGENT A unique identifier that helps Reddit determine the source of network requests
SUBREDDIT The subreddit the bot will post to
BOT_PREFIX The prefix used to call the bot, e.g.: "!fplbot"

For more information about how to set up a bot see Reddit's guide.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].