Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

fantasy-f1-analyzer

markSmurphy29MIT1.4.1

A command line utility which retrieves the latest Fantasy F1 results and analyses all possible constructor and driver combinations and suggests an optimum Fantasy F1 Team.

Fantasy, F1, Analyzer, Analyser, Formula 1, Driver, Constructor, Team, FF1

readme

Fantasy F1 Analyser

Version node-current Codacy Badge GitHub issues Snyk Vulnerabilities for GitHub Repo Libraries.io dependency status for latest release NPM Downloads Total NPM Downloads/Month Last Commit Licence

A command line utility which retrieves the latest Fantasy F1 results and analyses all possible constructor and driver combinations and suggests an optimum Fantasy F1 Team. FF1 Analyser

Overview

I started playing Fantasy F1 for the first time this season (2022) and, like most players, I'd juggle my team around before each race weekend's qualifying session. There were a few obvious front-runners but the rest of my team selection lacked any satisfactory analysis, and instead was borne from drivers I'd like to see do well who fell inside the budget cap restrictions.

So I wrote this tool.

The Fantasy F1 Analyser consumes the Fantasy F1 League's public APIs to retrieve the latest driver & constructor standings. It then works through >150,000 permutations of possible Fantasy F1 teams and tallies their score. The team combination(s) with the highest points tally to date (and which falls with the budget cap) are reported back.

If multiple team combinations result the same highest points tally then they are all reported back. The current qualifying and finishing streaks are also reported in case that helps your selection.

FF1 Analyser - Running

Disclaimer

This tool is not affiliated with the Fantasy F1 League. It is a personal project I've open sourced. This tool is not a predictor; it uses historical data to retrospectively suggest what would have been a optimal team selection to this point, and is intended for use a baseline for your own team selection.

Installation

Install globally via npm using:

npm install -g fantasy-f1-analyzer

Usage

Start an analysis via the command:

ff1 [options]

Options

There are a few command line options you can use:

   --export <filename>           Exports the results to the specified filename
   --year <nnnn>                 Override the default season. Default: 2022
   --budget <nnn>                Override the default budget cap. Default: 100
   --worst                       Displays the team with the worst points tally instead of the best
   --progressinterval <n>        Update analysis progress every nth team. Default: 5
   --verbose                     Enables verbose output.
   --debug                       Enables debugging output.
   --no-color                    Switches off colour output.
   --version                     Display version number.
   --help                        Display help screen.

export

--export <filename>

The export option allows you write the results to the specific filename. The output format the CSV and filename will be automatically appended with .csv if needed.

year

--year <nnnn>

Specifies the season's year in case there's a need to override the default.

Default: The current date's four digit year (e.g. 2022).

budget

--budget <nnn>

Specifies the budget cap in case there's a need to override the default.

Default: 100.

worst

--worst displays the Fantasy F1 team with the worst points tally, instead of displaying the best. This might be more interesting than actually useful.

worst team output

progress interval

--progressinterval <n>

Update the analysis progress spinner every nth team that's analysed. The higher the number n, the less frequently the screen is updated and the faster the analysis completes.

Default: 5 (updates progress spinner for each team that's analysed).

Verbose

--verbose

Enables verbose output.

Default: false

Debug

--debug

Enables debugging output.

Default: false

No-color

--no-color

Switches off colour output.

Version

--version

Displays the version number.

Help

--help

Displays the help screen.

Change Log

The Change Log can be found here

changelog

Change Log

v1.4.1 - 17th September 2022

  • Updated dependencies.
  • Implemented Rome linter suggestions.
  • Added validation of API response (some JSON fields in fantasy-api.formula1.com changed from number to string) rendering season_score & price unusable, which I suspect was the purpose).

v1.4.0 - 18th June 2022

  • Added an option to export the results to a CSV file.

v1.3.1 - 15th June 2022

Bug Fix

  • The initial list of drivers, in descending points order, now includes the last (20th) placed driver.

v1.3.0 - 7th June 2022

  • Added a right-aligned count of the number of teams analysed so far to the progress spinner text.
  • Fixed an issue where --verbose didn't display the analysis statistics.
  • Added the argument --worst to display the team with the worst points tally instead.

worst team output


v1.2.0 - 5th June 2022

  • Added the common points tally when there's two or more optimal teams.

common point tally

  • Updated screenshots to reflect latest output.

v1.1.0 - 4th June 2022

  • Improved Fantasy F1 API error handling.
  • Added the argument --year to override the default season.
  • Added the argument --budget to override the default budget cap.
  • Added the argument --progressinterval to change how frequently the screen progress spinner is updated.
  • Changed the progressinterval to 5 so that the running time is reduced by default.
  • Renamed the Streak output column headings for greater clarity.

v1.0.1 - 3rd June 2022

  • Fixed a couple badge URLs in README.

v1.0.0 - 1st June 2022

Initial release.