https://github.com/torvaney/wingback
Backtesting team-strength models
https://github.com/torvaney/wingback
Last synced: about 1 year ago
JSON representation
Backtesting team-strength models
- Host: GitHub
- URL: https://github.com/torvaney/wingback
- Owner: Torvaney
- License: mit
- Created: 2021-05-15T10:40:03.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-06-02T21:55:44.000Z (about 2 years ago)
- Last Synced: 2025-04-06T17:06:45.327Z (about 1 year ago)
- Language: Python
- Size: 1.41 MB
- Stars: 16
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Wing Back
> Testing team strength models in Python
Because it's backtesting... gettit? Wing _back_? ... Yeah, I'll show myself out.
## Usage
### Initial setup
This project is built on top of [`understat-db`](https://github.com/Torvaney/understat-db). The initial setup is the same.
The simplest way to get started is to populate a local database with `docker-compose`.
First, clone the repository:
```bash
git clone https://github.com/Torvaney/wingback.git
cd wingback
```
Then, setup the local environment
```bash
make env # Create a virtualenv and installs the project & dependencies
source venv/bin/activate # Activate the virtualenv
cp .env.sample .env # Copy default environment vars to .env
```
Run the database
```bash
docker-compose up -d db # Start a postgres database within a docker container
wingback migrate # Create base database tables
```
Finally, import the data you want
```bash
wingback ingest --leagues EPL --seasons 2020
```
### Backtesting
The xG-based models require match simulations to be present in the database. You can generate these with the `resimulate` command:
```bash
wingback resimulate --leagues EPL --seasons 2020
```
Finally, to backtest the models, you can use the `backtest` command:
```bash
wingback backtest --league EPL --start-date 2021-01-01
```
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.
## Requirements
To run this project you will need:
* Python 3.6+
* Docker
## Contributing
Pull requests are encouraged! For major changes, please open an issue first to discuss what you would like to change.
## License
[MIT](https://choosealicense.com/licenses/mit/)