Back to Projects
Quantitative Trading • Project

RATU FIX Bot

FIX Protocol Connector for Binance with Defensive Message Parsing

FIX Protocol 4.4 ED25519 Authentication Binance FIX SDK Defensive Parser Market Making
2024 - 2025
Python 3.10
System Prototyping (FIX Protocol)

Overview

RATU FIX Bot is a FIX protocol connector for Binance with defensive message parsing. Part of RATUProject, it demonstrates low-latency FIX protocol integration for market data and order entry. Features three FIX sessions: Market Data, Order Entry, and Drop Copy.

The system implements a spread market making strategy that places BUY and SELL orders at spread offset, cancels and replaces stale orders, and manages order lifecycle. It uses ED25519 authentication for secure, non-expiring API access and includes defensive parser modifications to handle malformed FIX messages gracefully.

Built for system prototyping focus, it includes modifications to the official Binance FIX SDK for robustness, handling malformed tag-value fields and providing graceful degradation when parsing fails. The bot runs in infinite loop with configurable spread, stale threshold, and order quantity.

Key Achievement: Built FIX protocol trading bot with defensive parser modifications, ED25519 authentication, three-session architecture, and spread market making strategy

Key Metrics & Results

3
FIX Sessions
Defensive
Parser
ED25519
Authentication
Market Making
Strategy

Problem Statement

High-frequency trading requires low-latency order execution. FIX protocol provides industry-standard low-latency trading interface. Binance FIX SDK has parsing issues with certain market data symbols. Market making strategies need robust order management.

Business Context

FIX protocol is standard for institutional trading with low-latency capabilities. Market making requires persistent order management with price chasing. Malformed FIX messages can crash trading systems. Secure authentication is critical for trading operations.

Technical Challenges

Solution Architecture

A three-session FIX architecture: (1) Market Data session for real-time ticker streams, (2) Order Entry session for order placement with ED25519 auth, (3) Drop Copy session for trade confirmations. Includes defensive parser modifications and spread market making bot.

System Components

Defensive FIX Parser

Modified Binance FIX SDK parser to handle malformed tag-value fields. Skips invalid fields and logs errors. Prevents crashes on malformed market data messages.

ED25519 Authentication

Secure, non-expiring authentication using Ed25519 key pairs. Signs FIX logon messages with private key. Server verifies with public key.

Spread Market Making Bot

Places BUY and SELL orders at spread offset. Cancels and replaces stale orders. Manages order lifecycle with order.replace API for price chasing.

Three-Session Management

Manages Market Data (ticker streams), Order Entry (order placement), and Drop Copy (trade confirmations) sessions concurrently. Handles heartbeats and reconnections.

Technology Stack Rationale

FIX protocol provides low-latency capabilities for order execution. ED25519 provides secure, non-expiring authentication. Defensive parser prevents crashes on malformed messages. order.replace API enables price chasing. Market making strategy provides liquidity.

Implementation Highlights

Key Features

Detailed Code Documentation

Deep dive into the technical implementation with annotated code examples

View Technical Details

Challenges & Solutions

Challenge 1

Handling malformed FIX messages without crashing

Solution

Modified Binance FIX SDK parser to detect malformed tag-value fields. Skips invalid fields and logs errors. Continues processing valid messages. Prevents crashes on certain market data symbols.

Challenge 2

Implementing robust order management with price chasing

Solution

Uses Binance order.replace API with clientOrderId overwrite. Replaces same order ID repeatedly without order spam. Updates every loop iteration to chase best prices. Guarantees fill or manual override.

Challenge 3

Managing three concurrent FIX sessions

Solution

Implements separate session management for Market Data, Order Entry, and Drop Copy. Handles heartbeats (30s) and reconnections independently. Thread-based receiver for non-blocking message reception.

Challenge 4

Ensuring secure authentication

Solution

Uses ED25519 asymmetric cryptography. Signs FIX logon messages with private key. Server verifies with public key. Eliminates shared-secret risks.

Results & Impact

Built FIX protocol trading bot with defensive message parsing preventing crashes on malformed messages. ED25519 authentication provides secure, non-expiring access. Spread market making strategy with price chasing. Three-session architecture enables complete trading workflow.

Production Performance

  • Low-latency FIX protocol for order execution
  • Defensive parser handles malformed messages gracefully
  • ED25519 authentication eliminates shared-secret risks
  • Spread market making with configurable parameters
  • Three-session FIX architecture (MD, OE, DC)

Lessons Learned

What Worked Well

What I'd Do Differently

Future Enhancements

Related Projects