{"id":45157326,"url":"https://github.com/chizy7/pinnaclemm","last_synced_at":"2026-03-03T03:23:00.880Z","repository":{"id":277262492,"uuid":"931683332","full_name":"chizy7/PinnacleMM","owner":"chizy7","description":"Ultra-Low Latency Market Making Bot using C++.","archived":false,"fork":false,"pushed_at":"2025-12-15T02:19:29.000Z","size":1762,"stargazers_count":10,"open_issues_count":11,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-17T17:05:53.173Z","etag":null,"topics":["algorithmic-trading","cpp","low-latency","quantitative-finance"],"latest_commit_sha":null,"homepage":"https://pinnaclemm.io/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chizy7.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":"docs/ROADMAP.md","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-02-12T17:26:01.000Z","updated_at":"2025-12-15T02:19:32.000Z","dependencies_parsed_at":"2025-02-13T02:27:59.675Z","dependency_job_id":"ad8b9d74-7f38-43d3-8f35-12028e642448","html_url":"https://github.com/chizy7/PinnacleMM","commit_stats":null,"previous_names":["chizy7/pinnaclemm"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/chizy7/PinnacleMM","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chizy7%2FPinnacleMM","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chizy7%2FPinnacleMM/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chizy7%2FPinnacleMM/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chizy7%2FPinnacleMM/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chizy7","download_url":"https://codeload.github.com/chizy7/PinnacleMM/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chizy7%2FPinnacleMM/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29641929,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-20T03:21:14.183Z","status":"ssl_error","status_checked_at":"2026-02-20T03:18:24.455Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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","cpp","low-latency","quantitative-finance"],"created_at":"2026-02-20T05:01:45.540Z","updated_at":"2026-03-03T03:23:00.871Z","avatar_url":"https://github.com/chizy7.png","language":"C++","readme":"\u003cdiv align=\"center\"\u003e\n  \u003cpicture\u003e\n    \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\".images/pinnaclemm-high-resolution-logo-transparent.svg\"\u003e\n    \u003csource media=\"(prefers-color-scheme: light)\" srcset=\".images/pinnaclemm-high-resolution-logo-grayscale-transparent.svg\"\u003e\n    \u003cimg alt=\"PinnacleMM Logo\" src=\".images/pinnaclemm-high-resolution-logo-transparent.svg\" width=\"750\" height=100\"\u003e\n  \u003c/picture\u003e\n\n  \u003ch1\u003eUltra-Low Latency Market Making System\u003c/h1\u003e\n\n  \u003cp\u003e\n    \u003ca href=\"https://github.com/chizy7/PinnacleMM/blob/main/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/badge/license-MIT-blue.svg\" alt=\"License\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/chizy7/PinnacleMM\"\u003e\u003cimg src=\"https://img.shields.io/badge/C%2B%2B-20-blue.svg\" alt=\"C++\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/chizy7/PinnacleMM/releases\"\u003e\u003cimg src=\"https://img.shields.io/github/v/release/chizy7/PinnacleMM?include_prereleases\" alt=\"Release\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/chizy7/PinnacleMM/actions/workflows/ci.yml\"\u003e\u003cimg src=\"https://github.com/chizy7/PinnacleMM/workflows/Build/badge.svg\" alt=\"Build Status\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/chizy7/PinnacleMM\"\u003e\u003cimg src=\"https://img.shields.io/badge/latency-microsecond-blue.svg\" alt=\"Performance\"\u003e\u003c/a\u003e\n  \u003c/p\u003e\n\n  \u003cp\u003e\n    \u003ca href=\"docs/user_guide/getting_started.md\"\u003eGetting Started\u003c/a\u003e\u0026nbsp;\u0026nbsp;•\u0026nbsp;\u0026nbsp;\n    \u003ca href=\"docs/architecture/system_overview.md\"\u003eArchitecture\u003c/a\u003e\u0026nbsp;\u0026nbsp;•\u0026nbsp;\u0026nbsp;\n    \u003ca href=\"docs/ORDER_ROUTING.md\"\u003eOrder Routing\u003c/a\u003e\u0026nbsp;\u0026nbsp;•\u0026nbsp;\u0026nbsp;\n    \u003ca href=\"docs/PERFORMANCE_BENCHMARKS.md\"\u003ePerformance Benchmarks\u003c/a\u003e\u0026nbsp;\u0026nbsp;•\u0026nbsp;\u0026nbsp;\n    \u003ca href=\"docs/api/reference.md\"\u003eAPI Reference\u003c/a\u003e\u0026nbsp;\u0026nbsp;•\u0026nbsp;\u0026nbsp;\n    \u003ca href=\"docs/exchange/connector_guide.md\"\u003eExchange Connectors\u003c/a\u003e\u0026nbsp;\u0026nbsp;•\u0026nbsp;\u0026nbsp;\n    \u003ca href=\"docs/MULTI_INSTRUMENT_GUIDE.md\"\u003eMulti-Instrument\u003c/a\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\nPinnacleMM is a high-performance, production-grade market making system designed for high-frequency trading in cryptocurrency markets. Built primarily in C++ with a focus on ultra-low latency, this system achieves microsecond-level execution speeds while maintaining robust risk management capabilities.\n\n## Key Features\n\n- **Ultra-Low Latency Core**: Optimized C++ engine with lock-free data structures\n- **Nanosecond Precision**: High-resolution timing for accurate execution\n- **Crash Recovery**: Memory-mapped persistence system for reliable operation\n- **Dynamic Market Making**: Adaptive bid-ask spread based on market conditions\n- **Position Management**: Intelligent inventory management with customizable risk parameters\n- **Exchange Simulation**: Realistic market simulation for strategy development and testing\n- **Live Exchange Connectivity**: Real-time connection to Coinbase Pro WebSocket feeds\n- **FIX Protocol Support**: Professional-grade FIX connectivity for institutional exchanges\n- **Advanced Order Routing**: Smart order routing with 4 algorithms (BEST_PRICE, TWAP, VWAP, MARKET_IMPACT)\n- **Multi-Venue Execution**: Intelligent order distribution across multiple exchanges\n- **ML-Enhanced Trading**: Neural network-based spread optimization with sub-microsecond predictions\n- **Market Regime Detection**: Real-time detection of 8 market regimes using Hidden Markov Models\n- **Predictive Analytics**: Market impact prediction and reinforcement learning parameter adaptation\n- **Advanced Backtesting**: Historical data replay with Monte Carlo analysis and A/B testing\n- **Real-Time Visualization**: Professional web dashboard with live performance monitoring (access at `visualization/static/index.html` when running with `--enable-visualization`)\n- **Structured Data Export**: JSON Lines (JSONL) logging for market data, strategy metrics, and trading events with `--json-log` flag\n- **Risk Management**: Pre-trade risk checks (~750ns), position/exposure limits, drawdown tracking, daily loss limits, and auto-hedging\n- **Circuit Breaker**: Automatic market halt on rapid price moves, spread widening, volume spikes, latency degradation, or crisis regime detection\n- **Real-Time VaR**: Value at Risk using historical, parametric, and Monte Carlo (10K simulations) methods with lock-free double-buffered reads\n- **Alerting System**: 16 alert types with throttling, severity levels, and WebSocket delivery to the dashboard\n- **Disaster Recovery**: Atomic risk state persistence, position reconciliation, and labeled backup management\n- **Kubernetes Deployment**: Production-ready StatefulSet with health probes, PVC, network policies, and pod disruption budget\n- **Enterprise Security**: AES-256-CBC encryption with unique salts, 100,000 PBKDF2 iterations, secure password input, comprehensive input validation, audit logging, rate limiting, and certificate pinning\n- **Multi-Instrument Trading**: Simultaneous trading across multiple symbols with `InstrumentManager` orchestration\n- **Cross-Exchange Arbitrage**: Venue price discrepancy detection with fee-adjusted opportunity scanning and dry-run execution\n- **Cross-Market Correlation**: Pearson/rolling correlation, lead-lag analysis, Engle-Granger cointegration, and signal-based spread adjustment\n- **Per-Symbol Risk Tracking**: Atomic per-symbol position, PnL, and volume tracking with configurable per-symbol limits\n- **Dynamic Resource Allocation**: CPU core distribution and thread pinning for multi-instrument deployments\n- **Comprehensive Testing**: Extensive test suite ensuring reliability and performance\n\n## System Architecture\n\nPinnacleMM follows a modular, layered architecture:\n\n- **Core Engine Layer**: Ultra-low latency components handling order book and execution\n- **Risk Layer**: Pre-trade checks, circuit breaker, VaR engine, alerting, and disaster recovery\n- **Strategy Layer**: Pluggable strategies for different market making approaches\n- **Exchange Layer**: Multi-protocol connectivity (WebSocket, FIX) with simulation capabilities\n- **Persistence Layer**: Memory-mapped file system for crash recovery\n\nRead more about the [system architecture](docs/architecture/system_overview.md).\n\n## Getting Started\n\n### Prerequisites\n\n- C++20 compatible compiler (GCC 10+, Clang 10+, or MSVC 2019+)\n- CMake 3.14+\n- Boost libraries 1.72+\n- spdlog library (for structured logging)\n- fmt library (for formatting, spdlog dependency)\n- OpenSSL library (for secure credential handling)\n- nlohmann_json library (for configuration handling)\n\n### Quick Start with Scripts\n\nPinnacleMM includes convenient bash scripts for easy execution:\n\n#### **Native Execution** (Recommended for Development)\n```bash\n# Clone and setup\ngit clone https://github.com/chizy7/PinnacleMM.git\ncd PinnacleMM\n\n# One-command setup and run\nscripts/run-native.sh                    # Simulation mode (auto-builds if needed)\nscripts/run-native.sh -m live -v         # Live trading with verbose logs\nscripts/run-native.sh --enable-ml        # ML-enhanced simulation mode\nscripts/run-native.sh --enable-visualization # With real-time dashboard\nscripts/run-native.sh --setup-credentials # Configure API keys\n```\n\n#### **Docker Execution** (Recommended for Production)\n```bash\n# Build and run in one command\nscripts/run-docker.sh                    # Simulation mode\nscripts/run-docker.sh -m live -v         # Live trading mode\nscripts/run-docker.sh build              # Build Docker image\nscripts/run-docker.sh logs               # View container logs\n```\n\n### Manual Building from Source\n\n```bash\n# Clone the repository\ngit clone https://github.com/chizy7/PinnacleMM.git\ncd PinnacleMM\n\n# Build with native script (recommended)\nscripts/run-native.sh build\n\n# Or build manually\nmkdir build \u0026\u0026 cd build\ncmake ..\nmake -j$(sysctl -n hw.ncpu)  # macOS\n# make -j$(nproc)            # Linux\n```\n\n### Script Features Comparison\n\n| Feature | Native Script (`scripts/run-native.sh`) | Docker Script (`scripts/run-docker.sh`) |\n|---------|-----------------------------------|-----------------------------------|\n| **Simulation Mode** | Perfect | Perfect |\n| **Live Trading** | Real WebSocket data | WebSocket config issue |\n| **Auto-Build** | Builds if needed | Auto Docker build |\n| **Test Runner** | `scripts/run-native.sh test` | Not included |\n| **Benchmarks** | `scripts/run-native.sh benchmark` | Not included |\n| **Credential Setup** | Interactive setup | Volume mounting |\n| **Dependency Check** | cmake, make, g++ | Docker only |\n| **Best For** | Development \u0026 Live Trading | Production \u0026 Simulation |\n\n### Running PinnacleMM\n\n#### Simulation Mode\n```bash\n# Using scripts (recommended)\nscripts/run-native.sh                    # Native execution\nscripts/run-docker.sh                    # Docker execution\n\n# Manual execution\ncd build \u0026\u0026 ./pinnaclemm --mode simulation --symbol BTC-USD\n\n# ML-enhanced simulation with visualization\ncd build \u0026\u0026 ./pinnaclemm --mode simulation --enable-ml --enable-visualization\n\n# Custom ports for visualization (useful for running multiple instances)\ncd build \u0026\u0026 ./pinnaclemm --mode simulation --enable-ml --enable-visualization --viz-ws-port 8089 --viz-api-port 8090\n\n# Debug mode with enhanced WebSocket logging\ncd build \u0026\u0026 SPDLOG_LEVEL=debug ./pinnaclemm --mode simulation --enable-ml --enable-visualization --verbose\n\n# Enable JSON data export (logs market data and strategy metrics to JSONL file)\ncd build \u0026\u0026 ./pinnaclemm --mode simulation --enable-ml --json-log --json-log-file simulation_data.jsonl\n\n# Combined: ML + visualization + JSON logging\ncd build \u0026\u0026 ./pinnaclemm --mode simulation --enable-ml --enable-visualization --json-log --json-log-file sim_ml_data.jsonl\n\n# Multi-instrument simulation\ncd build \u0026\u0026 ./pinnaclemm --mode simulation --symbols BTC-USD,ETH-USD\n\n# Arbitrage detection (dry-run)\ncd build \u0026\u0026 ./pinnaclemm --mode simulation --symbol BTC-USD --enable-arbitrage --arb-dry-run\n\n# The visualization dashboard will be available at:\n# - WebSocket: ws://localhost:8080 (or custom port with --viz-ws-port)\n# - REST API: http://localhost:8081 (or custom port with --viz-api-port)\n# - Dashboard: Open visualization/static/index.html in your browser\n# - Test Dashboard: Open build/test_dashboard.html for WebSocket connection testing\n```\n\n#### Live Exchange Mode\n```bash\n# Setup credentials first\nscripts/run-native.sh --setup-credentials\n\n# Live trading with scripts\nscripts/run-native.sh -m live -v         # Native (recommended for live)\nscripts/run-docker.sh -m live -v         # Docker\n\n# Manual execution\ncd build \u0026\u0026 ./pinnaclemm --mode live --exchange coinbase --symbol BTC-USD --verbose\n\n# Live trading with ML and visualization (custom ports)\ncd build \u0026\u0026 ./pinnaclemm --mode live --exchange coinbase --symbol BTC-USD --enable-ml --enable-visualization --viz-ws-port 8085 --viz-api-port 8086 --verbose\n\n# Debug mode for live trading (with enhanced logging)\ncd build \u0026\u0026 SPDLOG_LEVEL=debug ./pinnaclemm --mode live --exchange coinbase --symbol BTC-USD --enable-ml --enable-visualization --viz-ws-port 8085 --viz-api-port 8086 --verbose\n\n# Live trading with JSON data export (captures real market data)\ncd build \u0026\u0026 ./pinnaclemm --mode live --exchange coinbase --symbol BTC-USD --enable-ml --json-log --json-log-file live_btc_data.jsonl\n\n# Full-featured live trading: ML + visualization + JSON logging\ncd build \u0026\u0026 ./pinnaclemm --mode live --exchange coinbase --symbol BTC-USD --enable-ml --enable-visualization --viz-ws-port 8085 --viz-api-port 8086 --json-log --json-log-file live_trading_session.jsonl --verbose\n\n# Access the live dashboard:\n# - Main Dashboard: visualization/static/live_dashboard.html\n# - Test Dashboard: build/test_dashboard.html (for connection testing)\n# - WebSocket: ws://localhost:8085 (or your custom port)\n# - REST API: http://localhost:8086 (or your custom port)\n```\n\nWhen running in live mode, you'll be prompted for your master password to decrypt API credentials.\n\n#### Backtest Mode\n```bash\n# Run backtest with synthetic data (no API keys needed, auto-generates data if no CSV found)\ncd build \u0026\u0026 ./pinnaclemm --mode backtest --symbol BTC-USD\n\n# Backtest with ML-enhanced strategy\ncd build \u0026\u0026 ./pinnaclemm --mode backtest --symbol BTC-USD --enable-ml\n\n# Custom parameters\ncd build \u0026\u0026 ./pinnaclemm --mode backtest --symbol BTC-USD \\\n  --initial-balance 50000 --trading-fee 0.002 --slippage-bps 5.0\n\n# Custom output directory\ncd build \u0026\u0026 ./pinnaclemm --mode backtest --symbol BTC-USD --backtest-output my_results\n\n# Using your own historical data: place CSV at \u003cbacktest-output\u003e/data/\u003cSYMBOL\u003e.csv\n# e.g. backtest_results/data/BTC-USD.csv with format:\n# timestamp,symbol,price,bid,ask,volume\n# 1640995200000000000,BTC-USD,47892.50,47890.00,47895.00,1250.75\n```\n\nBacktest mode runs the strategy against historical (or synthetic) data, prints a detailed performance report (Sharpe ratio, drawdown, win rate, etc.), saves JSON results to the output directory, and exits cleanly.\n\n## JSON Data Export\n\nPinnacleMM provides comprehensive structured data export capabilities through JSON Lines (JSONL) format logging. This feature enables detailed analysis, backtesting, monitoring, and debugging of trading strategies and market data.\n\n### Features\n\n- **Market Data Logging**: Real-time price, volume, bid/ask data with timestamps\n- **Strategy Metrics**: Position, P\u0026L, quote counts, and performance statistics\n- **Order Book Updates**: Complete order book state with bid and ask arrays\n- **Connection Events**: WebSocket connections, disconnections, and errors\n- **Trading Events**: Order placements, fills, cancellations, and status updates\n- **Thread-Safe**: Concurrent logging without performance impact\n- **JSONL Format**: One JSON object per line for easy parsing and streaming\n\n### Usage\n\nEnable JSON logging with the `--json-log` flag and optionally specify a custom file path:\n\n```bash\n# Basic JSON logging (default file: pinnaclemm_data.jsonl)\n./pinnaclemm --mode simulation --symbol BTC-USD --json-log\n\n# Custom file path\n./pinnaclemm --mode live --exchange coinbase --symbol BTC-USD --json-log --json-log-file my_trading_data.jsonl\n\n# Combined with other features\n./pinnaclemm --mode live --enable-ml --enable-visualization --json-log --json-log-file full_session.jsonl\n```\n\n### Sample Output\n\n```json\n{\"format\":\"jsonl\",\"timestamp\":\"2025-09-29T16:27:06.770Z\",\"type\":\"session_start\",\"version\":\"1.0.0\"}\n{\"metrics\":{\"ask_price\":67252.80,\"bid_price\":67248.20,\"market_price\":67250.45,\"pnl\":0.0,\"position\":0.0,\"quote_updates\":1,\"strategy_name\":\"BasicMarketMaker\",\"volume\":1234.56},\"strategy_name\":\"BasicMarketMaker\",\"symbol\":\"BTC-USD\",\"timestamp\":\"2025-09-29T16:27:12.011Z\",\"type\":\"strategy_metrics\"}\n{\"ask_price\":67253.00,\"bid_price\":67249.50,\"event_timestamp\":1695736032610,\"is_buy\":true,\"price\":67250.75,\"symbol\":\"BTC-USD\",\"timestamp\":\"2025-09-29T16:27:12.610Z\",\"type\":\"market_update\",\"volume\":0.5}\n```\n\n### Data Types\n\n- **`session_start`**: Session initialization marker with format and version\n- **`strategy_metrics`**: Trading strategy performance and position data\n- **`market_update`**: Real-time market data from exchange feeds\n- **`order_book_update`**: Complete order book snapshots with bid/ask arrays\n- **`trading_event`**: Order lifecycle events and trading actions\n- **`connection_event`**: Exchange connectivity status and errors\n\n### File Management\n\nJSON log files are created in the current working directory by default. For production use, consider:\n\n```bash\n# Save to logs directory (create and add to .gitignore)\nmkdir -p logs\n./pinnaclemm --json-log --json-log-file logs/trading_$(date +%Y%m%d_%H%M%S).jsonl\n\n# Save to data directory (existing, likely gitignored)\n./pinnaclemm --json-log --json-log-file data/market_data_$(date +%Y%m%d).jsonl\n\n# Save outside project directory\n./pinnaclemm --json-log --json-log-file ~/trading_logs/pinnaclemm_session.jsonl\n```\n\n## API Credential Management\n\nPinnacleMM securely stores and manages exchange API credentials:\n\n- **Encryption**: AES-256-CBC encryption with PBKDF2 key derivation\n- **Master Password**: Single password to unlock all exchange credentials\n- **Secure Storage**: Credentials encrypted in `config/secure_config.json`\n- **Interactive Setup**: User-friendly credential configuration interface\n\n### Setting Up API Credentials\n\n1. **Run credential setup**:\n```bash\nscripts/run-native.sh --setup-credentials\n# or manually:\n./pinnaclemm --setup-credentials\n```\n\n2. **Enter master password** (secure input with hidden characters - this encrypts all API keys with AES-256-CBC + unique salt + 100,000 PBKDF2 iterations)\n\n3. **Configure exchange credentials**:\n   - **Coinbase Pro**: API Key + API Secret + Passphrase\n   - **Other exchanges**: API Key + API Secret (+ optional passphrase)\n   - All inputs are validated and sanitized before encryption\n\n4. **Verify setup**:\n```bash\nscripts/run-native.sh -m live -v\n# or manually:\n./pinnaclemm --mode live --exchange coinbase --symbol BTC-USD --verbose\n```\n\n### Supported Exchanges\n\n#### WebSocket Connectivity\n- **Coinbase Pro**: Live market data via WebSocket\n\n#### FIX Protocol Connectivity\n- **Interactive Brokers**: FIX 4.2 support (requires IB FIX API agreement)\n- **Coinbase Pro**: FIX 4.4 institutional connectivity (framework ready)\n- **Kraken**: FIX 4.4 institutional connectivity (framework ready)\n- **Binance**: FIX 4.4 institutional connectivity (framework ready)\n\n#### In Development\n- **Kraken, Gemini, Binance, Bitstamp**: WebSocket connectors in development\n\nFor more detailed instructions, see the [Getting Started Guide](docs/user_guide/getting_started.md).\n\n## Script Documentation\n\n### Native Script (`scripts/run-native.sh`)\n\n**Available Commands:**\n```bash\n# Execution modes\nscripts/run-native.sh                     # Simulation mode (default)\nscripts/run-native.sh -m live -v          # Live mode with verbose logging\nscripts/run-native.sh -s ETH-USD          # Custom trading symbol\nscripts/run-native.sh -e coinbase         # Specify exchange\n\n# Build commands\nscripts/run-native.sh build               # Build project\nscripts/run-native.sh clean               # Clean build directory\nscripts/run-native.sh rebuild             # Clean and rebuild\n\n# Testing and benchmarks\nscripts/run-native.sh test                # Run all tests\nscripts/run-native.sh benchmark           # Run performance benchmarks\n\n# Setup\nscripts/run-native.sh --setup-credentials # Configure API credentials (secure input)\nscripts/run-native.sh --help              # Show help\n\n# Cleanup\nscripts/cleanup.sh                        # Interactive cleanup utility\n```\n\n**Features:**\n- **Auto-build**: Builds project if executable not found\n- **Dependency checking**: Validates cmake, make, g++/clang++\n- **Cross-platform**: Works on macOS and Linux\n- **Test runner**: Comprehensive test suite execution\n- **Live trading**: Real WebSocket connections to exchanges\n\n### Docker Script (`scripts/run-docker.sh`)\n\n**Available Commands:**\n```bash\n# Execution modes\nscripts/run-docker.sh                     # Simulation mode (detached)\nscripts/run-docker.sh -m live -v          # Live mode (interactive)\nscripts/run-docker.sh -s ETH-USD          # Custom trading symbol\n\n# Container management\nscripts/run-docker.sh build               # Build Docker image\nscripts/run-docker.sh logs                # View container logs\nscripts/run-docker.sh stop                # Stop and remove containers\nscripts/run-docker.sh clean               # Remove containers and image\nscripts/run-docker.sh --help              # Show help\n```\n\n**Features:**\n- **Containerized**: Isolated execution environment\n- **Auto-build**: Builds Docker image if not found\n- **Container lifecycle**: Complete start/stop/clean management\n- **Volume mounting**: Credential persistence for live mode\n- **Production ready**: Optimized for deployment\n\n## Docker Deployment\n\n### Using Docker Script (Recommended)\n```bash\n# Quick start\nscripts/run-docker.sh                     # Simulation mode\nscripts/run-docker.sh -m live -v          # Live trading\n\n# Container management\nscripts/run-docker.sh logs                # Monitor logs\nscripts/run-docker.sh stop                # Stop trading\n```\n\n### Using Pre-built Images (GitHub Container Registry)\n```bash\n# Pull the latest image\ndocker pull ghcr.io/chizy7/pinnaclemm:latest\n\n# Run simulation mode\ndocker run --rm ghcr.io/chizy7/pinnaclemm:latest\n\n# Setup credentials for live trading\ndocker run -it --rm -v $(pwd)/config:/app/config \\\n  ghcr.io/chizy7/pinnaclemm:latest --setup-credentials\n\n# Run live mode with credentials\ndocker run -it --rm -v $(pwd)/config:/app/config \\\n  ghcr.io/chizy7/pinnaclemm:latest --mode live --exchange coinbase --symbol BTC-USD --verbose\n```\n\n### Manual Docker Commands\n```bash\n# Build the Docker image locally\ndocker build -t pinnaclemm .\n\n# Run simulation mode\ndocker run -d --name pinnaclemm pinnaclemm\n\n# Run live mode with credentials\ndocker run -it --name pinnaclemm-live \\\n  -v $(pwd)/config:/app/config \\\n  pinnaclemm --mode live --exchange coinbase --symbol BTC-USD --verbose\n```\n\n## Key Components\n\n- **Order Book Engine**: Ultra-fast matching engine with lock-free operations\n- **Market Making Strategy**: Adaptive pricing based on market conditions\n- **Risk Manager**: Lock-free pre-trade risk checks with position, exposure, and loss limits\n- **Circuit Breaker**: Market circuit breaker with 8 triggers and automatic recovery\n- **VaR Engine**: Real-time Value at Risk with Monte Carlo simulations on a background thread\n- **Alert Manager**: Alerting system with throttling and real-time WebSocket delivery\n- **Disaster Recovery**: Atomic state persistence, position reconciliation, and backup management\n- **ML Spread Optimization**: Neural network-based spread prediction with ~1-2μs latency\n- **Order Book Flow Analyzer**: Real-time analysis of order flow patterns and market microstructure\n- **Market Impact Predictor**: Advanced models for predicting price impact of trades\n- **Market Regime Detector**: Hidden Markov Model-based detection of 8 market regimes\n- **RL Parameter Adapter**: Reinforcement learning for dynamic strategy parameter optimization\n- **Advanced Backtesting Engine**: Historical replay with Monte Carlo analysis and statistical testing\n- **Instrument Manager**: Multi-instrument orchestration with per-symbol order books, strategies, and simulators\n- **Arbitrage Detector**: Cross-exchange price discrepancy detection with fee-adjusted scanning\n- **Cross-Market Correlation**: Statistical lead-lag analysis and cointegration testing for signal generation\n- **Real-Time Visualization**: Web-based dashboard with Chart.js and D3.js visualization\n- **FIX Protocol Engine**: Professional-grade FIX connectivity for institutional trading\n- **Persistence System**: Crash recovery with memory-mapped files\n- **Exchange Simulator**: Realistic market simulation for testing\n\n## Documentation\n\n### Core System\n- [System Architecture](docs/architecture/system_overview.md)\n- [Getting Started Guide](docs/user_guide/getting_started.md)\n- [API Reference](docs/api/reference.md)\n- [Project Roadmap](docs/ROADMAP.md)\n\n### Risk Management \u0026 Production\n- [Risk Management](docs/RISK_MANAGEMENT.md) - **Pre-trade checks, VaR, circuit breaker, alerting**\n- [Disaster Recovery](docs/DISASTER_RECOVERY.md) - **Operational runbook for crash recovery and backups**\n- [Kubernetes Deployment](docs/KUBERNETES_DEPLOYMENT.md) - **Production K8s deployment guide**\n\n### Advanced Features (ML)\n- [ML Spread Optimization](docs/ML_SPREAD_OPTIMIZATION.md) - **Neural network-based spread prediction**\n- [Order Book Flow Analysis](docs/ORDER_BOOK_FLOW_ANALYSIS.md) - **Real-time market microstructure analysis**\n- [Market Impact Prediction](docs/MARKET_IMPACT_PREDICTION.md) - **Advanced trade impact modeling**\n- [RL Parameter Adaptation](docs/RL_PARAMETER_ADAPTATION.md) - **Reinforcement learning optimization**\n- [Market Regime Detection](docs/MARKET_REGIME_DETECTION.md) - **Hidden Markov Model regime detection**\n- [Advanced Backtesting](docs/ADVANCED_BACKTESTING.md) - **Historical data replay and Monte Carlo analysis**\n- [Strategy Performance Visualization](docs/STRATEGY_PERFORMANCE_VISUALIZATION.md) - **Real-time web dashboard**\n- [WebSocket Testing Guide](docs/WEBSOCKET_TESTING.md) - **WebSocket connection testing and troubleshooting**\n\n## Real-Time Visualization Dashboard\n\nThe PinnacleMM system includes a professional web-based dashboard for real-time performance monitoring and analysis:\n\n### Features\n- **Live Performance Metrics**: Real-time P\u0026L, position, Sharpe ratio, and win rate tracking\n- **Interactive Charts**: Time-series visualization with Chart.js for performance trends\n- **Market Data Visualization**: Live order book, spread analysis, and trade flow\n- **ML Model Metrics**: Neural network accuracy, prediction times, and regime detection\n- **WebSocket Real-Time Updates**: Sub-100ms latency for live data streaming\n- **Multiple Dashboard Types**: Main dashboard, live trading dashboard, and test dashboard\n- **Fixed WebSocket Issues**: Resolved segmentation faults and connection stability issues\n\n### Access Dashboard\n\n#### Simulation Mode Dashboard\n1. **Start the system with visualization enabled:**\n   ```bash\n   cd build \u0026\u0026 ./pinnaclemm --mode simulation --enable-ml --enable-visualization --viz-ws-port 8089 --viz-api-port 8090\n   ```\n\n2. **Open the dashboard:**\n   - **Main Dashboard**: `visualization/static/index.html` (full-featured dashboard)\n   - **Test Dashboard**: `build/test_dashboard.html` (WebSocket connection testing)\n   - **WebSocket**: `ws://localhost:8089` (or your custom port)\n   - **REST API**: `http://localhost:8090` (or your custom port)\n\n#### Live Trading Dashboard\n1. **Start live trading with visualization:**\n   ```bash\n   cd build \u0026\u0026 ./pinnaclemm --mode live --exchange coinbase --enable-ml --enable-visualization --viz-ws-port 8085 --viz-api-port 8086 --verbose\n   ```\n\n2. **Access live dashboard:**\n   - **Live Dashboard**: `visualization/static/live_dashboard.html` (optimized for live trading)\n   - **Test Dashboard**: `build/test_dashboard.html` (connection diagnostics)\n   - **WebSocket**: `ws://localhost:8085`\n   - **REST API**: `http://localhost:8086`\n\n### Dashboard Components\n- **Performance Cards**: Key metrics at-a-glance with real-time updates\n- **Interactive Charts**: P\u0026L, positions, spreads, ML accuracy with Chart.js\n- **Real-Time Status**: Connection status indicators and live data feed monitoring\n- **Strategy Controls**: Multiple strategy monitoring and comparison\n- **Market Regime Visualization**: Real-time regime detection with confidence indicators\n- **ML Metrics Panel**: Model accuracy, prediction latency, and retrain statistics\n- **Risk Analysis**: Real-time VaR (historical, parametric, Monte Carlo), circuit breaker status, position/exposure limits, drawdown tracking, and alerting\n\n### Technical Details\n- **Frontend**: HTML5/CSS3/JavaScript with Chart.js and D3.js\n- **Backend**: Boost.Beast WebSocket and HTTP servers (migrated from websocketpp for compatibility)\n- **Data Format**: JSON with efficient real-time streaming\n- **Update Frequency**: 1-second intervals with configurable rates\n- **Connection Stability**: Fixed shared_ptr lifecycle management for stable WebSocket connections\n- **Debug Support**: Enhanced logging with `SPDLOG_LEVEL=debug` for troubleshooting\n\n### Testing WebSocket Connections\nIf you encounter connection issues, use the test dashboard:\n```bash\n# Start with debug logging\nSPDLOG_LEVEL=debug ./pinnaclemm --mode simulation --enable-visualization --viz-ws-port 8089 --viz-api-port 8090 --verbose\n\n# Open test dashboard\nopen build/test_dashboard.html\n# or manually: file:///path/to/PinnacleMM/build/test_dashboard.html\n```\n\n### Multi-Instrument \u0026 Optimization\n- [Multi-Instrument Guide](docs/MULTI_INSTRUMENT_GUIDE.md) - **Multi-symbol trading with InstrumentManager**\n- [Cross-Exchange Arbitrage](docs/CROSS_EXCHANGE_ARBITRAGE.md) - **Venue spread detection and execution**\n- [Cross-Market Correlation](docs/CROSS_MARKET_CORRELATION.md) - **Statistical correlation and signal generation**\n- [Performance Optimization Guide](docs/PERFORMANCE_OPTIMIZATION_GUIDE.md) - **LTO, CPU affinity, object pooling, lock-free fixes**\n\n### Exchange Integration\n- [FIX Protocol Integration Guide](docs/FIX_PROTOCOL_INTEGRATION.md)\n- [FIX Testing Guide](docs/TESTING_GUIDE.md)\n- [Interactive Brokers Setup](docs/IB_TESTING_GUIDE.md)\n\n### System Administration\n- [Kubernetes Deployment](docs/KUBERNETES_DEPLOYMENT.md)\n- [Disaster Recovery Runbook](docs/DISASTER_RECOVERY.md)\n- [Persistence System](docs/architecture/persistence.md)\n- [Recovery Guide](docs/user_guide/recovery.md)\n- [Security \u0026 API Key Management](docs/security/credentials.md)\n- [Certificate Pinning Guide](docs/security/CERTIFICATE_PINNING.md)\n\n## Technology Stack\n\n- **Core Engine**: C++20\n- **Build System**: CMake\n- **Testing**: Google Test\n- **Performance Benchmarking**: Google Benchmark\n- **Concurrency**: Lock-free algorithms, std::atomic\n- **Networking**: Boost.Beast WebSocket, hffix FIX protocol\n- **Machine Learning**: Custom neural networks, Hidden Markov Models, reinforcement learning\n- **Visualization**: HTML5/CSS3/JavaScript frontend, Chart.js, D3.js, WebSocket real-time updates\n- **Security**: OpenSSL for encryption\n- **Configuration**: nlohmann/json\n- **Containerization**: Docker\n- **Security**: AES-256-CBC encryption, PBKDF2 key derivation, input validation, audit logging, rate limiting\n\n## Performance\n\nPinnacleMM achieves exceptional performance metrics:\n\n- **Order Book Update Latency**: \u003c1 μs (microsecond)\n- **Order Execution Latency**: \u003c50 μs (end-to-end)\n- **Pre-Trade Risk Check**: ~750ns (lock-free, 8 sequential checks)\n- **Circuit Breaker Check**: ~5ns (single atomic load)\n- **ML Prediction Latency**: 1-3 μs (neural network inference)\n- **Throughput**: 100,000+ messages per second\n- **Recovery Time**: \u003c5 seconds for full system recovery\n- **Memory Footprint**: \u003c100 MB for core engine\n- **Dashboard Update Latency**: \u003c100ms (real-time visualization)\n- **Regime Detection**: Real-time with 85%+ confidence accuracy\n\n### Testing Integration\n\n```bash\n# Test FIX protocol components\ncd build\n./fix_basic_test\n\n# Expected output:\n# ✓ Factory instance created\n# ✓ Interactive Brokers FIX support: Yes\n# ✓ Configuration system working\n# ✓ Order creation working\n\n# Test advanced order routing system\n./routing_test\n\n# Expected output:\n# All OrderRouter tests passed successfully!\n# ✓ BestPriceStrategy, TWAP, VWAP, MarketImpact all working\n# ✓ Multi-venue execution with 1ms latency\n# ✓ 8 completed fills across multiple strategies\n\n# Test risk management components (Phase 4)\n./risk_manager_tests          # 11 tests - pre-trade checks, position limits\n./circuit_breaker_tests       # 10 tests - state machine, triggers\n./var_engine_tests            # 8 tests - VaR calculations\n./alert_manager_tests         # 8 tests - alerting, throttling\n./disaster_recovery_tests     # 8 tests - state persistence, backups\n./risk_check_benchmark        # Risk check latency benchmarks\n\n# Test multi-instrument and optimization components (Phase 5)\n./instrument_manager_tests         # 9 tests - lifecycle management\n./arbitrage_detector_tests         # 8 tests - opportunity detection, fees\n./cross_market_correlation_tests   # 7 tests - correlation, lead-lag\n./multi_instrument_benchmark       # Startup scaling benchmarks\n\n# Memory safety validation with Address Sanitizer (development builds)\ncmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_SANITIZERS=ON .. \u0026\u0026 make -j8\n./pinnaclemm --mode simulation --symbol BTC-USD --verbose\n# ASan will detect memory leaks, buffer overflows, and use-after-free errors\n```\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Contact Me\n\nFor questions, feedback, or collaboration opportunities:\n\n- **Email**: [chizy@chizyhub.com](mailto:chizy@chizyhub.com)\n- **X(Twitter)**: [![Twitter Follow](https://img.shields.io/twitter/follow/chizyization?style=social)](https://x.com/Chizyization)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchizy7%2Fpinnaclemm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchizy7%2Fpinnaclemm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchizy7%2Fpinnaclemm/lists"}