ReLOBGen: Replayable Limit Order Book Message Generation
Organizations: ECE & 3IPAI, Seoul National University · Department of Statistics, Purdue University · 3IPAI, Seoul National University
Abstract
We propose ReLOBGen, a method for generating limit order book (LOB) messages that are replayable by construction. Replayability is required for closed-loop market simulation, yet existing LOB message generators may produce non-replayable raw messages, i.e., messages inconsistent with the current market state. These generators therefore rely on post-hoc correction or rejection followed by resampling, which may alter the replayed message distribution or increase inference cost. ReLOBGen instead ensures replayability during generation: it selects the referenced order from the resting orders in the current LOB and then generates the remaining message fields to be consistent with that order and the market state. For realistic reference selection, ReLOBGen samples from a learned distribution over eligible resting orders, efficiently computed from cached order representations and a context-dependent query. It then enforces the consistency of the remaining fields by masking out invalid tokens. Together, these components enable efficient generation of realistic messages without post-hoc correction or resampling. In 500-message rollouts, ReLOBGen achieves 100% replayability, improves market realism, particularly for top-of-book statistics and the relative prices of LOB messages, and provides a speedup per replayed message over the LOBS5 baseline.
Figures & tables
| Event type | Eligible resting-order set | Event-order constraints |
|---|---|---|
| Add | – | Bid: ; Ask: . |
| Cancel | and . | |
| Delete | and . | |
| Execute | and . |
| Post-processing | Replayability violations | Runtime (ms) | |||||
|---|---|---|---|---|---|---|---|
| Ticker | Method | Correction | Rejection | Reference | Event-order | Per replayed msg. | Per attempt |
| GOOG | LOBS5 (ref.-last) | 13.5% | 25.7% | 39.1% | 0.4% | ||
| LOBS5 (ref.-first) | 11.7% | 27.6% | 39.5% | 0.1% | |||
| ReLOBGen | 0.0% | 0.0% | 0.0% | 0.0% | |||
| INTC | LOBS5 (ref.-last) | 9.7% | 16.3% | 25.6% | 0.5% | ||
| LOBS5 (ref.-first) | 11.5% | 13.2% | 24.5% | 0.2% | |||
| Metric group | ||||||||
|---|---|---|---|---|---|---|---|---|
| Ticker | Method | Overall | State | Times | Volumes | Depths | Levels | Trades |
| GOOG | LOBS5 (ref.-last) | 0.27 | 0.35 | 0.16 | 0.25 | 0.40 | 0.21 | 0.23 |
| Ref.-first + uniform | 0.24 | 0.31 | 0.20 | 0.22 | 0.23 | 0.20 | 0.27 | |
| ReLOBGen | 0.17 | 0.24 | 0.15 | 0.18 | 0.20 | 0.11 | 0.18 | |
| INTC | LOBS5 (ref.-last) | 0.22 | 0.14 | 0.14 | 0.20 | 0.32 | 0.17 | 0.27 |
| Ref.-first + uniform | 0.30 | 0.10 | 0.35 | 0.27 | 0.36 | 0.34 | 0.32 | |
| Conditional ( ) | Market impact | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Ticker | Method | ask vol. spread | spread time | spread volatility | ||||||
| GOOG | LOBS5 (ref.-last) | 0.14 | 0.63 | 0.46 | 23.4 | 16.9 | 5.5 | 8.7 | 4.5 | 4.7 |
| Ref.-first + uniform | 0.16 | 0.51 | 0.57 | 12.1 | 13.9 | 10.5 | 4.9 | 7.6 | 8.8 | |
| ReLOBGen | 0.18 | 0.37 | 0.42 | 7.2 | 10.4 | 1.7 | 3.1 | 3.3 | 5.3 | |
| INTC | LOBS5 (ref.-last) | 0.22 | 0.22 | 0.16 | 9.9 | 5.9 | 2.3 | 3.5 | 0.4 | 11.8 |
| Ref.-first + uniform | 0.49 | 0.15 | 0.09 | 7.2 | 5.4 | 0.8 | 2.2 | 1.3 | 11.6 | |
| Ticker | Token order | Overall | Type | Side | Price | Size | Time (s) | Time (ns) | Price | Size | (s) | (ns) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| GOOG | Ref.-last | 19.01 | 0.76 | 0.51 | 0.00 | 0.02 | 0.29 | 1.33 | 1.83 | 1.29 | 0.00 | 12.96 |
| Ref.-first | 18.94 | 0.75 | 0.51 | 0.89 | 0.55 | 0.30 | 1.29 | 0.96 | 0.74 | 0.00 | 12.97 | |
| INTC | Ref.-last | 18.50 | 0.71 | 0.51 | 0.00 | 0.06 | 0.38 | 1.65 | 0.97 | 1.95 | 0.01 | 12.27 |
| Ref.-first | 18.51 | 0.72 | 0.50 | 0.46 | 0.82 | 0.37 | 1.66 | 0.51 | 1.20 | 0.01 | 12.28 | |
Appendix figures & tables16 assets
Supplementary material from the paper’s appendix.
Appendix
| MBO action pattern | LOBSTER output | Side source |
|---|---|---|
| Add ( A ) | Type 1: Add | side of A |
| Cancel ( C ) | Type 2/3: Cancel/Delete | side of C |
| Replace ( C A ) | Type 2/3 Type 1 | side of each C / A |
| Visible execution ( T F C ) | Type 4: Execute | side of F |
| Cross trade ( F C ) | Type 6: Cross trade | side of C |
| Reset ( R ) | No LOBSTER message | — |
| MBO field | LOBSTER-compatible field | Description |
|---|---|---|
| ts_event | Time | Exchange-recorded event timestamp |
| action | Type | Order-book event category |
| order_id | Order ID | Individual order identifier |
| side | Direction | Buy or sell side |
| price | Price | Order or execution price |
| size | Size | Order, cancellation, or execution quantity |
| Field | # Tokens | Normalization and encoding |
|---|---|---|
| Event type | 1 | No normalization |
| Event side | 1 | Ask: 0 / Bid: 1 |
| Reference-order price | 2 | |
| Reference-order size | 1 | |
| Reference-order time (s) | 2 | Seconds component |
| Reference-order time (ns) | 3 | Nanoseconds component |
| Training stage | Dataset | Budget | Batch size | Optimizer | Peak LR | GPU hours |
|---|---|---|---|---|---|---|
| Base model | GOOG | 100M | 512 | Adam | 8 L40S 54 h | |
| INTC | 50M | 512 | 8 L40S 27 h | |||
| Reference selection | GOOG | 200M | 256 | AdamW | 1 A6000 33 h | |
| INTC | 100M | 256 | 1 A6000 25 h |
| Model | # Params | Details |
|---|---|---|
| 35.78M | • S5 backbone: ; SSM state size 512. • 2 S5 message-encoder layers; 1 pre- and 1 post-book-encoder layer. • 12 S5 layers for message–book fusion. | |
| 0.13M | • Layer-normalized 512-d state concatenated with a GELU-projected mid-price displacement ( ). • projection followed by layer normalization. | |
| 2.16M | • Eight 512-d token embeddings flattened into a MLP, with GELU after the first layer and output layer normalization. |
| Post-processing | Replayability violations | ||||||
|---|---|---|---|---|---|---|---|
| Ticker | Event | Method | Attempts | Correction | Rejection | Reference | Event-order |
| GOOG | Add | LOBS5 (ref.-last) | 255,720 | 0.0% | 0.2% | 0.0% | 0.2% |
| LOBS5 (ref.-first) | 259,199 | 0.0% | <0.1% | 0.0% | <0.1% | ||
| ReLOBGen | 243,723 | 0.0% | 0.0% | 0.0% | 0.0% | ||
| Cancel | LOBS5 (ref.-last) | 4,692 | 9.9% | 67.6% | 76.1% | 5.1% | |
| LOBS5 (ref.-first) | 2,781 | 9.4% | 67.7% | 76.7% | 1.8% | ||
| Metric group | ||||||||
|---|---|---|---|---|---|---|---|---|
| Ticker | Method | Overall | State | Times | Volumes | Depths | Levels | Trades |
| GOOG | LOBS5 (ref.-last) | 0.43 | 0.59 | 0.31 | 0.34 | 0.69 | 0.37 | 0.35 |
| Ref.-first + uniform | 0.33 | 0.39 | 0.33 | 0.23 | 0.28 | 0.44 | 0.32 | |
| ReLOBGen | 0.22 | 0.33 | 0.20 | 0.19 | 0.19 | 0.14 | 0.28 | |
| INTC | LOBS5 (ref.-last) | 0.30 | 0.34 | 0.26 | 0.14 | 0.40 | 0.34 | 0.29 |
| Ref.-first + uniform | 0.46 | 0.23 | 0.64 | 0.28 | 0.51 | 0.67 | 0.42 | |
| Conditional ( ) | ||||
|---|---|---|---|---|
| Ticker | Method | ask vol. spread | spread time | spread volatility |
| GOOG | LOBS5 (ref.-last) | 0.12 | 1.17 | 0.91 |
| Ref.-first + uniform | 0.12 | 0.78 | 1.03 | |
| ReLOBGen | 0.17 | 0.60 | 0.83 | |
| INTC | LOBS5 (ref.-last) | 0.24 | 0.57 | 0.50 |
| Ref.-first + uniform | 0.67 | 0.36 | 0.23 | |
| Ticker | Method | Add | Cancel | Delete | Execute | TV |
|---|---|---|---|---|---|---|
| GOOG | Actual | 50.2% | 0.2% | 46.6% | 3.0% | – |
| LOBS5 (ref.-last) | 51.0% | 0.3% | 36.9% | 11.8% | 9.6 pp | |
| Ref.-first + uniform | 45.2% | 0.2% | 38.4% | 16.2% | 13.2 pp | |
| ReLOBGen | 48.7% | 0.2% | 41.9% | 9.2% | 6.2 pp | |
| INTC | Actual | 49.7% | 0.2% | 43.7% | 6.4% | – |
| LOBS5 (ref.-last) | 52.5% | 0.1% | 43.4% | 4.0% | 2.8 pp |
Synthetic Data Generation
Synthetic data generation creates artificial examples, simulations, and datasets to train, test, or protect machine-learning systems.
See all 620 papers