0% found this document useful (0 votes)
2 views2 pages

task3

The document discusses the use of a HistGradientBoostingClassifier with isotonic calibration to predict adverse trades across multiple clients, emphasizing the advantages of using a single model and gradient boosting techniques. It details the selection of key features that capture market microstructure and client behavior, including order flow imbalance and trade intensity, and presents the model's performance metrics. The results indicate good generalization with well-calibrated probabilities, which are crucial for effective decision-making in subsequent tasks.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

task3

The document discusses the use of a HistGradientBoostingClassifier with isotonic calibration to predict adverse trades across multiple clients, emphasizing the advantages of using a single model and gradient boosting techniques. It details the selection of key features that capture market microstructure and client behavior, including order flow imbalance and trade intensity, and presents the model's performance metrics. The results indicate good generalization with well-calibrated probabilities, which are crucial for effective decision-making in subsequent tasks.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Task 3: Predicting Adversity

Why We Picked This Model


We used a HistGradientBoostingClassifier paired with isotonic calibration to predict the probability of
adverse trades. We chose this approach for a few reasons:
• Single Model for All Clients: Following the findings of ?, we used one model trained across all clients
(using client-specific features) instead of making individual models for each client. This lets us use more data
points and stops us from overfitting on clients who don’t trade very much.
• Advantages of Gradient Boosting: Histogram-based gradient boosting works really well on tabular data
with mixed feature types. It handles non-linear relationships effectively and is fast enough for our dataset size.
• Calibrating Probabilities: We applied isotonic calibration on the validation set to make sure the predicted
probabilities are accurate. This is crucial for Task 4, where the externalization threshold θ works directly on
these probabilities. If the probabilities were not calibrated, we would pick the wrong threshold.
• Hyperparameters: We set the model with max iter=200, max depth=6, and learning rate=0.05. This
balances predictive power with generalization, preventing overfitting while still catching complex microstructure
patterns.

Picking the Right Features


We selected five engineered features plus client identity to capture the key parts of market microstructure and
client behavior:

Feature Description
ofi 10 Order Flow Imbalance (10-trade rolling window)
intensity 10 Trade intensity (10-trade rolling count)
momentum 5 Price momentum (5-trade return)
spread norm Normalized spread (Spread/M0)
vol anomaly Client-specific volume Z-score (20-trade window)
Name, Side Client identity and trade side (one-hot encoded)

Table 1: Components of the feature vector for adversity prediction.

Why These Features?


Order Flow Imbalance (ofi 10): We calculated this as the rolling sum of Side × Volume over the last 10
trades. This captures the net buying or selling pressure in the market. When order flow imbalance lasts for a
while, it is a strong predictor of short-term price direction and adverse selection risk.
Trade Intensity (intensity 10): This is the number of trades in the rolling window. When trade intensity is
high, it often happens before informed trading activity and increased volatility, which signals higher adversity
risk.
Price Momentum (momentum 5): We calculated this as (M0 /M0,t−5 )−1 per client. Recent price movements
give context on whether the current trade fits with or goes against the prevailing trend, which affects the
probability of adverse unwinding.
Normalized Spread (spread norm): This is the ratio Spread/M0 . Wider spreads usually mean there is
higher uncertainty or adverse selection risk in the market. This feature helps the model adjust predictions based
on what is happening in the market right now.

1
Volume Anomaly (vol anomaly): This is a client-specific Z-score: (Volume − µclient )/σclient , where µ and
σ are computed over a 20-trade rolling window. When a client makes unusually large trades compared to their
normal behavior, it often signals informed trading or urgent liquidity needs. Both of these are linked to higher
toxicity.
Client Identity (Name, Side): We used one-hot encoded client identifiers so the model can learn baseline
toxicity levels for each client. As we showed in Tasks 1 and 2, clients have persistent differences in how they trade.
Including client identity lets the universal model capture these differences without needing separate models.

Order of Features
The feature vector we gave to the model consists of the following columns in this order:

[’ofi_10’, ’intensity_10’, ’momentum_5’, ’spread_norm’,


’vol_anomaly’, ’Name_B’, ’Name_C’, ’Name_D’,
’Name_E’, ’Name_F’, ’Side_1’]

Note: Client A and Side=-1 serve as the reference categories (dropped to avoid multicollinearity).

How the Model Performed


The model achieved the following metrics across data splits (averaged across all horizons τ ∈ {5, 10, 15, 20, 25, 30}):
• Training: Accuracy = 56.4%, Log Loss = 0.682
• Validation: Accuracy = 55.5%, Log Loss = 0.685
• Test: Accuracy = 55.6%, Log Loss = 0.686
The fact that validation and test metrics are consistent shows good generalization with very little overfitting.
While the accuracy looks modest (just slightly above random guessing at 50%), this is expected for the inher-
ently noisy problem of predicting adverse trades in high-frequency FX markets. The ? paper reports similar
performance levels for state-of-the-art methods on proprietary FX data.
Most importantly, the well-calibrated probabilities (ensured by isotonic calibration) allow for effective decision-
making in Task 4’s externalization strategy. We can see this in the substantial PnL improvements achieved
through threshold-based trade filtering.

References
Alvaro Cartea, Gerardo Duran-Martin, and Leandro S´anchez-Betancourt. Detecting toxic flow. arXiv preprint
arXiv:2312.05827, 2023. URL [Link]

You might also like