This repository contains a code implementation of the Research project Optimal Trade Execution using RL approach.
This project aims to tackle the challenging problem of optimizing the execution of large orders in financial markets, whether they are simulated environments or real-world platforms like Binance. Efficiently executing large orders while minimizing costs and market impact is crucial for institutional investors and traders. Reinforcement Learning provides a promising approach to address this problem by learning optimal execution strategies in complex market dynamics.
where
In real market we assume
-
actor_critic.ipynb
oractor_critic.py
— running the actor-critic model on simulated data -
actor_critic_historical.ipynb
oractor_critic_historical.py
— running the actor-critic model on real Binance data -
actor_critic_params.yaml
andactor_critic_historical_params.yaml
— hyperparams for models and simulations -
critic.py
— critic arch, including TD objective -
model.py
— model perceptron, including its layers, architecture and etc -
policy.py
— actor arch, including surrogate objective -
simulator.py
— Euler–Maruyama integrator -
system.py
— systems for simulating data or processing real historical data -
util.py
— usefull functions: data buffers, optimizers and etc
git clone https://github.com/ooodnakov/RL-2023-TP-Optimal-Execution
cd RL-2023-TP-Optimal-Execution
pip install -r requirements.txt
wget https://dnakov.ooo/files/data.parquet
To reproduce results, you just ran our notebooks using Python kernel with neccesary packages.
The code was tested in Python 3.9.16
. The code execution in other Python versions is not guaranteed.
If you prefere .py
files you can run them via:
python actor_critic.py actor_critic_params.yaml
python actor_critic_historical.py actor_critic_historical_params.yaml data.parquet
We succeded to beat TWAP results in execution in both simulated and real markets.
RL allowed to receive more than 33%
more cash compared to TWAP baseline