releat215 / releat

REinforcement LEarning for Algorithmic Trading is a python framework for medium frequency trading algorithms for MetaTrader 5
https://releat215.github.io/releat/
MIT License
22 stars 9 forks source link
algorithmic-trading algorithmic-trading-engine forex forex-analysis forex-api forex-bot forex-prediction forex-robot forex-trading metatrader metatrader-5 metatrader5 reinforcement-learning reinforcement-learning-agent reinforcement-learning-environments

ReLeAT

REinforcement LEarning for Algorithmic Trading is a python framework for learning medium frequency trading algorithms for MetaTrader 5 (other trading platforms are planned for the future).

DISCALIMER: The information provided herein is for educational and informational purposes only and should not be construed as financial advice. It is not a recommendation to trade or invest real money. Always exercise your own judgment and use common sense when making financial decisions.

Vision

To build a collaborative community where software engineers, data scientists, RL researchers, quants and finance and economic experts can share knowledge. This framework covers the end-to-end process including:

In progress:

Key features

Prerequisites

Installation

1) Clone the repositry

git clone https://github.com/releat215/releat.git

2) Navigate to repository folder

cd releat

3) Download and run prebuilt docker container

Instructions to build to container from the DockerFile or develop using VSCode's dev containers can be found in the development notes. Code is containerised to provide consistency (especially when setting up MT5 in linux), easy deployment and scalability. To build the container:

docker build -t releat -f ./infrastructure/releat/Dockerfile .

Alternatively, a pre-built container can be used:

docker run \
    --net host \
    -v /tmp/.X11-unix:/tmp/.X11-unix \
    -v $(pwd):/workspaces/releat \
    -e DISPLAY \
    --gpus all \
    -it \
    --name releat \
    releat215/releat:1.0

Usage

This is an example of how to train and deploy a simple agent that trade EURUSD. For more information and/or trouble shooting guides, see the section on getting started.

Notes:

1) Connect to running docker container

If opening a new terminal, connect interactively to the running docker container:

docker exec -it releat /bin/bash

2) Start services

Starts services necessary to train, deploy and monitor the reinforcement learning trading agent:

IMPORTANT: If it is the first time starting up the docker container, or if it has been rebuilt, log in the your MT5 account manually and click the allow autotrading button. If not, steps 3+ will not work.

releat start
releat launch-mt5-api metaquotes general

3) Build training data

Build the features defined by the feature_config.py script and upload to Aerospike.

releat build-train-data t00001

4) Train model

RL model is defined in agent_model.py and the training hyperparameters are defined in agent_config.py, including the number of iterations to run the training. Checkpoints are saved locally, which can then used for deployment

releat train t00001

5) Generate signal

Using the artifacts generated by the training process, this generate signal process is deployed to continuously:

The frequency of the prediction is controlled by the configs set in agent_config.py

releat generate-signal t00001

6) Launch trader

The trader is agent version agnostic (for now) and is deployed to:

releat launch-trader

Contributing

Actively looking for contributors and collaborators to make this project even better! Please:

1) Create an issue

2) Create a new branch to work on your feature or bug fix. Give it a descriptive name.

3) Include tests for your feature or bug fix

4) Create a pull request

Alternatively, if you want to take the project in a different direction, feel free to fork the project.

Licence

MIT

Maintainer

If you have any questions, please contact: