Can you predict a stock's price one minute ahead?
The research tested eight ways of forecasting, from classic statistical models to neural networks, on ten of the most traded stocks on B3, the Brazilian stock exchange, minute by minute, in 2022. A simple statistical model was among the best for all of them; neural networks, almost never. Explained in 12 screens.
On the exchange, prices are recorded every millisecond
Classic forecasting models were born with closing data: one price per day, month or year. Today B3 records every trade, and its system captures prices every millisecond. The thesis asks whether so much detail helps decision-makers.
Pick a scale and see how many prices fit into a single trading day, from 10:00 to 16:59.
Our calculations, based on the trading hours given in the thesis (10:00 to 16:59, 420 minutes). According to a study cited in the thesis, a computer one mile from the exchange's data centre receives orders about five millionths of a second later.
Predicting the next minute is harder than it looks
Below are the last 30 minutes of an imaginary stock. Say where the price will be in the next minute. Your guess competes with the simplest one of all: “the next price is the same as the last”, which economists call a random walk.
The score adds up the squared error, as in the thesis: missing by 4 cents counts as 16; missing by 2 counts as 4. The lowest total wins.
Randomly drawn series. The prices are made up in each round; they are not data from the thesis.
About a dozen articles a year try to forecast with high-frequency data
The author searched two large databases of scientific articles (Scopus and Web of Science), from January 2015 to August 2022, for studies that use high-frequency data to forecast prices and price swings. Tap each stage.
Hardly anyone looks at Latin America
Each article was classified on six questions: its topic, the theory it uses, its method, where its data come from, what it concluded and what it suggests next. In red, what the author points to as a priority for new research. Tap a row.
Percentages of the tags in each question (an article could receive up to five), not of the 93 articles. Figure 11 of the thesis.
Eight models, each looking at the past in its own way
They all receive the same price history and try to say what comes next. What changes is what they pay attention to: only the last minute, a long memory, the size of the swings, or patterns that a neural network learns by itself.
The drawings illustrate what each model takes into account, on a made-up series. The settings come from section 3.5 of the thesis.
About 96,000 minutes per stock; the last 20,000 go into the test
The data came from B3 itself: every trade in 2022, in milliseconds, for the ten most liquid stocks. When there was no trade, the last price stood; then each series was summarised by the last price of each minute.
To estimate the models, the author used the 20,000 most recent minutes of each stock: 16,000 for the models to learn and 4,000 to test the guesses. With the whole series, the errors were larger.
Trading days: our calculations (420 minutes per day). Table 7 and Chart 3 of the thesis.
The winner is not a single model but the group tied at the top
Forecast errors vary by chance. To avoid crowning a model that was merely lucky, the thesis used the Model Confidence Set: a test asks whether the remaining models make the same error; if not, the worst one leaves; and so on, until a group remains that cannot be told apart.
Run the test, one round at a time.
Illustration with made-up numbers. The thesis does not publish each model's error; it only shows which models made the final group for each stock (next screen).
ARIMA was among the best for all ten stocks
Each raised block is a model that made the final group for a stock. Statistical models dominate: ARIMA in all ten, ARFIMA in eight. Of the neural networks, the Transformer made it into two and the LSTM into none. Tap a model or a stock.
For six of the ten stocks, “same as last” tied with the best
Being in the final group means it cannot be said, with statistical confidence, that the other models make smaller errors. The naive guess made the group for six stocks; it was beaten for four. For two of those, only ARIMA remained.
Height = how many models made each stock's final group (our count, Chart 4). In red, the stocks for which the naive guess was in the group.
More sophistication did not guarantee better forecasts
For the author, with these data and settings, traditional statistical models had the edge over neural networks. And the best model depends on the period analysed.
For investors
- Simple models, such as ARIMA, were among the best for every stock tested.
- The best model changes with the period: it is worth reviewing the choice with new data.
For banks and asset managers
- The confidence set makes it possible to compare many models at once, without electing a winner by chance.
- Summarising milliseconds into minutes was what made the models work.
For AI developers
- LSTM and Transformer did not capture the price dynamics well at such a high frequency.
- The author suggests testing other machine learning models, such as Prophet, N-HiTS and N-BEATS.
For researchers
- Gaps from the review: the effect of economic news on price swings, price jumps, event studies and Latin American markets.
- Suggested next step: trading pairs of stocks that move together (pair trading).
The classic volatility models (ARCH and GARCH) appeared for only a few stocks, and the Kalman filter, although it followed the prices, did not make any final group.
What this research does not say
- It holds for that period and those models. The result of the confidence set depends on the sample (2022) and on the models compared; another period may pick another model. · according to the author
- Minutes only. In milliseconds and in seconds, the models did not reach stable results; the test uses the last price of each minute. · according to the author
- Who won, but not by how much. The thesis shows which models made the final group, without the size of each model's error. There is no way to know how much smaller ARIMA's error is. · our observation
- Forecasting is not profit. There was no simulation of buying and selling with the guesses, nor of trading costs. · our observation
- Ten stocks, simple settings. The most traded on B3, every model with a single lag (the previous minute). · our observation
Credits
MATTOS, João Vitor de. Projeção de preço para ações brasileiras utilizando-se dados em alta frequência [Price forecasting for Brazilian stocks using high-frequency data]. Doctoral thesis (Business Administration) — Mackenzie Presbyterian University, São Paulo, 2024. Advisor: Prof. Dr. Eli Hadad Junior.
Research supported by Banco do Brasil. Bibliometric and systematic review in Scopus and Web of Science (R and Biblioshiny); trading data from B3; model selection by the Model Confidence Set (Hansen, Lunde and Nason). This version simplifies the work for a general audience; the formulas and the details of each model are in the original text.