Back to Project

Notable Code: RATU FIX Bot

This document highlights key code sections that demonstrate the technical strengths and architectural patterns implemented in this FIX protocol trading bot.

Overview

RATU FIX Bot is a FIX protocol connector for Binance with defensive message parsing. The system demonstrates production-focused FIX protocol integration patterns including defensive parser modifications, ED25519 authentication, and three-session architecture.


1. Defensive Parser Modifications

File: Parser modifications
Lines: Defensive parsing logic

The system modifies the official Binance FIX SDK parser to handle malformed tag-value fields gracefully, skipping invalid fields and logging errors.

Why it's notable:
- Prevents crashes on malformed market data messages
- Skips invalid fields and continues processing
- Logs errors for debugging
- Graceful degradation when parsing fails


2. ED25519 Authentication

File: Authentication implementation
Lines: ED25519 signing logic

The system uses Ed25519 asymmetric cryptography for secure, non-expiring authentication, signing FIX logon messages with private key.

Why it's notable:
- Secure, non-expiring authentication
- Eliminates shared-secret risks
- Server verifies with public key
- Enables safer key rotation


3. Three-Session FIX Architecture

File: Session management
Lines: Multi-session handling

The system manages three FIX sessions concurrently: Market Data (ticker streams), Order Entry (order placement), and Drop Copy (trade confirmations).

Why it's notable:
- Enables complete trading workflow
- Handles heartbeats and reconnections independently
- Thread-based receiver for non-blocking message reception
- Separate session management for each type


4. Spread Market Making Strategy

File: Trading strategy implementation
Lines: Market making logic

The system implements a spread market making strategy that places BUY and SELL orders at spread offset, using order.replace API for price chasing.

Why it's notable:
- Places orders at configurable spread offset
- Uses order.replace for aggressive price chasing
- Cancels and replaces stale orders
- Manages order lifecycle efficiently


Architecture Highlights

Three-Session Design

  1. Market Data Session: Real-time ticker streams
  2. Order Entry Session: Order placement with ED25519 auth
  3. Drop Copy Session: Trade confirmations and fills

Design Patterns Used

  1. Defensive Parsing Pattern: Graceful error handling
  2. Asymmetric Auth Pattern: ED25519 for security
  3. Multi-Session Pattern: Concurrent session management
  4. Market Making Pattern: Spread-based strategy

Technical Strengths Demonstrated