Files
papers/lux-smart-order-routing/sections/06-zap-wire-protocol.tex
zeekay 4a753bb639 papers: reorganize into per-paper dirs, add Antje Worring as co-author
Restructured from flat .tex/.pdf files into per-paper subdirectories.
Added Antje Worring as co-author on all papers.
Synced PDFs to pdfs/ for download site.
2026-04-18 21:50:07 -07:00

54 lines
1.8 KiB
TeX

\section{ZAP Wire Protocol}
\label{sec:zap}
\subsection{Binary Serialization}
Orders transmitted between the SOR and execution providers use the ZAP binary wire protocol \cite{lux-zap-wire-protocol} for minimal serialization overhead:
\begin{table}[H]
\centering
\caption{ZAP order message format.}
\label{tab:zap-format}
\begin{tabular}{llrl}
\toprule
\textbf{Field} & \textbf{Type} & \textbf{Bytes} & \textbf{Description} \\
\midrule
magic & uint16 & 2 & Protocol identifier (0x5A41) \\
version & uint8 & 1 & Protocol version \\
msg\_type & uint8 & 1 & Message type (order, cancel, exec, \ldots) \\
flags & uint16 & 2 & Bit flags (side, TIF, compliance) \\
security\_id & bytes32 & 32 & Security identifier \\
order\_id & bytes16 & 16 & Order identifier \\
price & uint64 & 8 & Price in basis points \\
quantity & uint64 & 8 & Quantity in base units \\
timestamp & uint64 & 8 & Nanosecond timestamp \\
partition & bytes32 & 32 & Partition identifier \\
checksum & uint32 & 4 & CRC-32C checksum \\
\midrule
\multicolumn{2}{l}{\textbf{Total}} & \textbf{114} & \\
\bottomrule
\end{tabular}
\end{table}
At 114 bytes per order message, ZAP achieves serialization latency under 1 microsecond on modern hardware, compared to 50--200 microseconds for JSON-based protocols.
\subsection{Latency Comparison}
\begin{table}[H]
\centering
\caption{Serialization latency comparison.}
\label{tab:latency}
\begin{tabular}{lrrr}
\toprule
\textbf{Protocol} & \textbf{Message Size} & \textbf{Serialize} & \textbf{Deserialize} \\
\midrule
ZAP (binary) & 114 B & 0.8 $\mu$s & 0.6 $\mu$s \\
Protocol Buffers & 180 B & 3.2 $\mu$s & 2.8 $\mu$s \\
FlatBuffers & 192 B & 1.5 $\mu$s & 0.4 $\mu$s \\
JSON & 420 B & 52 $\mu$s & 38 $\mu$s \\
FIX (text) & 350 B & 28 $\mu$s & 22 $\mu$s \\
\bottomrule
\end{tabular}
\end{table}