iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
✨

Are Time Series Foundation Models Useful for Crypto Trading Bots?

に公開

Introduction

This article is the 18th entry for the Cryptocurrency Botter Advent Calendar 2025.

The previous day's post was "Do cryptocurrencies also have small-cap effects and return reversals?" by Shiokara-botter.


Hello! My name is Harui. I am a C-class botter who trades primarily on domestic CEXs while attending university. I enjoy cool technologies like Rust and Lean.

In this article, I will cover how and to what extent Time Series Foundation Models (TSFMs)—which are trained on massive amounts of time-series data—are useful in bot trading.

What is a Foundation Model, anyway?

First of all, what is a foundation model?
Google Cloud defines foundation models as follows:

A foundation model is a type of AI model that is pre-trained on a vast amount of data to perform a variety of tasks. Self-supervised learning is often used in this training process, allowing the model to learn complex patterns and relationships within the data, which enables it to perform various tasks with higher accuracy. More importantly, this large-scale training leads to emergent capabilities. In other words, it becomes capable of handling tasks for which it was not explicitly trained. This shift from specialized tools to flexible, general-purpose models is the hallmark of the foundation model paradigm.

In short, these models are described as having the property that "by training on massive amounts of data, they become effective even for tasks they were not directly trained on."

OpenAI's GPT is a prime example of a foundation model; it was trained to predict the next token using massive data and gained the ability to perform tasks not explicitly included in its training, such as summarization and translation.

Q: What if the problem of predicting financial time-series data, such as BTC prices and stock prices, could be solved using foundation models?

A: That would be exciting.

So, let's test if that excitement translates to reality!!

Introducing Time Series Foundation Models (TSFM)

Foundation models trained on time-series data are called Time Series Foundation Models (TSFMs) [1].

TSFM training data comes from various domains beyond finance [2], and they are sometimes trained on hundreds of billions of data points [3].

Considering that the total count of second-by-second data from 2017 to 2025 is only 280 million, it is extremely difficult to achieve this scale with stock or crypto data alone.

Among such TSFMs, I will use TimesFM released by Google. If you look up TimesFM, you might find posts like the one below, but let's pretend we didn't see it for now!

https://x.com/kyo_takano/status/1789150904102613131

There are many other TSFMs besides TimesFM. For the latest status on TSFMs, there is a perfect article in this year's Advent Calendar, so please refer to that 👉 The Present of Time Series Foundation Models (Dec 2025)

Let's try it out: TimesFM edition

TimesFM is a TSFM announced by Google. It is a model with 200M parameters and a Decoder-only Transformer structure (nothing too fancy).

If you are using uv, you can use TimesFM by adding the following dependencies to your pyproject.toml:

pyproject.toml
dependencies = [
    "timesfm @ git+https://github.com/google-research/timesfm.git@6bd8044275f8b76cdc9554f2fecccac5f31a156c", 
]

Let's try inputting 1-hour BTC price data from bitbank and have it make a prediction!!
(The data used is collected using the program published here)

Code to run TimesFM

Below is an excerpt of the code. Please refer to https://github.com/Harui-i/tsfm-proj/blob/main/inference/i-tsfm/notebook.py for the full version.

import timesfm
model = timesfm.TimesFM_2p5_200M_torch.from_pretrained("google/timesfm-2.5-200m-pytorch")
model.compile(
    timesfm.ForecastConfig(
        max_context=1024,
        max_horizon=256,
        normalize_inputs=True,
        use_continuous_quantile_head=True, 
        force_flip_invariance=False, # Whether f(ax + b) = a f(x) + b
        infer_is_positive=False, # Whether the output is non-negative if input is non-negative
        fix_quantile_crossing=True, # Correction of quantile crossing (what is this?)
    )
)

import matplotlib.pyplot as plt
import numpy as np

# Visualize point_forecast
forecast_times = history_times[-1] + np.arange(1, horizon+1) * 1000 * 3600 # 1000 * 3600 ms = 1h
plt.figure(figsize=(10,5))
plt.plot(history_times, closes, label='History(close)')
plt.plot(forecast_times, point_forecast[1], label='Point forecast(high)')
plt.plot(forecast_times, point_forecast[2], label='Point forecast(low)')
plt.plot(forecast_times, point_forecast[3], label='Point forecast(close)')

plt.legend()
plt.savefig('btc-point-forecast.png')
plt.show()

Let's use 512 1-hour candles to predict 48 OHLC prices...!!

1h candle close prediction
1h candle close prediction

According to Dr. TimesFM 2.5, both the high and close remain flat, but the low is expected to rise gradually (!?!?!)

The prediction is nonsensical, with the low becoming higher than the high. Although TimesFM can take multiple series as input, it doesn't seem to consider their relationships specifically. [4]

Since I'm at it, I'll also try quantile forecasting.

1h candle close prediction (quantile forecasting)
1h candle close prediction (quantile forecasting)

It is strange that the predicted values are ordered as q9 > q8 > q7 > q6 > q0 > q5 > q4 > q3 > q2 > a1, but otherwise it seems normal.

Let's backtest

Let's backtest a strategy using TimesFM! For the time being, I will try a mean-reversion strategy where I place sell limit orders at q6 and buy limit orders at q4 [5].

Excuse

Generally, when training time-series models, it is often effective to perform pre-processing such as converting data to return series to weaken the dependencies between adjacent data points. I personally usually perform such pre-processing as well.

However, from my quick glance at the TimesFM paper, it did not seem to be designed with the assumption of return series, so I have input the raw price series directly in this verification.

How much the results change when using return series as input is a topic for future investigation.

I'm losing a ton of money!!!!!!!! Even though I calculated it with zero fees!

However, I can't give up here. There are many TSFMs in the world, and what they can do varies depending on the model, so trying different models will likely yield different results, and different strategies can be utilized. Let's consider other TSFMs!

I wanted to try: TTM-R2 edition

TTM-R2 is a TSFM released by IBM. Its features include having about 1M parameters (1/100th of TimesFM), a large scale of training data, and adopting an MLP-Mixer structure instead of a Transformer.

I... wanted to backtest a strategy using multivariate prediction (such as long-short) while training this model, but I am desperately short on time, so I will have to skip it 😭

Instead, I will introduce the models I wanted to try.

Introducing other TSFMs I wanted to try

I will briefly introduce other TSFMs I wanted to handle besides TimesFM.

TTM-R2

  • Web page: https://huggingface.co/ibm-granite/granite-timeseries-ttm-r2
  • Model structure: MLP-Mixer
  • Parameter count: 1M
  • Prediction format: Multivariate, point forecast
  • Developer: IBM
  • Comment: It is interesting that it is based on MLP-Mixer rather than a Transformer. Also, given the large amount of training data and relatively small parameters, it seems easy to fine-tune. I feel that the ability to perform multivariate predictions expands the range of use cases.

FlowState

  • Web page: https://huggingface.co/ibm-granite/granite-timeseries-flowstate-r1
  • Model structure: SSM (State Space Model)
  • Parameter count: 10M
  • Prediction format: Multivariate, point forecast
  • Developer: IBM
  • Comment: This is another TSFM from IBM. Its features are that it uses a State Space Model and can perform multivariate predictions. I don't know... what using a state space model means in the financial domain...

TiRex

https://x.com/pigooosuke/status/1929863316383715547

  • Parameter count: 35M
  • Prediction format: Univariate, quantile prediction
  • Developer: Likely NX-AI
  • Comment: The characteristic feature is that the model structure is xLSTM. By using this model, you might get immersed in a nostalgic botter feeling that reminds you of the heyday of LSTM.

2019 tweet:

https://x.com/Ros_1224/status/1161470501878767617

Chronos(T5)

  • Web page: https://github.com/amazon-science/chronos-forecasting
  • Model structure: T5-based (Encoder-Decoder)
  • Parameter count: 8M ~ 710M
  • Prediction format: Probabilistic forecasting (distribution prediction)
  • Developer: Amazon
  • Comment: The model size is a bit large. Being able to perform probabilistic forecasting is a major feature. I found it during my research, but I haven't really confirmed what "probabilistic forecasting" specifically refers to. When I asked an LLM, it said, "It can calculate the 'probability that the price will fall within this range' rather than just a simple point forecast, making it suitable for bots involving risk management and option strategies." That seems plausible.

Moirai

Conclusion

In this verification, unfortunately, the strategy using TimesFM as-is yielded harsh results (even without considering fees). However, this does not mean that TSFMs are useless.

For example, the following (not just superficial) efforts can be considered:

  • Fine-tuning: Training the TSFM further with cryptocurrency data

  • Improving inputs: Using differences instead of raw series

  • Ensemble: A somewhat superficial trick, but taking the sum of the results from multiple TSFMs is an option.

  • Changing the prediction target: Using it for predicting volatility instead of price itself

There are many other tricks a botter can try.

I hope this article encourages you to use Time Series Foundation Models to find your favorite TSFM!!!!!!!!!!! (And if you find something profitable, please tell me quietly!)

Thank you for reading this far! I couldn't dedicate enough time to provide a complete research, but I would be very grateful for your "likes"!!

If there are any errors in this article or if you have insights like "This model works better!", please let me know in the comments or on X.

Contact: X @ Harui_botter

The code I used this time (data collection, inference, notebook) is available on GitHub: https://github.com/Harui-i/tsfm-proj

脚注
  1. Although I wrote this, I am not confident whether this is an appropriate definition for TSFM. ↩︎

  2. e.g., weather, traffic, cloud infrastructure, web traffic, and synthetic data ↩︎

  3. this is just my impression, so a citation is needed ↩︎

  4. I judged this because, as far as I scanned the TimesFM repository and paper, the term "multivariate" barely appears. ↩︎

  5. For convenience, I refer to the 5th value among the quantile predictions provided by TimesFM as q4, though I don't know exactly what it signifies ↩︎

Discussion