How ymidortega/titaniumboe-sim works
Project Type and Purpose
• This is a full-stack, enterprise-grade trading infrastructure simulator for the Cboe Titanium BOE protocol.
• It bundles a binary TCP server (the BOE Server), REST API & WebSocket endpoints, interactive CLI client, client SDK, trading bots, real-time matching engine, and persistent storage (RocksDB).
File Structure
Top-level directories of interest:
· src/main/java/com/boe/simulator/api → REST controllers, DTOs, WebSocket handlers
· src/main/java/com/boe/simulator/server → TCP connection, matching engine, order management, authentication, rate limiting, session management, persistence service
· src/main/java/com/boe/simulator/client → BOE protocol client SDK and interactive CLI
· src/main/java/com/boe/simulator/bot → Automated trading bots with pluggable strategies
· src/main/java/com/boe/simulator/protocol → Message definitions, factories, serialization
· src/main/java/com/boe/simulator/server/persistence → RocksDB configuration, repositories, services
Additional: configuration and build scripts (Dockerfile, docker-compose.yml, pom.xml), docs, CI/CD workflows.
README Insights
• Confirms components: Interactive CLI, BOE Server (Ports 8080 TCP / 8081 HTTP), Matching Engine, Trading Bots, RocksDB.
• Mentions tech stack: Java 21, Maven, Javalin for REST & WebSocket, BCrypt, rate limiter, Jackson, JUnit/Mockito.
• Provides a sketch of architecture tying CLI → Server → matching, bots, and DB.
Main Components & Boundaries
A. Clients
• Interactive CLI (uses BOE client SDK over TCP)
• REST API & WebSocket consumers (e.g., third-party UIs, monitoring tools)
B. BOE Server
• TCP Connection Handler (port 8080)
• Authentication & Rate Limiting
• Session Management & Heartbeat Monitor
• Matching Engine & Order Manager
• Trading Bots (internal modules invoking matching engine)
• REST API & WebSocket Layer (port 8081 via Javalin)
• Persistence Layer (RocksDB via repository services)
• Metrics & Health
C. Protocol Layer
• Message Factory, Serializer, Session Manager
D. Data Stores & External Services
• Embedded RocksDB
• External configuration (via file or environment)
Relationships & Data Flows
• Interactive CLI ←TCP binary BOE protocol→ BOE Server (Connection Handler → Protocol → Authentication → Session)
• REST API & WebSocket ←HTTP/WS→ API Layer → Service Layer → OrderManager/PositionService → Persistence
• Trading Bots invoke the Matching Engine directly in-process (simulate market participants)
• Matching Engine publishes trade events to connected WebSocket sessions and persists executions
• Persistence Services write audit, sessions, user, trades into RocksDB
Architectural Patterns & Principles
• Layered Architecture: Presentation (CLI / REST / WS) → Application (Controllers, Services) → Domain (Matching, Orders, Bots) → Infrastructure (Persistence, Networking)
• Hexagonal/Ports-and-Adapters feel: protocol adapters (TCP, HTTP, WebSocket) plug into core services
• Separation of Concerns: distinct modules for API, core server logic, protocol, client SDK, bots
• Event-Driven Flow: matching engine publishes updates to WebSocket subscribers and persistence listeners
• Security & Resilience: authentication filter, CORS, rate limiter, error handlers