← Back to Projects

Abstract

This paper presents a novel approach to quantifying execution risk in fragmented liquidity venues. We utilize a proprietary stochastic model to estimate slippage probability under varying volatility regimes.

### 1. Data Processing in R

The initial data cleaning was performed using R. We filtered for anomalous trade prints that deviated more than 3 sigma from the VWAP.

R
# Load required packages
library(data.table)
library(ggplot2)
library(quantmod)

# Function to calculate VWAP
calculate_vwap <- function(price, volume) {
  return(sum(price * volume) / sum(volume))
}

# Load high-frequency trade data
trades <- fread("data/hft_trades_2025.csv")

# Filter outliers (> 3 sigma)
trades[, vwap := calculate_vwap(Price, Volume), by = Symbol]
trades[, sigma := sd(Price), by = Symbol]
trades <- trades[abs(Price - vwap) < (3 * sigma)]

# Plot execution performance
plot(trades$Time, trades$ExecutionSlippage, main="Slippage vs Time")

### 2. Results

The model demonstrates a 14% reduction in execution costs compared to standard TWAP algorithms.

Full Working Paper

Below is the full PDF documentation of the model and backtest results.
-