{"id":29308561,"url":"https://github.com/pythonicflow/orderbook-heatmap-rs","last_synced_at":"2025-07-07T07:12:37.465Z","repository":{"id":303158541,"uuid":"1014578732","full_name":"pythonicflow/orderbook-heatmap-rs","owner":"pythonicflow","description":"High-performance temporal orderbook heatmap generator from historical MBO data","archived":false,"fork":false,"pushed_at":"2025-07-06T02:48:04.000Z","size":166,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-06T03:27:03.701Z","etag":null,"topics":["finance","financial-data-visualization","heatmap","orderbook","rust"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pythonicflow.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-06T02:11:37.000Z","updated_at":"2025-07-06T02:48:08.000Z","dependencies_parsed_at":"2025-07-06T03:27:06.188Z","dependency_job_id":"60b1e8d5-ff7d-4a5e-8e38-3964f6259c31","html_url":"https://github.com/pythonicflow/orderbook-heatmap-rs","commit_stats":null,"previous_names":["pythonicflow/orderbook-heatmap-rs"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pythonicflow/orderbook-heatmap-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pythonicflow%2Forderbook-heatmap-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pythonicflow%2Forderbook-heatmap-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pythonicflow%2Forderbook-heatmap-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pythonicflow%2Forderbook-heatmap-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pythonicflow","download_url":"https://codeload.github.com/pythonicflow/orderbook-heatmap-rs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pythonicflow%2Forderbook-heatmap-rs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264032310,"owners_count":23546809,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["finance","financial-data-visualization","heatmap","orderbook","rust"],"created_at":"2025-07-07T07:12:36.726Z","updated_at":"2025-07-07T07:12:37.453Z","avatar_url":"https://github.com/pythonicflow.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# High-Performance MBO Data Processor\n\nUltra-fast Rust implementation for processing Market-By-Order (MBO) financial data with advanced parallel optimization.\n\n![Rust](https://img.shields.io/badge/rust-%23000000.svg?style=for-the-badge\u0026logo=rust\u0026logoColor=white)\n![Performance](https://img.shields.io/badge/Performance-220K_records%2Fs-brightgreen?style=for-the-badge)\n![Multi-Core](https://img.shields.io/badge/Multi--Core-157%25_CPU-blue?style=for-the-badge)\n\n## Performance Highlights\n\n- **33 seconds** to process 7.4M records (220K records/second)\n- **100% speedup (2x faster)** through systematic optimization\n- **157% CPU utilization** with multi-core parallelization\n- **Memory efficient** processing with ~2GB peak usage\n\n## Project Overview\n\nThis project processes Market-By-Order data from Databento API to generate temporal orderbook heatmap visualizations. The implementation demonstrates high-performance systems programming in Rust with focus on parallel computing and financial data processing.\n\n### Sample Output\n\n![Temporal Heatmap](sample_heatmap.png)\n\n*Temporal orderbook heatmap showing bid/ask liquidity dynamics over time*\n\n## Technical Architecture\n\n```\nDatabento API → Parquet Files → Rust Processor → Heatmap Visualization\n```\n\n**Core Technologies:**\n- **Rust** - Memory-safe systems programming\n- **Arrow/Parquet** - Efficient columnar data processing  \n- **Rayon** - Data parallelism library\n- **Plotters** - Chart generation\n\n**Key Optimizations:**\n- Parallel sorting of 7.4M records\n- Batch processing with 8K-record chunks\n- Multi-core matrix operations\n- Memory-efficient data structures\n\n## Data Processing\n\n### Dataset Characteristics\n- **Source**: Databento MBO data (ES Futures)\n- **Size**: 7,449,892 records\n- **Timespan**: June 27, 2025 (12:58 - 20:00 UTC)  \n- **Format**: Parquet (columnar storage)\n\n### Sample Data Structure\n```\nts_event                    | action | side | price   | size | order_id      | is_last\n2025-06-27T12:57:59.289Z   | A      | B    | 5347.25 | 2    | 6414887578666 | 0\n2025-06-27T12:57:59.289Z   | A      | A    | 5348.00 | 3    | 6414952718121 | 0  \n2025-06-27T12:57:59.290Z   | M      | B    | 5347.25 | 5    | 6414887578666 | 0\n2025-06-27T12:57:59.291Z   | C      | A    | 5348.00 | 1    | 6414952718121 | 1\n```\n\n**Field Descriptions:**\n- `ts_event`: Event timestamp (nanosecond precision)\n- `action`: Order action (A=Add, M=Modify, C=Cancel, R=Reset)\n- `side`: Order side (B=Bid, A=Ask)\n- `price`: Order price level\n- `size`: Order quantity\n- `order_id`: Unique identifier\n- `is_last`: Event group boundary marker\n\n## Performance Engineering\n\n### Optimization Journey\n1. **Baseline**: 66.1 seconds (single-thread, 1K batches)\n2. **Batch optimization**: 62.1 seconds (4K batches) → 6% improvement\n3. **Parallel processing**: 36.2 seconds (multi-core) → 45% improvement\n4. **Final tuning**: 33.3 seconds (8K batches) → 100% speedup (2x faster)\n\n**Results:**\n- CPU utilization: 85% → 157% (effective multi-core usage)\n- Memory usage: Stable ~2GB across optimizations\n- Processing rate: 112K → 220K records/second\n\n## Technical Implementation\n\n### Orderbook Processing\nThe system reconstructs historical orderbook state by processing MBO actions:\n- **Add orders**: Insert new orders into price-time priority queue\n- **Modify orders**: Update existing order size/price\n- **Cancel orders**: Remove orders from book\n- **Reset**: Clear entire orderbook state\n\n### Temporal Snapshots\nOrderbook snapshots are captured at event boundaries (is_last=1), creating a time series of market depth states. This produces 5.8M temporal snapshots for visualization.\n\n### Heatmap Generation\n- **Blue gradients**: Bid liquidity (buy orders)\n- **Red gradients**: Ask liquidity (sell orders)\n- **Intensity**: Proportional to order size\n- **Resolution**: 1600×1000 pixels with time/price axes\n\n## Use Cases\n\n- **Quantitative Finance**: Market microstructure analysis\n- **Algorithmic Trading**: Order flow pattern recognition  \n- **Risk Management**: Historical liquidity analysis\n- **Academic Research**: Financial market dynamics studies\n- **Data Engineering**: High-throughput ETL pipelines\n\n## Skills Demonstrated\n\n**Systems Programming:**\n- Memory management and zero-copy optimizations\n- Thread-safe parallel processing with Rust\n- Performance profiling and bottleneck identification\n\n**Financial Technology:**\n- Market data processing (MBO Level 3 data)\n- Orderbook reconstruction and state management\n- Financial data visualization and time-series analysis\n\n**Performance Engineering:**\n- Systematic optimization methodology\n- Multi-core computing with 157% CPU utilization\n- 100% speedup (2x faster) through iteration\n\n## Portfolio Value\n\nThis project showcases:\n- Advanced Rust programming with parallel computing\n- Financial technology domain expertise\n- High-performance computing optimization\n- Production-ready system architecture\n- Data visualization and analysis capabilities\n\n---\n\n**Note**: This is a portfolio demonstration showcasing technical skills. Complete source code available for technical evaluation.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpythonicflow%2Forderbook-heatmap-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpythonicflow%2Forderbook-heatmap-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpythonicflow%2Forderbook-heatmap-rs/lists"}