Yesterday seemed like any other day until FOMC minutes. Then the markets began to seize. Given the limited trading intensity we’ve witnessed so far in 2017, one could be forgiven for thinking the world was about to end.
But at the end of the day, how different was yesterday from any other day? Was it really that crazy? To investigate, I started by grabbing all the 1-minute data for the SPY from 2016 onward. Then I transformed every day to start at 1.0, where the price represented the daily return up until that point. That yielded a graph for 2017-04-05 which looked like:
Next, for each day, I computed the ‘distance’ or ‘dissimilarity’ between every pairwise combination of days. I did this in order to find the most similar trading days to April 5th 2017.
In practice, I used the LazyMatrix model from SliceMatrix-IO‘s Python SDK. This model is an example of a distance matrix, whereby we can build a list of all the most similar datapoints:
from slicematrixIO import SliceMatrix sm = SliceMatrix(api_key) # normed_data is all the daily data series starting at 1.0, 9:30 to the close lz = sm.LazyMatrix(dataset = normed_data.T) distances = lz.rankDist("2017-04-05") distances.head()
Then I plotted the resulting dates to see how well they compared to yesterday… (hint yesterday is in GOLD)
Ok, so maybe yesterday wasn’t so special… If thats the case, maybe the past can be a good guide to the future, so let’s see what happened on the very next day for the most similar dates we found above:
Not a single debacle in sight… this could explain why all this fire-insurance isn’t doing squat for me at the moment. Should have written this in the morning…
Interested in Machine Learning Applications for Trading?
This example is powered by SliceMatrix-IO, the next generation in machine intelligence Platform as a Service (PaaS). SliceMatrix delivers an end-to-end machine intelligence solutions to end-users so that they can seamlessly develop machine intelligent applications and systems. Get started building for free and get your api key here