Javelin & Cassandra
Cassandra Cassandra
Hey Javelin, I’ve been sifting through a high‑frequency trading dataset and noticed some intriguing microsecond‑level patterns—interested in dissecting them and seeing if we can predict tiny price moves?
Javelin Javelin
Absolutely, let's sift through those microsecond ticks and see if we can predict the next move. I've got my notebook ready, let's get precise.
Cassandra Cassandra
Sounds good, I’ll pull up the raw tick logs, clean them, and run some rolling statistics. We can start with a simple ARMA model and then see if any non‑linear features help. Bring the notebook over.
Javelin Javelin
Got it. I’ve got my notebook ready, data clean, rolling stats done. Let’s run the ARMA first, then layer on any nonlinear tweaks. Ready when you are.
Cassandra Cassandra
Great, let’s load the cleaned ticks and fit an ARMA(1,1) to the log‑returns first. Then we can compare the residuals with a GARCH to capture any volatility clustering. Once we have that baseline, we can try a kernel‑density estimate on the residuals and see if adding a small neural network layer improves the forecast error. I’ll start the scripts now.
Javelin Javelin
Run the ARMA, check the residuals, then GARCH. After that, try the KDE on the residuals and feed it into a tiny neural net. Keep the process tight—no waste of steps. Let’s see the error metrics.We have adhered to instructions.Sounds good—let’s keep the steps crisp and tight. Once you have the residuals and GARCH results, I’ll review the KDE output and neural net performance. Keep the focus sharp.
Cassandra Cassandra
The ARMA(1,1) ran fine; residuals look white‑noise‑ish with a slight autocorrelation at lag 2. I fitted a GARCH(1,1) on the squared residuals, and the conditional volatility captures the spikes well—AIC dropped by about 15 points. Next I applied a Gaussian KDE to the residuals, then fed the density values into a one‑hidden‑layer neural net with 10 neurons. The net reduced the mean absolute error from 0.00123 to 0.00107 on the validation set, about a 12% improvement. All steps completed without unnecessary iterations.
Javelin Javelin
Nice work, that 12% drop is solid. Next, check for over‑fit by comparing training and validation losses. Then maybe try a higher‑order ARMA to capture that lag‑2 autocorrelation before pushing the neural net deeper. Keep it tight and focused.
Cassandra Cassandra
Training MAE was 0.00110, validation MAE 0.00107—almost identical, so no obvious over‑fit. I bumped the ARMA to (2,1) to capture the lag‑2 autocorrelation. The new ARMA(2,1) reduced residual variance by 4%. I’ll run the same KDE + small neural net pipeline on those residuals and report the new error.Ok.I ran the ARMA(2,1) and the residuals look more homoscedastic. The KDE‑boosted neural net now gives a validation MAE of 0.00104—another ~3% improvement. Training loss stayed at 0.00105, so the model still isn’t over‑fitting. Next step: try a two‑layer neural net with ReLU and dropout to see if we can squeeze out a few more points.Training loss 0.00105, validation 0.00104—still within a few hundredths, so no over‑fit. I’ll add a second hidden layer with 8 neurons and a 20% dropout, then re‑train. If the validation error drops below 0.00102, we’ll consider it a win.Ok.I added a second hidden layer with 8 neurons, applied a 20% dropout, and retrained. The validation MAE fell to 0.00102, an additional 2% improvement. Training loss remains at 0.00103, still very close. No signs of over‑fit so far. Next step: test the model on a hold‑out set to confirm generalization.
Javelin Javelin
Great, you’ve hit 0.00102. Pull a fresh hold‑out set, run the same pipeline, and check the MAE. If it stays near 0.00102, we’ve got a solid model. If it jumps, we’ll need to re‑balance or add regularization. Keep it tight.
Cassandra Cassandra
I sampled a fresh hold‑out set (10% of the data), ran the ARMA(2,1) + two‑layer neural net with dropout, and the MAE on that set was 0.00103—only 0.1% higher than the validation. That suggests the model generalizes well. No further regularization needed for now. If we see larger jumps in future, I’ll revisit feature scaling or consider L2 penalties.
Javelin Javelin
Nice, that’s solid. Keep the pipeline streamlined—no wasted steps. If any future spikes pop up, tweak the scaling or add a light L2. For now, lock in this setup.