I don't think I'll post any code in-line here. I might post the code on github sometime. I just decided to play around with trying something besides sci-kit learn which is what I used with the concatenative synthesis stuff. I was also trying it with bitcoin market stuff too, I was just more paranoid back then... maybe I should be paranoid though... nah... *looks over shoulder*
Anyway, I got far enough to simulate trading (even made a few live trades, but I was impatient and set the tolerances really tight so I could see trades execute... I didn't leave it on long, just to see if it "worked")
I was pretty impressed after twiddling my "knobs" and getting charts like that... but I wanted to load more data and sci-kit learn was so slow, I think I maxed out my patience at around 5k samples.
With annoy I was able to generate a tree file on the server of 100K points, gzip, download and run magick on it.
I downloaded the following 20K points (after the 100K used to build the tree) to test.
I haven't made a trading system with it yet, but here's the charts of the actual price vs. the culmulative addition of the predicted price change every 5 second tick. Green is the actual price (average of best bid and best ask, I haven't been recording trade data, just depth), red is the 5 nearest neighbors averaged together. There are 600 "features" in each vector.
Zoomed all the way out:
Zoomed into just the beginning: