{"id":34674882,"url":"https://github.com/krish567366/submicro-execution-engine","last_synced_at":"2025-12-24T20:21:00.579Z","repository":{"id":328800893,"uuid":"1116578846","full_name":"krish567366/submicro-execution-engine","owner":"krish567366","description":"Sub-microsecond bare-metal execution engine with deterministic replay, lock-free order path, and hardware-timestamped latency measurement.","archived":false,"fork":false,"pushed_at":"2025-12-15T19:31:47.000Z","size":2338,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-18T13:18:34.632Z","etag":null,"topics":["algorithmic-trading","backtesting-engine","cpp17","deterministic","educational","hawkes-process","hft","hft-trading","high-frequency-trading","kernal-driver","lock-free","market-making","market-microstructure","market-microstructure-theory","order-book","quantitative-finance","research","simd","ultra-low-latency","zero-copy"],"latest_commit_sha":null,"homepage":"https://submicro.krishnabajpai.me/","language":"Python","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/krish567366.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-15T04:50:28.000Z","updated_at":"2025-12-18T07:07:17.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/krish567366/submicro-execution-engine","commit_stats":null,"previous_names":["krish567366/submicro-execution-engine"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/krish567366/submicro-execution-engine","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krish567366%2Fsubmicro-execution-engine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krish567366%2Fsubmicro-execution-engine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krish567366%2Fsubmicro-execution-engine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krish567366%2Fsubmicro-execution-engine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/krish567366","download_url":"https://codeload.github.com/krish567366/submicro-execution-engine/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krish567366%2Fsubmicro-execution-engine/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28007912,"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","status":"online","status_checked_at":"2025-12-24T02:00:07.193Z","response_time":83,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["algorithmic-trading","backtesting-engine","cpp17","deterministic","educational","hawkes-process","hft","hft-trading","high-frequency-trading","kernal-driver","lock-free","market-making","market-microstructure","market-microstructure-theory","order-book","quantitative-finance","research","simd","ultra-low-latency","zero-copy"],"created_at":"2025-12-24T20:20:59.849Z","updated_at":"2025-12-24T20:21:00.564Z","avatar_url":"https://github.com/krish567366.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n```\n╔═══════════════════════════════════════════════════════════════════════════════╗\n║                                                                               ║\n║   ███████╗██╗   ██╗██████╗ ███╗   ███╗██╗ ██████╗██████╗  ██████╗            ║\n║   ██╔════╝██║   ██║██╔══██╗████╗ ████║██║██╔════╝██╔══██╗██╔═══██╗           ║\n║   ███████╗██║   ██║██████╔╝██╔████╔██║██║██║     ██████╔╝██║   ██║           ║\n║   ╚════██║██║   ██║██╔══██╗██║╚██╔╝██║██║██║     ██╔══██╗██║   ██║           ║\n║   ███████║╚██████╔╝██████╔╝██║ ╚═╝ ██║██║╚██████╗██║  ██║╚██████╔╝           ║\n║   ╚══════╝ ╚═════╝ ╚═════╝ ╚═╝     ╚═╝╚═╝ ╚═════╝╚═╝  ╚═╝ ╚═════╝            ║\n║                                                                               ║\n║            Sub-Microsecond Execution Engine for Algorithmic Trading          ║\n╚═══════════════════════════════════════════════════════════════════════════════╝\n```\n\n\u003ch1\u003e🚀 Ultra-Low Latency Trading System\u003c/h1\u003e\n\n\u003cp\u003e\n\u003cb\u003eDeterministic, nanosecond-precise execution engine for quantitative trading research\u003c/b\u003e\n\u003c/p\u003e\n\n[![Build Status](https://img.shields.io/badge/build-passing-brightgreen?style=for-the-badge)](.)\n[![C++17](https://img.shields.io/badge/C%2B%2B-17-blue?style=for-the-badge\u0026logo=cplusplus)](.)\n[![Rust](https://img.shields.io/badge/Rust-1.70%2B-orange?style=for-the-badge\u0026logo=rust)](.)\n[![License](https://img.shields.io/badge/license-MIT-green?style=for-the-badge)](LICENSE)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen?style=for-the-badge)](.)\n\n\u003cp\u003e\n\u003ca href=\"https://submicro.krishnabajpai.me/\"\u003e🌐 Live Demo\u003c/a\u003e •\n\u003ca href=\"#-key-features\"\u003eFeatures\u003c/a\u003e •\n\u003ca href=\"#-quick-start\"\u003eQuick Start\u003c/a\u003e •\n\u003ca href=\"#-benchmarks\"\u003eBenchmarks\u003c/a\u003e •\n\u003ca href=\"#-architecture\"\u003eArchitecture\u003c/a\u003e •\n\u003ca href=\"#-documentation\"\u003eDocs\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\n### ⚡ **890ns median latency** | 🎯 **Deterministic replay** | 🔒 **Lock-free architecture** | 🧪 **Research-grade framework**\n\n**[👉 View Interactive Documentation →](https://submicro.krishnabajpai.me/)**\n\n\u003c/div\u003e\n\n---\n\n## 🎯 What Makes This Special?\n\n\u003e **Built for researchers and systems engineers pushing the boundaries of low-latency execution.**\n\nThis isn't just another trading bot. It's a **complete infrastructure** for understanding, measuring, and optimizing execution latency at the **hardware level**.\n\n### 💎 The Problem\nTraditional trading systems are black boxes with unpredictable latency, non-deterministic behavior, and poor visibility into where microseconds are lost.\n\n### 🎁 The Solution\nA **transparent, deterministic execution engine** that:\n- ✅ Achieves **sub-microsecond decision latency** (890ns median)\n- ✅ Guarantees **bit-identical replay** for audit and debugging\n- ✅ Provides **nanosecond-level instrumentation** at every stage\n- ✅ Uses **zero-allocation hot paths** and lock-free data structures\n- ✅ Simulates **kernel-bypass networking** (DPDK-style)\n- ✅ Implements **institutional-grade logging** and monitoring\n\n⚠️ **Research \u0026 Education Only** — Not production-ready. No exchange connectivity included.\n\n## 📊 Performance Snapshot\n\n\u003cdiv align=\"center\"\u003e\n\n| 🎯 **Component** | ⚡ **Median** | 📈 **p99** | 🔝 **p99.9** | \n|------------------|--------------|-----------|--------------|\n| Market Data Ingestion | **87 ns** | 124 ns | 201 ns |\n| Signal Extraction (SIMD) | **40 ns** | 48 ns | 67 ns |\n| Hawkes Update (Power-Law) | **150 ns** | 189 ns | 234 ns |\n| **End-to-End Decision** | **890 ns** | **921 ns** | **1047 ns** |\n| Order Serialization | **34 ns** | 41 ns | 58 ns |\n\n**🔬 Measurement Precision:** ±5ns (TSC jitter) | ±17ns (PTP offset)  \n**🖥️ Test Hardware:** Intel Xeon Platinum 8280 @ 2.7GHz, isolated core, RT kernel\n\n\u003c/div\u003e\n\n---\n\n## 🔥 Key Features\n\n\u003ctable\u003e\n\u003ctr\u003e\n\u003ctd width=\"50%\"\u003e\n\n### ⚡ **Performance**\n- 🚀 Sub-microsecond decision latency\n- 🔄 Zero-copy data paths\n- 🧵 Lock-free SPSC/MPSC queues\n- 💾 Cache-aligned data structures\n- 🎯 SIMD-optimized computations (AVX-512)\n\n\u003c/td\u003e\n\u003ctd width=\"50%\"\u003e\n\n### 🎯 **Determinism**\n- 🔁 Bit-identical replay guarantees\n- 📝 Event-driven scheduling\n- 🎲 Fixed RNG seeds\n- 🔒 Pre-allocated memory pools\n- ⏱️ TSC-level timestamp precision\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd width=\"50%\"\u003e\n\n### 🏗️ **Architecture**\n- 🌐 Kernel-bypass NIC simulation\n- 🧠 Multivariate Hawkes process\n- 📊 Avellaneda-Stoikov market making\n- 🛡️ Adaptive risk management\n- 🔌 C++/Rust FFI integration\n\n\u003c/td\u003e\n\u003ctd width=\"50%\"\u003e\n\n### 📈 **Observability**\n- 📊 Real-time metrics dashboard\n- 📝 Multi-layer audit logging\n- 🔍 SHA-256 replay verification\n- ⏱️ Nanosecond-level tracing\n- 📉 Latency breakdown analysis\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n---\n\n## 🎬 Quick Start\n\n**Get running in 60 seconds:**\n\n```bash\n# 1️⃣ Clone the repository\ngit clone https://github.com/krish567366/submicro-execution-engine.git\ncd submicro-execution-engine\n\n# 2️⃣ Build the system (automatic optimization flags)\n./build_all.sh\n\n# 3️⃣ Run deterministic backtest\n./run_backtest.py\n\n# 4️⃣ View results\npython3 verify_latency.py\nopen dashboard/index.html  # Interactive metrics dashboard\n```\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003e📺 Expected Output (click to expand)\u003c/b\u003e\u003c/summary\u003e\n\n```\n=== Low-Latency Trading System ===\n✓ Market data ingestion: 87ns median\n✓ Signal extraction: 40ns median  \n✓ Hawkes update: 150ns median\n✓ Decision latency: 890ns median\n\n--- Cycle: 1000 ---\nMid Price: $100.05\nPosition: 250\nActive Quotes: Bid=100.04 Ask=100.06 Spread=2.00 bps\nHawkes: Buy=12.456 Sell=11.234 Imbalance=0.052\nRegime: NORMAL (multiplier=1.0)\nLast Cycle Latency: 847 ns (0.847 µs)\n✓ Determinism verified: SHA-256 match\n```\n\n\u003c/details\u003e\n\n---\n\n## 🏛️ Architecture Overview\n\n\u003cdiv align=\"center\"\u003e\n\n```\n┌─────────────────────────────────────────────────────────────────────────────┐\n│                         📡 Market Data Feed (Simulated)                      │\n│                    Kernel-Bypass NIC • Zero-Copy DMA Transfer                │\n└───────────────────────────────┬─────────────────────────────────────────────┘\n                                │ 87ns median\n                                ▼\n┌─────────────────────────────────────────────────────────────────────────────┐\n│                    🔄 Lock-Free Ring Buffer (SPSC)                           │\n│              Power-of-2 Size • Cache-Line Aligned • No Allocations           │\n└───────────────────────────────┬─────────────────────────────────────────────┘\n                                │ O(1) operations\n                                ▼\n┌─────────────────────────────────────────────────────────────────────────────┐\n│                   📖 Order Book Reconstruction                               │\n│            Price-Level Aggregation • L2 Depth Tracking                       │\n└───────────────────────────────┬─────────────────────────────────────────────┘\n                                │\n                ┌───────────────┴───────────────┐\n                ▼                               ▼\n┌─────────────────────────────┐   ┌─────────────────────────────────────────┐\n│   🔥 Hawkes Process Engine   │   │  📊 Microstructure Features             │\n│   • Self/Cross Excitation    │   │  • Deep OFI (10 levels)                 │\n│   • Power-Law Kernel         │   │  • Order Book Imbalance                 │\n│   • Buy/Sell Intensity       │   │  • Flow Toxicity (Kyle λ)               │\n└──────────────┬────────────────┘   └──────────────┬──────────────────────────┘\n               │  150ns median                     │ 40ns (SIMD)\n               └───────────────┬───────────────────┘\n                               ▼\n┌─────────────────────────────────────────────────────────────────────────────┐\n│                  🧠 FPGA DNN Inference (Simulated)                           │\n│              12 Features → 8 Hidden → 3 Outputs • 400ns Fixed                │\n└───────────────────────────────┬─────────────────────────────────────────────┘\n                                │\n                                ▼\n┌─────────────────────────────────────────────────────────────────────────────┐\n│              💰 Avellaneda-Stoikov Market Making Strategy                    │\n│        HJB Equation • Inventory Skew • Latency-Aware Pricing                 │\n└───────────────────────────────┬─────────────────────────────────────────────┘\n                                │ 890ns E2E\n                                ▼\n┌─────────────────────────────────────────────────────────────────────────────┐\n│                    🛡️ Risk Control (Pre-Trade + Kill-Switch)                │\n│          Position Limits • Regime Detection • Atomic Checks                  │\n└───────────────────────────────┬─────────────────────────────────────────────┘\n                                │ 34ns serialization\n                                ▼\n┌─────────────────────────────────────────────────────────────────────────────┐\n│                       📤 Order Submission                                    │\n│                  Pre-Serialized Orders • Zero Copy                           │\n└─────────────────────────────────────────────────────────────────────────────┘\n```\n\n\u003c/div\u003e\n\n\u003e **See [`ARCHITECTURE.md`](ARCHITECTURE.md) for detailed component documentation**\n\n---\n\n## 🎯 Determinism \u0026 Reproducibility\n\nOne of the system's **core guarantees** is bit-identical replay capability:\n\n✅ **Fixed RNG seeds** — Deterministic random number generation  \n✅ **Event-driven scheduling** — No wall-clock dependencies  \n✅ **Pre-allocated memory** — No allocator non-determinism  \n✅ **Timestamp-ordered events** — Consistent processing order  \n\n### Verification\n\n```bash\n# Run backtest\n./run_backtest.py\n\n# Verify deterministic replay\ncd logs\nsha256sum -c MANIFEST.sha256\n✓ strategy_trace.log: OK\n✓ order_flow.log: OK\n✓ latency_metrics.log: OK\n```\n\n**TSC-level reproducibility proof:** See `logs/strategy_trace.log`\n\n---\n\n## 📚 Complete Documentation\n\n| 📄 Document | Description |\n|------------|-------------|\n| [`ARCHITECTURE.md`](ARCHITECTURE.md) | Order path, cache layout, thread model |\n| [`BENCHMARK_GUIDE.md`](BENCHMARK_GUIDE.md) | Latency measurement methodology |\n| [`LATENCY_BUDGET.md`](LATENCY_BUDGET.md) | Component-level breakdown |\n| [`INSTITUTIONAL_LOGGING_COMPARISON.md`](INSTITUTIONAL_LOGGING_COMPARISON.md) | Audit-grade logging |\n| [`PRODUCTION_READINESS.md`](PRODUCTION_READINESS.md) | Deployment considerations |\n| `logs/README.md` | Multi-layer timestamp verification |\n\n---\n\n## 🤝 Contributing\n\nWe welcome contributions! Here's how to get started:\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003e🐛 Report a Bug\u003c/b\u003e\u003c/summary\u003e\n\nOpen an issue with:\n- System configuration (CPU, OS, compiler)\n- Reproducible example\n- Expected vs actual behavior\n- Relevant logs\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003e💡 Propose a Feature\u003c/b\u003e\u003c/summary\u003e\n\n1. Check existing issues/PRs\n2. Open an issue describing the feature\n3. Discuss implementation approach\n4. Submit a PR with tests\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003e🔧 Submit a Pull Request\u003c/b\u003e\u003c/summary\u003e\n\n1. Fork the repository\n2. Create a feature branch (`git checkout -b feature/amazing-feature`)\n3. Make your changes with tests\n4. Ensure `ctest` and `cargo test` pass\n5. Commit with clear messages\n6. Push and open a PR\n\n\u003c/details\u003e\n\n### Development Guidelines\n\n- **Code style:** Follow existing patterns (run `clang-format`)\n- **Tests:** Add tests for new features\n- **Benchmarks:** Measure latency impact\n- **Documentation:** Update relevant markdown files\n\n---\n\n## 🌟 Star History\n\n[![Star History Chart](https://api.star-history.com/svg?repos=krish567366/submicro-execution-engine\u0026type=Date)](https://star-history.com/#krish567366/submicro-execution-engine\u0026Date)\n\n---\n\n## 📖 Academic References\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eClick to expand bibliography\u003c/b\u003e\u003c/summary\u003e\n\n### Hawkes Processes\n1. **Hawkes, A. G. (1971).** \"Specular Point Processes\" *Biometrika*\n2. **Bacry, E., et al. (2015).** \"Hawkes Processes in Finance\" *Market Microstructure and Liquidity*\n\n### Market Making\n3. **Avellaneda, M., \u0026 Stoikov, S. (2008).** \"High-frequency trading in a limit order book\" *Quantitative Finance*\n4. **Guéant, O., et al. (2013).** \"Dealing with the inventory risk\" *Mathematics and Financial Economics*\n\n### Market Microstructure\n5. **Cartea, Á., et al. (2015).** \"Algorithmic and High-Frequency Trading\" *Cambridge University Press*\n6. **Lehalle, C.-A., \u0026 Laruelle, S. (2018).** \"Market Microstructure in Practice\" *World Scientific*\n7. **Easley, D., et al. (2012).** \"Flow Toxicity and Liquidity in a High-Frequency World\" *Review of Financial Studies*\n\n### System Design\n8. **Nygren, E. (2015).** \"Linux Kernel Development for Real-Time Systems\" *O'Reilly*\n9. **Gregg, B. (2013).** \"Systems Performance: Enterprise and the Cloud\" *Prentice Hall*\n\n\u003c/details\u003e\n\n---\n\n## ⚠️ Important Disclaimers\n\n\u003cdiv align=\"center\"\u003e\n\n### 🚨 **RESEARCH \u0026 EDUCATION ONLY** 🚨\n\n\u003c/div\u003e\n\nThis system is **NOT**:\n- ❌ Production-ready trading software\n- ❌ Connected to any exchanges\n- ❌ Financial advice or recommendation\n- ❌ Guaranteed to be profitable\n\nThis system **IS**:\n- ✅ A research framework\n- ✅ An educational tool\n- ✅ A latency benchmarking platform\n- ✅ A deterministic execution skeleton\n\n**Real production HFT requires:**\n- Hardware FPGA acceleration (Xilinx, Altera)\n- True kernel-bypass (DPDK, Solarflare OpenOnload)\n- Exchange connectivity (FIX, proprietary protocols)\n- Compliance systems (kill-switches, position limits)\n- Risk management infrastructure\n- Extensive testing and regulatory approval\n\n**⚖️ Legal:** No warranty. Use at your own risk. See LICENSE for details.\n\n---\n\n## 📧 Contact \u0026 Community\n\n\u003cdiv align=\"center\"\u003e\n\n**Questions? Ideas? Collaboration?**\n\n[![GitHub Issues](https://img.shields.io/badge/Issues-Open-blue?style=for-the-badge\u0026logo=github)](https://github.com/krish567366/submicro-execution-engine/issues)\n[![Discussions](https://img.shields.io/badge/Discussions-Join-green?style=for-the-badge\u0026logo=github)](https://github.com/krish567366/submicro-execution-engine/discussions)\n[![Email](https://img.shields.io/badge/Email-Contact-red?style=for-the-badge\u0026logo=gmail)](mailto:your-email@example.com)\n\n\u003c/div\u003e\n\n### Related Projects\n\n- [DPDK](https://www.dpdk.org/) — Data Plane Development Kit\n- [Solarflare OpenOnload](https://www.xilinx.com/products/design-tools/software-zone/openonload.html) — Kernel-bypass networking\n- [Folly](https://github.com/facebook/folly) — Facebook's lock-free structures\n- [QuantLib](https://www.quantlib.org/) — Quantitative finance library\n\n---\n\n\u003cdiv align=\"center\"\u003e\n\n## 🚀 **Built for Speed. Designed for Reliability. Optimized for Discovery.**\n\n### If you find this useful, please ⭐ **star the repository** ⭐\n\n\u003csub\u003eMade with ❤️ by quantitative systems engineers\u003c/sub\u003e\n\n---\n\n**📊 Trading • ⚡ Low-Latency • 🔬 Research • 💻 Open Source**\n\n\u003c/div\u003e\n\n---\n\n## 📝 License\n\nMIT License - See [LICENSE](LICENSE) file for details\n\nCopyright (c) 2025 [Your Name]\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrish567366%2Fsubmicro-execution-engine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkrish567366%2Fsubmicro-execution-engine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrish567366%2Fsubmicro-execution-engine/lists"}