JuanRamirezJorda / HFTFramework

Market making algorithmic trading framework used to test reinforcement learning on " A reinforcement learning approach to improve the performance of the Avellaneda-Stoikov market-making algorithm "

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HFT Framework

Java / Python Framework used in my research,it can be connected to live markets using zeroMQ using the same code as in backtesting, Backtesting is a L2 backtest simulating orderbook changes and market trades.Some Latencies can be simulated. Data for backtesting should be in parquets like in data folder and has to be configured by the environment or application properties.

Framework and algorithms are all in the java code but backtest can be called from python and different tools and utilities from python can be used on the backtest results , like parameter tuning or plot the pnl and parameters.

Market connectors can have a persistance layer to save market data in parquets that can be used in backtesting. Open to suggestions/changes/modifications

Tutorial Backtest

Best example is found on jupyter notebook ConstantSpread example.

On this example we are running from notebook a backtest for the

This code is part of a bigger private repository with more algos and more connectors. If you see something wrong or is not compiling , please contact me by email

Alpha AS

IS my research where and Avellaneda Stoikov market making implementation is going to be manage by RL. RL is going to configure the different Avellaneda stoikov parameters dinamically based on market state.

Alpha AS

Avellaneda Stoikov implementation

[JAVA]

Where the algorithm logics , backtest and execution happens [JAVA 11 required]

Backtest Architecture

Live Architecture

Install

first install maven modules

  1. parent_pom
  2. common
  3. algorithmic_trading_framework
  4. trading_algorithms
  5. backtest_engine
  6. executables

then package executables -> Backtest.jar Backtest.jar is going to be our python launcher to get backtest results

Grateful for the libraries directly used

Environment settings

  • LAMBDA_PARQUET_TICK_DB= Folder where the parquets DB is saved
  • LAMBDA_DATA_PATH = Old Folder where the DB was saved
  • LAMBDA_OUTPUT_PATH = base path where the ml models will be saved
  • LAMBDA_INPUT_PATH = base path where the configuration of algorithms will be read automatically, soon

BACKTEST JAVA

  • LAMBDA_OUTPUT_PATH = output of java algorithms must be the same as applicaiton.properties
  • LAMBDA_TEMP_PATH = temp of java algorithms must be the same as applicaiton.properties
  • LAMBDA_JAR_PATH = path of the backtest jar path to run from python
  • LAMBDA_LOGS_PATH = where we are going to save the java logs

[PYTHON]

To get backtest results compare , optimize parameters -> Algo trading strategies are just and enumeration.Business logic must be in java compile and package java first! Grateful for the libraries directly used

  • mlfinlab
  • Pandas
  • Numpy
  • seaborn
  • Darwinex-ticks
  • dwx-zeromq-connector
  • ...etc

About

Market making algorithmic trading framework used to test reinforcement learning on " A reinforcement learning approach to improve the performance of the Avellaneda-Stoikov market-making algorithm "

License:Apache License 2.0


Languages

Language:Jupyter Notebook 91.5%Language:MQL5 5.9%Language:Java 1.5%Language:MQL4 0.8%Language:Python 0.2%Language:Batchfile 0.0%Language:C 0.0%Language:HLSL 0.0%Language:Shell 0.0%Language:PowerShell 0.0%