This repository contains a Python Script that implements the mean reversion strategy using the lemon.markets API.
This project contains a number of models, which you can find in the models folder. In there, we define all relevant functions for Instruments, Orders, Token and Trading Venue.
All helper functions are defined in the helpers.py file.
The actual mean reversion is logic is defined in the main.py file with mean_reversion() being the main function.
To test locally, clone this repo, use the IDE of your choice to run (although we highly recommend PyCharm) and install all required packages through the provided requirements.txt file.
If you want to test locally, you need to define a number of environment variables.
ENV Variable | Explanation |
---|---|
API_KEY | Your API key |
MIC | Market Identifier Code of Trading Venue |
BASE_URL_TRADING | Base URL of our paper Trading API |
BASE_URL_DATA | Base URL of our Market Data API |
If you are interested in hosting this project in the cloud, we suggest that you use Heroku to do so. To make the hosting work, you need to create a new project and connect your GitHub repo. You can find a good explanation here. Additionally, you need to specify the environment variables through Heroku directly. You can do so by either using:
heroku config:set [KEY_NAME=value …]
or by adding them in your project in the Heroku Dashboard under /Settings/Config Vars.
Use this button to deploy to Heroku directly.
lemon.markets is an API from developers for developers. Therefore, we highly encourage you to get involved by opening a PR or contacting us directly via support@lemon.markets.
Have fun and happy coding,
your 🍋.markets team