1
0 Comments

I Built a Transformer-Based Diffusion Model from Scratch to Simulate 1000 Years of Bitcoin Data

I’ve traded and built models myself and I’ve always felt uneasy about how little real market history you actually have to work with. Three years of bull markets. A handful of crashes. Not nearly enough to know if a strategy will survive.

So I decided to see if I could build a tool that could create synthetic Bitcoin data... something that felt as real as possible but spanned decades of different market conditions.

I didn’t really know what I was getting into.

I found a academic paper that argued that diffusion models (the same neural networks behind AI art generation), could generate synthetic financial time series with uncanny realism.

This hit me like a freight train.

Because if you’ve ever tried to backtest a crypto trading strategy, you know the problem: Everyone uses the SAME few years of Bitcoin data. Your “edge” isn’t an edge it’s curve-fitting to the 2021 bull run.

So I thought: What if you could create 1000 years of statistically accurate Bitcoin candles instead? I decided to build it. No roadmap. No examples. Just intuition and a lot of vibe-coding in Pytorch.

The idea:

  1. Take the Stable Diffusion architecture.
  2. Replace images with price returns.
  3. Train it to denoise random noise back into realistic BTC time series.

Sounds simple. It wasn’t. I went through:

  • 87+ model versions
    -Hundreds of hours of training and GPU credits
  • Countless CUDA crashes
  • Obsessive statistical validation (KS tests, EMD, volatility clustering)
  • A few moments where I questioned my sanity

But eventually, it worked.

Results:
✅ Generates 500,000 synthetic minutes in ~20 seconds
✅ Passes every statistical test I could throw at it (KS p-value ~0.12)
✅ Preserves volatility clustering, fat tails, and weird microstructure
✅ Strategies tested on synthetic data perform within ~15% of real data out-of-sample

I plan on setting up an API for people to generate their own data and also adding more assets. It feels immensely rewarding to see it working, though I honestly don’t know if it will end up being useful to anyone but me!!

If anyone has any ideas let me know!

on June 30, 2025