CME Margin: download margins from the CME Group Outrights/Vol Scans for Margins website.
Quick Start
Make sure you have Docker installed and set up on your machine before following these instructions. If you don't already have Docker installed, follow the official install instructions for macOS, Windows or Linux.
Usage demo:
- Open a terminal or Windows PowerShell.
- Run below snippet to create or update an existing margin file.
# Pull latest docker image
docker pull volemont/cme_margin:latest
# Run docker container, download margin and write to cme_margin.csv
docker run --rm -v ${PWD}:/data volemont/cme_margin:latest /data/cme_margin.csv
Development
The project uses the following features to facilitate the development workflow:
- Import sorting with isort.
- Formatting with black.
- Linting with flake8.
- Static typing with mypy.
- Testing with pytest.
- Git hooks that run all the above with pre-commit.
- Deployment ready with Docker.
- Continuous Integration with GitHub Actions.
Prerequisites
You need Python 3.7 or later. You can have multiple Python versions installed on the same system. In Debian derivatives you can install Python 3 like this:
sudo apt-get install python3 python3-pip
For other Linux flavors, macOS and Windows, packages are available at Python.org.
Setup
The project uses Pipenv to automatically create and manage its virtualenv.
# Install development dependencies
python3 -m pip install -U pipenv
pipenv install --dev
# Setup pre-commit and pre-push hooks
pipenv run pre-commit install -t pre-commit
pipenv run pre-commit install -t pre-push
Workflow
Modify code and execute the project or run features:
# Update margins
pipenv run python -m cme_margin cme_margin.csv
# Sort imports, format, lint, static type and test the project
pipenv run pre-commit run --all-files
Credits
This package was created with Cookiecutter and the sourcery-ai/python-best-practices-cookiecutter project template.