Created by: Shiv (ncdevshiv@gmail.com)
Support: β Buy Me a Coffee
The Titan Protocol Bridge is an Ultra-Low Latency, Zero-Copy Direct Memory Access (DMA) Gateway designed to decouple MetaTrader 5 (MT5) from tight database/frontend constraints. It streams high-frequency tick data, Level 2 Deep Order Books (DOM), and Trade Metadata in a strictly normalized, database-agnostic format via Eclipse Iceoryx.
π Support This Project
If you find this project useful, please consider buying me a coffee! Your support helps maintain and improve this open source project.
This guarantees maximum protocol neutrality allowing any consumer (C++, Rust, Go, Python, Svelte via WebSockets, DuckDB, ClickHouse) to attach and receive payloads flawlessly without parsing text strings or writing to disks.
| Component | Status |
|---|---|
| Rust/C++ FFI (CXX Bridge) | |
| Iceoryx Zero-Copy Publishing | |
| CRC32 Validation | |
| Sequence Deduplication | |
| Data Circuit Breaker | |
| Max Slippage Guard | |
| JSON Structured Logging | |
| Release DLL Build |
44 comprehensive tests covering:
- Protocol Module: CRC32 validation, sequence deduplication, gap detection, multi-symbol tracking
- Circuit Breakers: TPS limiting, trip/reset cycles, window rollover
- Max Slippage Guard: Buy/sell validation, price updates, limit enforcement
- Clock Sync: Triple-clock initialization, EMA smoothing, multi-update handling
- Configuration: JSON loading, error handling for missing/malformed configs
- Error Handling: Error code validation, system error creation, context handling
- Protobuf Integration: Tick, DOM, and metadata encoding/decoding
- End-to-End: Full integration tests across all modules
Run tests with:
cargo test- 100% Zero-Copy Streaming: Relies on Iceoryx
iox::popo::Publisherbypassing standard kernel OS socket and file IO overheads. - Rust/C++ FFI via CXX Bridge: Seamless integration between Rust business logic and Iceoryx C++ APIs.
- Fail Loudly Mandate: No silent failures exist. Any missing Iceoryx routers, structural violations, or internal thread poisoning immediately halts processes safely with structured panics mapped to
ErrorCodeenumerations. - Protobuf First: Messages crossing the boundary are encoded in Google Protobuf arrays representing true architectural standardization (
schemas/titan.proto). - Configurable Integrity Guards: Circuit-breakers strictly isolate downstream consumers from bad upstream burst profiles (
DataCircuitBreaker) and malicious pricing deviations (MaxSlippageGuard). - CRC32 Validation: All ticks undergo integrity verification via
crc32fastto detect corrupt DMA transfers. - Sequence Deduplication: Automatic ghost tick filtering and gap detection for reliable streaming.
- JSON Structured Logging: All events logged in structured JSON format with timestamps, modules, and error codes.
- Rust/C++ FFI via CXX Bridge: Full integration with Iceoryx C++ APIs through the
shared_memory.rsbridge. - Iceoryx Zero-Copy Publishing: Tick, book, metadata, and command streams via shared memory.
- CRC32 Validation on All Ticks: Every tick validated for integrity before processing.
- Sequence Deduplication and Gap Detection: Prevents ghost ticks and detects network gaps.
- DataCircuitBreaker with TPS Limiting: Configurable rate limiting with automatic trip/reset.
- MaxSlippageGuard for Execution Validation: Prevents fills beyond acceptable slippage thresholds.
- JSON Structured Logging: Comprehensive logging to stdout and
titan_bridge.log. - 44 Comprehensive Tests: Full unit and integration test coverage.
- Release Build Produces Working DLL:
target/release/titan_bridge.dllready for MT5 integration.
The Bridge operates fundamentally via C++ bindings via CXX bridged through Rust.
- cxx = "1.0" - C++ interoperability
- once_cell = "1.18" - Lazy static initialization
- serde = "1.0" - Serialization framework
- serde_json = "1.0" - JSON serialization
- chrono = "0.4" - Date/time handling
- crc32fast = "1.3" - CRC32 checksum validation
- prost = "0.13" - Protobuf encoding/decoding
- bytes = "1" - Byte buffer utilities
- uuid = "1.8" - Session UUID generation
For Windows:
- Rust Toolchain: Must be explicitly set to standard Windows ABI
stable-x86_64-pc-windows-msvc. - Cargo Configuration: Must include dynamic linking to C Runtime definitions (CRT):
# .cargo/config.toml
[target.x86_64-pc-windows-msvc]
rustflags = ["-C", "target-feature=-crt-static"]- CMake: >=3.18 (for building Iceoryx)
- Protoc: Vendored hermetic Google Protobuf Compiler (included in
protoc_bin/)
- Iceoryx: v2.95.8 (located in
third_party/iceoryx)
Run the Windows PowerShell bootstrap.ps1 script to install all components autonomously:
.\bootstrap.ps1This executes:
- Verification/installation of the Rust toolchain via
rustup - Verification/installation of CMake via
winget - Cloning and building Eclipse Iceoryx RouDi daemon from
third_party/iceoryx - Building the Titan Bridge Rust DLL with dynamic CRT linking
# Ensure CMake is installed and in PATH
# Build Iceoryx manually
cd third_party/iceoryx
cmake -B build -S iceoryx_meta -DBUILD_STRICT=OFF
cmake --build build --config Release
cd ../..
# Build the Rust DLL
cargo build --releaseThe titan_bridge.dll produced in target/release/ is seamlessly loaded into ea/HighPerformanceBridgeEA.mq5.
To run the full simulation locally or execute tests:
cargo clean
set CARGO_TARGET_DIR=target_custom
cargo test
cargo build --releasesrc/
βββ lib.rs # Main DLL entry points and FFI interface
βββ errors.rs # ErrorCode enum and SystemError struct
βββ config.rs # SystemConfig JSON loading
βββ protocol.rs # BinaryTick, ProtocolNormalizer, CRC32 validation
βββ circuit_breakers.rs # DataCircuitBreaker and MaxSlippageGuard
βββ clock_sync.rs # TripleClock and ClockSyncPacket
βββ logger.rs # JSON structured logging
βββ shared_memory.rs # CXX bridge to Iceoryx C++ APIs
βββ pb/ # Generated Protobuf types
βββ titan_iceoryx.cpp # C++ Iceoryx wrapper implementation
βββ titan_iceoryx.hpp # C++ Iceoryx wrapper header
Documentation regarding the agnostic architectures can be referenced directly in:
docs/wiki/architecture.md- System architecture and data flowdocs/wiki/dependencies.md- Complete dependency referencedocs/wiki/error_reference.md- Error codes and recovery strategies
This project is licensed under a Modified Personal Use License.
- β Personal Use: Free for personal, educational, and non-commercial use
- β Open Source: Source code is available and modifiable for personal use
β οΈ Commercial Use: Requires explicit permission. Contact me for commercial licensing
See LICENSE for full terms.
If you find this project useful, please consider supporting its development!
- π Helps fund ongoing development and new features
- π Enables faster bug fixes and improvements
- π Supports documentation and tutorial creation
- π‘ Your contribution directly impacts the project's future
Created with β€οΈ by Shiv
- π§ Email: ncdevshiv@gmail.com
- β Support: Buy Me a Coffee
- π GitHub: Repository managed by creator
For commercial licensing inquiries, bug reports, or feature requests, please reach out!
If you use this project in your research or trading system, please consider buying me a coffee to show your support!