Skip to content

0xTaneja/Kraken-Orderbook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kraken Orderbook Visualizer

Real-time BTC/USD orderbook visualizer built in Rust. Connects to Kraken WebSocket v2.

Features

  • Live orderbook with CRC32 checksum validation
  • Time-travel slider (replay history)
  • Depth chart
  • Heatmap showing liquidity over time

Screenshots

Depth Chart

Heatmap

Run

cargo run --release

What I Learned

Rust

  • Ownership and borrowing
  • Structs and enums for data modeling
  • Pattern matching with match
  • Error handling with Result and ? operator
  • Async/await with tokio
  • Channels (mpsc) for async to sync communication
  • Iterators (.iter(), .enumerate())
  • Type conversions and trait bounds (ToPrimitive)

Orderbook & Market Data

  • How orderbooks work (bids/asks, price levels)
  • Snapshot + delta updates pattern
  • CRC32 checksum for data integrity
  • Desync detection and recovery (resubscribe on mismatch)
  • Cumulative depth calculation

Data Structures

  • im::OrdMap - persistent data structure with structural sharing
  • Why cheap clones matter for time-travel/history
  • Ring buffer concept for bounded memory

Visualization

  • egui immediate mode UI (rebuilt every frame)
  • Custom drawing with Painter
  • Coordinate mapping (price to Y-pixel)
  • Color intensity from quantity values
  • Heatmap concept: X=time, Y=price, Color=liquidity

About

Rust orderbook visualizer with depth chart, heatmap, and time-travel. Kraken WebSocket v2.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages