Markov Chains usually deal with discrete states. But price time series is continuous.
Actually we will be considering not the time series itself, but its diffs:
continuous_diffs = [1.1, 1, 0.99, 1.01, ...]
so the price at time t
will be price(t = 7) = price(t = 0) * diff_1 * diff_2 * ... diff_6
.
It's possible to manually split continuous state into let's say 5 discrete states huge_down, down, same, up, huge_up
so the diffs will be
continuous_diffs = [1.1, 1, 0.99, 1.01, ...]
discrete_diffs = [huge_up, same, down, up, ...]
And now the serie is discrete and it's possible to fit Markov Chain.
But, there are problems. We need to find two parameters - number of states K = 5
and the boundaries of those states. Should boundaries be evenly distributed, or maybe log-scale, or somehow else?
So, how to solve that? Ideally - fit Continuous Markov Chain (if it exists). Or tell Markov Chain number of states K = 5
and Markov Chain somehow himself find the optimal discrete boundaries.
Are there such algorithms? Or executable examples, notebooks?