FIX Protocol Bridge
Forex-to-crypto protocol bridge using FIX 4.4 from the Lagrange era
FIX Protocol Bridge
Status: Archived (concepts active) | Era: 2022-2023 | Repository: LAG_Openbook_FIX_Server-main
The FIX (Financial Information eXchange) Server was designed to bridge traditional forex systems with decentralized exchanges, enabling institutional traders to access on-chain liquidity through standard financial protocols.
Overview
Purpose
Enable traditional financial institutions to interact with DeFi markets using familiar FIX protocol standards, reducing integration complexity and regulatory friction.
FIX Protocol
FIX 4.4 is the industry standard for electronic trading communication:
| Message Type | Tag | Description |
|---|---|---|
| New Order Single | D | Submit new order |
| Execution Report | 8 | Order status/fill |
| Order Cancel Request | F | Cancel pending order |
| Market Data Request | V | Subscribe to prices |
| Market Data Snapshot | W | Price update |
Architecture
System Design
┌─────────────────────────────────────────────────────────────┐
│ Traditional Forex │
│ ┌─────────┐ ┌─────────┐ ┌─────────────────────────┐ │
│ │ MT4/MT5 │ │ FIX API │ │ Institutional Platform │ │
│ └────┬────┘ └────┬────┘ └────────────┬────────────┘ │
│ │ │ │ │
└───────┼─────────────┼──────────────────────┼─────────────────┘
│ │ │
└─────────────┼──────────────────────┘
│
┌───────▼───────┐
│ FIX Gateway │
│ (Lagrange) │
│ │
│ - Session Mgmt│
│ - Order Route │
│ - Price Agg │
└───────┬───────┘
│
┌─────────────┼─────────────┐
│ │ │
▼ ▼ ▼
┌─────────┐ ┌─────────┐ ┌─────────┐
│ Serum │ │ Raydium │ │ Orca │
│ DEX │ │ AMM │ │ Whirl- │
│ │ │ │ │ pools │
└─────────┘ └─────────┘ └─────────┘Message Flow
// FIX message handling
interface FIXMessage {
header: {
msgType: string; // Tag 35
senderCompID: string; // Tag 49
targetCompID: string; // Tag 56
msgSeqNum: number; // Tag 34
sendingTime: Date; // Tag 52
};
body: Record<string, string>;
trailer: {
checkSum: string; // Tag 10
};
}
// New Order Single (Tag 35=D)
interface NewOrderSingle {
clOrdID: string; // Tag 11 - Client order ID
symbol: string; // Tag 55 - Trading symbol
side: '1' | '2'; // Tag 54 - 1=Buy, 2=Sell
ordType: '1' | '2'; // Tag 40 - 1=Market, 2=Limit
price?: number; // Tag 44 - Limit price
orderQty: number; // Tag 38 - Quantity
timeInForce: string; // Tag 59 - GTC, IOC, FOK
}Implementation
Session Management
// FIX session handler
class FIXSession {
private heartbeatInterval: number = 30;
private inSeqNum: number = 1;
private outSeqNum: number = 1;
async handleLogon(message: FIXMessage): Promise<void> {
// Validate credentials
const { username, password } = extractCredentials(message);
await this.authenticate(username, password);
// Send logon acknowledgment
await this.sendMessage({
msgType: 'A', // Logon
heartBtInt: this.heartbeatInterval,
});
}
async handleNewOrder(message: NewOrderSingle): Promise<void> {
// Validate order parameters
this.validateOrder(message);
// Route to appropriate DEX
const dex = this.selectDex(message.symbol);
const result = await dex.placeOrder(message);
// Send execution report
await this.sendExecutionReport({
clOrdID: message.clOrdID,
ordStatus: result.status,
execType: result.type,
cumQty: result.filledQty,
avgPx: result.avgPrice,
});
}
}Price Aggregation
// Multi-source price aggregation
class PriceAggregator {
private sources: PriceSource[] = [];
async getBestPrice(symbol: string, side: 'buy' | 'sell'): Promise<Price> {
const quotes = await Promise.all(
this.sources.map(s => s.getQuote(symbol))
);
// Find best execution price
return quotes.reduce((best, quote) => {
if (side === 'buy') {
return quote.ask < best.ask ? quote : best;
} else {
return quote.bid > best.bid ? quote : best;
}
});
}
// Market data broadcast
async broadcastMarketData(symbol: string): Promise<void> {
const price = await this.getBestPrice(symbol);
await this.broadcast({
msgType: 'W', // Market Data Snapshot
symbol,
bidPx: price.bid,
askPx: price.ask,
bidSize: price.bidSize,
askSize: price.askSize,
});
}
}What Evolved
Current Influence
While the FIX bridge itself was archived, its concepts influenced:
| FIX Concept | Current Implementation |
|---|---|
| Protocol standards | GraphQL API standards |
| Order routing | Multi-chain bridge architecture |
| Price aggregation | Price oracle system |
| Session management | Privy authentication |
Bridge.xyz Integration
The fiat-to-crypto bridge concept evolved into our Bridge.xyz integration:
FIX Bridge (Lagrange) → Bridge.xyz (fXYZ)
─────────────────────────────────────────────────
Forex ↔ Crypto → Fiat ↔ Crypto
FIX 4.4 protocol → REST/GraphQL API
MT4/MT5 integration → Banking rails (ACH, SEPA)
Institutional focus → Consumer + institutionalTechnical Details
Supported Features
| Feature | Status | Notes |
|---|---|---|
| Logon/Logout | Implemented | Standard FIX session |
| New Order Single | Implemented | Market and limit orders |
| Order Cancel | Implemented | Full cancel support |
| Market Data | Implemented | Real-time streaming |
| Execution Reports | Implemented | Fill notifications |
| Mass Quote | Planned | Never completed |
Message Examples
New Order (Buy 100 SOL at limit $95):
8=FIX.4.4|9=148|35=D|49=CLIENT|56=LAGRANGE|
34=2|52=20230615-10:30:00|11=ORD001|
55=SOL/USD|54=1|40=2|38=100|44=95.00|
59=0|10=234|Execution Report (Filled):
8=FIX.4.4|9=189|35=8|49=LAGRANGE|56=CLIENT|
34=2|52=20230615-10:30:01|37=EXE001|
11=ORD001|17=FILL001|150=F|39=2|
55=SOL/USD|54=1|38=100|32=100|
31=94.85|6=94.85|14=100|151=0|10=156|Lessons Learned
What Worked
- Standard Protocol: FIX familiarity reduced institutional onboarding friction
- Price Aggregation: Multi-source pricing improved execution quality
- Session Reliability: Heartbeat and sequence recovery ensured reliability
What Didn't Work
- Serum Dependency: Platform shutdown made the bridge obsolete
- Complexity: Maintaining FIX compliance required significant resources
- Latency: On-chain settlement slower than traditional forex expectations
Archive Location
archive/fxyz-knowledge-project/old-projects/lagrange-repos/LAG_Openbook_FIX_Server-main/
├── src/
│ ├── fix/
│ │ ├── session.ts
│ │ ├── messages.ts
│ │ └── parser.ts
│ ├── dex/
│ │ ├── serum.ts
│ │ └── aggregator.ts
│ └── server.ts
├── config/
│ └── fix-spec.xml
└── package.json