Skip to content

FIX Feed

Feed Handlers are components that receive real-time market data from exchanges, data vendors, and feed providers and ingest it into ZeptoDB.


Purpose: Integration with data vendors such as Bloomberg, Reuters, ICE

#include "zeptodb/feeds/fix_feed_handler.h"
// FIX configuration
feeds::FeedConfig config;
config.host = "bloomberg-feed.com";
config.port = 5000;
config.username = "APEX_CLIENT";
config.password = "password";
feeds::FIXFeedHandler feed_handler(config, &mapper);
// Tick callback
feed_handler.on_tick([&](const feeds::Tick& tick) {
pipeline.ingest(tick.symbol_id, tick.price, tick.volume, tick.timestamp_ns);
});
// Connect and subscribe
feed_handler.connect();
feed_handler.subscribe({"AAPL", "MSFT", "TSLA"});

Characteristics:

  • TCP-based
  • Automatic reconnection
  • Heartbeat maintenance
  • Latency: 100μs-1ms

2. Multicast UDP (Direct Exchange Connectivity)

Section titled “2. Multicast UDP (Direct Exchange Connectivity)”

Purpose: Direct connection to exchanges such as NASDAQ, NYSE, CME

#include "zeptodb/feeds/multicast_receiver.h"
// Multicast reception
feeds::MulticastReceiver receiver("239.1.1.1", 10000);
receiver.on_packet([&](const uint8_t* data, size_t len) {
// Process with protocol-specific parser
parser.parse_packet(data, len);
});
receiver.join();
receiver.start();

Characteristics:

  • UDP multicast
  • Ultra-low latency: 1-5μs
  • Packet loss possible (no retransmission)
  • High throughput: 10+ Gbps

Purpose: NASDAQ TotalView market data

#include "zeptodb/feeds/nasdaq_itch.h"
feeds::NASDAQITCHParser parser;
receiver.on_packet([&](const uint8_t* data, size_t len) {
if (parser.parse_packet(data, len)) {
feeds::Tick tick;
if (parser.extract_tick(tick, &mapper)) {
pipeline.ingest(tick.symbol_id, tick.price, tick.volume,
tick.timestamp_ns);
}
}
});

Supported messages:

  • Add Order (Type A)
  • Order Executed (Type E)
  • Trade (Type P)
  • Order Cancel (Type X)

Characteristics:

  • Binary protocol (packed structs)
  • Big-endian
  • Parsing speed: ~500ns per message

Purpose: Binance Spot/Futures real-time data

#include "zeptodb/feeds/binance_feed.h"
// TODO: WebSocket library integration needed
feeds::BinanceFeedHandler feed_handler(config, &mapper);
feed_handler.on_tick([&](const feeds::Tick& tick) {
pipeline.ingest(tick.symbol_id, tick.price, tick.volume, tick.timestamp_ns);
});
feed_handler.connect();
feed_handler.subscribe({"btcusdt@trade", "ethusdt@trade"});

Stream types:

  • @trade - real-time trades
  • @aggTrade - aggregated trades
  • @depth - order book
  • @bookTicker - best bid/ask

┌────────────────────┐
│ Exchange Feed │ UDP Multicast / TCP
│ (NASDAQ, CME) │
└─────────┬──────────┘
┌─────────▼──────────┐
│ Feed Handler │ Protocol parser
│ (FIX, ITCH, etc) │ - FIX: tag=value
└─────────┬──────────┘ - ITCH: binary
↓ - WebSocket: JSON
┌─────────▼──────────┐
│ Symbol Mapper │ symbol → symbol_id
└─────────┬──────────┘
┌─────────▼──────────┐
│ ZeptoDB Pipeline │ 5.52M ticks/sec
│ ingest() │ zero-copy
└────────────────────┘

// Bad: copy
std::string msg_copy(data, len);
parser.parse(msg_copy);
// Good: zero-copy
parser.parse(data, len); // pass pointer only
// ITCH message batch parsing
auto ticks = parser.parse_batch_simd(data, len); // AVX-512
pipeline.batch_ingest(ticks); // batch ingestion
// Dedicate a core to Feed Handler
cpu_set_t cpuset;
CPU_ZERO(&cpuset);
CPU_SET(0, &cpuset); // core 0 dedicated
pthread_setaffinity_np(pthread_self(), sizeof(cpuset), &cpuset);

  • CPU pinning (cores 0-1 dedicated)
  • Huge pages (2MB pages)
  • IRQ affinity (NIC → dedicated core)
  • UDP receive buffer (2MB+)
  • Kernel bypass (Solarflare, Mellanox)
  • Tick throughput (ticks/sec)
  • Packet drop rate
  • Parse error rate
  • Latency (end-to-end)
  • Reconnect logic (FIX)
  • Gap fill (sequence gap detection)
  • Failover (Primary/Secondary Feed)
  • Alerting (PagerDuty)

Terminal window
cd /home/ec2-user/zeptodb
mkdir build && cd build
cmake ..
make feed_handler_integration
./feed_handler_integration fix
# NASDAQ ITCH
./feed_handler_integration itch
# Performance test
./feed_handler_integration perf

Example file:

  • examples/feed_handler_integration.cpp

  • FIX protocol parser
  • Multicast UDP receiver
  • NASDAQ ITCH parser
  • Integration example
  • CME SBE (Simple Binary Encoding)
  • NYSE Pillar protocol
  • Binance WebSocket (actual implementation)
  • Gap fill / retransmission logic
  • SIMD batch parsing
  • Kernel bypass (DPDK)
  • GPU offloading
  • Multicast Failover

Before: HTTP API only (ms-level latency) ✅ After: UDP Multicast + FIX (μs-level latency)

ROI:

  • HFT customer targeting possible: $2.5M-12M market
  • Full kdb+ replacement: FIX + ITCH support
  • Data vendor integration: Bloomberg, Reuters
Itemkdb+ClickHouseZeptoDB
FIX support✅ (external)✅ Native
ITCH support✅ (external)✅ Native
Multicast
PerformancebaselineN/Aequivalent

For issues: