Skip to content

Recipe: Animate Backtest Performance

Goal

Create a single HD animation that focuses only on cumulative strategy outcome versus uniform DCA.

Command

stacksats strategy animate \
  --backtest-json output/<strategy_id>/<version>/<run_id>/backtest_result.json \
  --output-dir output/<strategy_id>/<version>/<run_id> \
  --output-name strategy_vs_uniform_hd.gif \
  --video-format mp4 \
  --fps 20 \
  --width 1920 \
  --height 1080 \
  --max-frames 240 \
  --window-mode non-overlapping

What the animation shows

  • A single cumulative BTC advantage versus uniform DCA panel (%) over time, with positive/negative area fill.
  • Overlay counters for current excess percentile and win-rate-to-date.
  • Milestone callouts when the cumulative series reaches notable highs/lows or changes direction.

Window modes

  • rolling (default):
  • Uses all eligible rolling windows, then deterministic downsampling (--max-frames).
  • Best when you want the cumulative curve to reflect the fullest possible sequence of eligible windows.
  • non-overlapping:
  • Uses a non-overlapping subset of windows before downsampling.
  • Recommended for external communication where overlap bias can be misleading.

Render-time tradeoffs

  • Higher --width/--height increases clarity and file size.
  • Higher --fps increases smoothness and size.
  • --max-frames is the main runtime bound:
  • lower values render faster,
  • higher values preserve more timeline detail.

Output artifacts

  • GIF: strategy_vs_uniform_hd.gif (or --output-name)
  • Video: strategy_vs_uniform_hd.mp4 or .webm when --video-format is set
  • Manifest: animation_manifest.json with frame/render metadata

Shareable defaults

  • Use --window-mode non-overlapping for stakeholder-facing exports.
  • Use --video-format mp4 when you want a sharper primary artifact than GIF.
  • Keep the GIF for compatibility and lightweight previews.
  • Video export requires a system ffmpeg binary.