napiod
gives a python implementation of the measurement of price impact in order-driven markets introduced in Bellani et al. (2021).
This measurement of price impact quantifies the extent to which price movements are caused by a labelled agent in the market, either by her own market orders (direct impact) or by other market participants reacting to her actions (indirect impact).
In other words, napiod
measures the Granger causality between the market orders of a labelled agent and the movements of the mid-price.
The price impact is scenario-specific and depends both on the agent's behaviour and on the market environment.
The measurement of price impact is based on a model that utilises state-dependet Hawkes processes introduced in
Morariu-Patrichi and Pakkanen (2017) and Morariu-Patrichi and Pakkanen (2018), and so napiod
depends on mpoints.
We consider five streams of random times:
the stream
The five sequences of random times give rise to a five-dimensional counting process
-
$N_0(t)$ denotes the number of market orders that our labelled agent has submitted before or at time$t$ ; -
$N_1(t)$ denotes the number of seller-initiated trades that happened before or at time$t$ (identified with the number of market orders arrived on the bid side of the order book by time$t$ ); -
$N_2(t)$ denotes the number of buyer-initiated trades that happened before or at time$t$ (identified with the number of market orders arrived on the ask side of the order book by time$t$ ); -
$N_3(t)$ denotes the number of decreases in the mid-price caused by a limit order insertion or cancellation that happened before or at time$t$ ; -
$N_4(t)$ denotes the number of increases in the mid-price caused by a limit order insertion or cancellation that happened before or at time$t$
The counting process
The pair
Each agent's market order
For more detail into the model and the measurement of price impact, please consult Bellani et al. (2021).
pip install napiod
pip install -q build
python -m build
If you are contributing to napiod
, you might want to install it in development mode.
See development-mode
pip install --upgrade --force-reinstall --editable <path-to-napiod-root>