In this project, a Markov chain was fitted to predict whether the next 15-minute price interval would be higher (1) or lower (0) than the previous one. Based on this, buy orders are created on Polymarket.
Polymarket is a platform where users can buy and sell "shares" on the outcome of future events, such as elections, sports results, or geopolitical events. The price of each "share" reflects the collective probability that the market assigns to that outcome occurring. If your prediction is correct, you win money based on your bet; if not, you lose what you invested.
Among these markets, there is one where you "bet" on whether the price will close above or below the opening price of the 15-minute candle.

The idea comes from transforming the series of Bitcoin candles into a sequence of ones and zeros. Where one represents that the price went up and zero that the price went down.
Bitcoin candles were obtained from 2019-11-16 to 2025-11-14, with a 15-minute interval. A total of 210,816 candles. And they were transformed into a sequence of ones and zeros.
With this sequence, a Markov chain was fitted. A Markov chain is a mathematical model that describes a system that passes through a series of possible situations (called states), randomly, and assuming that:
The probability of moving from one state to another depends only on the current state, and not on previous states.
This assumption corresponds to a First Order Markov Chain. If the transition to the next state depended on the k previous states (i.e., the memory of the sequence), it would be a Markov Chain of Order k.
With this in mind, the next step was to fit and validate with historical Bitcoin data. A chain of order 7 was fitted and validated in different ways:
Fitting with data from 2019-11-16 to 2024-11-14 and validation with data from 2024-11-15 to 2025-11-14.
With this validation, we tried to simulate what would have happened if we had started this project a year ago, and had bet 5 dollars every 15 minutes.

Average metrics obtained in this period:
| Metric | Value |
|---|---|
| Accuracy | 52.23% |
| Precision | 51.81% |
| Recall | 61.63% |
| F1 Score | 56.29% |
| Final Score | 7805$ |
The results are quite impressive, and it is interesting to see how only an accuracy of 52% can have such a large effect in the long run.
Fitting the chain with the last three years, and validation with 20 random weeks from 2022 backwards.
With this, I wanted to eliminate the possibility of a temporal dependence, ensuring that the model's performance depended on the transition probabilities between states and not on the strict chronology of events.
In the graph we see how our capital would evolve if we had bet 5 dollars every 15 minutes. If we win we add 5, if we lose we subtract 5.

The results are repeated, in none of the weeks do we end up with losses, and obtaining profits of around 200 dollars.
Seeing these results, I created a small script that, two seconds before the start of the next 15-minute interval, extracted the last 7 candles, made a prediction with the fitted model, and created a limit order of 0.5c on Polymarket. This code was hosted on an AWS EC2 instance and ran every 15 minutes. And the problems arrived...
Why am I not rich?
Two problems in practice have not made me rich:
The first, and most important, is that the limit order was not always executed. The price of the next interval starts to fluctuate before the previous one ends, and if the price does not go down again, the order is not executed.
This happened more or less 1 out of 10 times. And these are the times when my model made the correct prediction, since if the price goes up and does not go down again, it is because the model had correctly predicted the movement. This didn't make me lose money, but I didn't win it either.
If 10% of the correct predictions are not made, this after a week is a "non-profit" of about 170 dollars (assuming an accuracy of 53.55%, like that of the 20-week test).
The second is a belief of mine, it is true that we can be in one of the weeks that it costs to recover the capital. But just in the week I decided to put my system to work, Bitcoin suffered a quite atypical drop in the data I had.
I stopped the system and for both reasons, with 50 dollars in losses. I still believe that the model has potential, my idea now is to place the limit order before the interval ends, looking for a balance between the risk of the price fluctuating after I have created the order.
How good of a predictor are you?
You can try below to predict if the movement of Bitcoin in the next 15 minutes given the colors of the candles and compete against my model:
Bitcoin Prediction Game (Real BTC Data)
Predict the next 15-min candle!