nkaz001 / hftbacktest

A high-frequency trading and market-making backtesting tool in Python and Rust, which accounts for limit orders, queue positions, and latencies, utilizing full tick data for trades and order books, with real-world crypto market-making examples for Binance Futures
MIT License
1.78k stars 358 forks source link

Trading intensity modeling #65

Closed sergeysolovev closed 7 months ago

sergeysolovev commented 7 months ago

From Calculating Trading Intensity:

# All of our possible quotes within the order arrival depth,
# excluding those at the same price, are considered executed.
out[:tick] += 1

When calculating trading intensity, the trades are aggregated down to the mid. Is it really a fair thing to do? In there was a big order smashing throught multiple levels, we’ll receive all corresponding trades from the data feed. Also there may be not much liquidity around the mid (wide bbo spread), but this way to model it will tell us that most of trading was half tick away from the mid.

I tried to collect the trades without aggregating them down to the mid, and the resulting intensity chart is not a nice decaying exponential curve. To the point, that it’s almost unfittable.