{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Wing Back\n", "\n", "> Testing team strength models in Python" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Because it's backtesting... gettit? Wing _back_? ... Yeah, I'll show myself out." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Usage\n", "\n", "### Initial setup\n", "\n", "This project is built on top of [`understat-db`](https://github.com/Torvaney/understat-db). The initial setup is the same.\n", "\n", "The simplest way to get started is to populate a local database with `docker-compose`.\n", "\n", "First, clone the repository:\n", "\n", "```bash\n", "git clone https://github.com/Torvaney/understat-db.git\n", "cd understat-db\n", "```\n", "\n", "Then, setup the local environment\n", "\n", "```bash\n", "make env # Create a virtualenv and installs the project & dependencies\n", "source venv/bin/activate # Activate the virtualenv\n", "cp .env.sample .env # Copy default environment vars to .env\n", "```\n", "\n", "Run the database\n", "\n", "```bash\n", "docker-compose up -d db # Start a postgres database within a docker container\n", "wingback migrate # Create base database tables\n", "```\n", "\n", "Finally, import the data you want\n", "\n", "```bash\n", "wingback ingest --leagues EPL --seasons 2020\n", "```\n", "\n", "### Backtesting\n", "\n", "The xG-based models require match simulations to be present in the database. You can generate these with the `resimulate` command:\n", "\n", "```bash\n", "wingback resimulate --leagues EPL --seasons 2020\n", "```\n", "\n", "Finally, to backtest the models, you can use the `backtest` command:\n", "\n", "```bash\n", "wingback backtest --league EPL --start-date 2021-01-01\n", "```\n", "\n", "Note that the full suite of models is very large (see `wingback backtest --help`) and takes a long time to run. You can select specific models using the `--models` flag.\n", "\n", "## Requirements\n", "\n", "To run this project you will need:\n", "\n", "* Python 3.6+\n", "* Docker\n", "\n", "\n", "## Contributing\n", "\n", "Pull requests are encouraged! For major changes, please open an issue first to discuss what you would like to change.\n", "\n", "## License\n", "\n", "[MIT](https://choosealicense.com/licenses/mit/)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" } }, "nbformat": 4, "nbformat_minor": 2 }