Project is for implementing HFT Market making Agent using pytorch
Python 64.11%Jupyter Notebook 35.89%
qmm-crypto's Introduction
HFT market making in pytorch and gym
Agent
Environment State Space is consists of eight indicators:
LOB levels rendered as stationary prices;
cumulative notional value at each price level;
imbalances for cumulative notionals;
order inflow imbalances at LOB levels;
the spread between the best bid and ask prices;
custom price momentum indicator;
custom trade flow imbalance indicator; and
environmental reward signal.
forecasted volatility.
Distance to midpoint
Distance $\xi$ is the difference from price $p$ at LOB level $i$ from midpoint $m$ at time $t$.
$$ \xi_{t,i}^{bid,ask} = \frac{p_{t,i}^{bid, ask}} {m_t} - 1 $$
Cumulative Notional Value at Price Level
Cumulative sum $\chi$ is the sum of the product of price $p$ and quantity $q$ at LOB level $i$ at the time $t$ for both $bid$ and $ask$ sides. The LOB's first 15 price levels are extracted from $bid$ and $ask$ sides of the LOB, thus creating 30 values for this features.
$$ \chi_{t,i}^{bid, ask} = \sum_{i=0}^{I-1} p_{bid, ask}^{t,i} \times q_{bid, ask}^{t,i}$$
Notional Imbalances
The order imbalances $\iota$ are represented by notional value and normalized to the scale [โ1, 1]. Since there are 15 price levels included, there are 15 values for this feature.
$$ \iota_{t,i} = \frac{\chi_{t,i}^{ask,q} - \chi_{t,i}^{bid, q}}{\chi_{t,i}^{ask,q} + \chi_{t,i}^{bid,q}} $$