Ario Barin Ostovary

Software Engineering, University of Waterloo

Wat Street

ML Developer. Forecasting changes in market behavior.

At Wat Street, we set out to forecast changes in market regimes: periods where the market behaves differently enough that you might want to use a different trading strategy.

First, we needed labeled data for forecasting, so we had to decide what counted as a regime. I worked on k-means clustering and compared it with the team's Gaussian HMM results. I also tried expanding from seven features to 48. The 48-feature version was pretty bad. It grouped almost all of 2012 through 2018 into one regime.

We combined the two methods into a consensus dataset with six risk ranks, from Steady Bull to Crisis. When they disagreed, we chose the riskier label. We called this the pessimistic pivot.

HMM labels, k-means labels, and our combined labels over the same SPY price history.
HMM and k-means labels over SPY prices, followed by the consensus labels

I trained a Temporal Convolutional Network to classify those labels as an intermediate step. The forecasting experiments used the previous 60 trading days to predict the regime five days ahead and whether a change was coming. I compared TCNs with a small transformer against simply keeping the current regime.

The labels were still a limitation. The models were learning to predict categories we'd assigned with clustering and a rule for disagreements. Switching trading strategies remained the intended use; matching those labels wasn't enough to establish that it would work.

An early TCN classification result I shared with the team in February. The top panel is our consensus labeling; the middle is the TCN's prediction. Pink regions at the bottom mark disagreement. These are daily labels, not five-day forecasts.
February TCN daily classification experiment, showing consensus labels, predictions, and periods where they disagree over the same SPY price history