Posts about fantasyformula1

Fantasy Formula 1

I'm a huge fan of Formula 1 racing.

For the past few seasons myself and my other F1 loving friends have taken part in F1 Fantasy Leagues. The problem is that they've come and gone and each seemed to have a variety of issues; generally around the scoring or transfer systems.

During the current 2015 season I decided that I wanted to take a stab at creating a system to use for next years season. A personal project with a deadline! Oh my.

The objective is to create a system which the players have to balance two goals:

1) increase their teams bankroll
2) have their selected drivers earn as many championship points as possible

To explain the bankroll idea; at the start of the season each player will be given X millions of in-game dollars. Up until qualifying of each race weekend players are able to select the two drivers who will make up their team for the weekend. After the race the value of each driver is re-evaluated based on their performance in qualifying and the race (with qualifying result having a lesser weight).

The resulting value of the player's selected drivers (in addition to any left over money from their bankroll) becomes the player's new bankroll going into the next race weekend.

Secondary to simply trying to predict which drivers are currently under valued the players will need to be selecting drivers who will be scoring points in the Formula 1 drivers championship.

It will be the combination of these two goals which the players will need to balance. Do you select drivers who you think have the best chance of gaining in value, even though they may not be winning big championship points?

I've already made progress on the system I'll use to collect results and the logic behind updating driver values.

Here's an example (the change column displays the change in driver value from the most recent round at Silverstone):

Driver TLA # Initial Current Change
Lewis Hamilton HAM 44 50.00 48.04 0.29
Nico Rosberg ROS 6 48.00 44.85 -0.23
Sebastian Vettel VET 5 40.00 34.69 -0.94
Kimi Räikkönen RAI 7 35.00 26.84 -0.79
Valtteri Bottas BOT 77 31.00 26.41 0.08
Felipe Massa MAS 19 30.00 24.79 0.74
Daniel Ricciardo RIC 3 25.00 20.49 -0.24
Romain Grosjean GRO 8 24.00 19.27 -0.27
Daniil Kvyat KVY 26 15.00 18.55 0.49
Pastor Maldonado MAL 13 20.00 16.87 -0.26
Carlos Sainz SAI 55 16.00 16.47 0.26
Max Verstappen VES 33 15.00 16.05 -0.07
Felipe Nasr NAS 12 15.00 14.66 -0.23
Nico Hulkenberg HUL 27 2.50 14.07 0.80
Sergio Perez PER 11 2.50 13.14 0.39
Marcus Ericsson ERI 9 13.00 12.89 -0.27
Fernando Alonso ALO 14 3.50 10.31 0.08
Jenson Button BUT 22 3.00 8.22 -0.16
Kevin Magnussen MAG 20 3.00 2.03 0
Will Stevens STE 28 1.00 1.12 -0.15
Roberto Merhi MER 98 1.00 0.62 0.03

I'm still tweaking the value logic, as it appears that it is rewarding the lower drivers too much and punishing the higher drivers too hard. I'm already exempting drivers from having their value adjusted after a DNF.

With the basics of the backend up and running my initial instinct was to put together a simple php based web front end for the users to manage their teams and display the results. However it dawned on me that this is the perfect opportunity to mess around with Flask; a python based web framework. I've had this on my radar for a while now and it seemed silly to switch languages between front and backend, when I'm sure at some stage there will be code cross over.

My progress on this front has been pretty rapid. I've set up a dev environment;

  • An Ubuntu 14.04 server running in a VirtualBox VM

  • Postgres for the DB

  • I used Flask-Appbuilder to kickstart everything, very impressed

  • I've then built a which allowed me to get all the python modules required by the backend installed

Next up I'll get the backend running in this environment. I plan on hacking together a script which will take information from to build a schedule of cron jobs so the system will automatically collect the results after each race weekend. This weekend's Hungarian GP will be a great test of this.

Once I've got some data in my dev environment database I'll then work on setting up views to display the results of each round and the changes in values of the drivers.

After that it'll be done to working on the system the users will use to select drivers for each round. My idea is to allow users to make changes to their teams before every round (obviously limited by their current team bankroll). Then it'll be a matter of balancing how much each player has as an opening bankroll.