Reconstructing Exchange Order Books from FAST Market Data
Summary
The document asks how to build a fast order book from FAST market-data updates when the exchange has already matched trades. The task is reconstruction and aggregation of exchange messages, rather than implementing a matching engine. It therefore involves two distinct components: decoding the FAST feed and applying its updates to maintain the book.
The answer cautions against adopting a generic open-source order-book implementation without checking the relevant exchange and market rules. Priority can vary by venue, and the correct handling of new, changed, and deleted entries depends on the feed and market specifications. The data source and its rules must be identified before an implementation can be judged suitable. The response gives architectural guidance but no specific library, code, benchmark, or implementation steps, so it does not resolve the request for a ready-made solution.
Key ideas
- FAST order-book reconstruction requires decoding feed messages and maintaining the book from updates.
- A reconstruction system does not need to implement matching when the exchange has already matched the trades.
- Order priority rules differ across markets and must be applied according to the relevant specifications.
- A generic order-book library may fail if its assumptions do not match the source exchange’s rules.
- The answer provides design cautions but does not name a recommended implementation.
Tags
Full text
# open-source implementation of orderbook from FAST?
# open-source implementation of orderbook from FAST?
I'm looking for c/c++ implementation of OrderBook. I need implementation to reconstruct market data from FAST. I don't need to do "matching" because it already did by exchange, I only need to "aggregate" such structures:
```
struct OrderUpdate {
int32_t instrumentId;
uint32_t MDEntryID;
uint32_t MDUpdateAction; // 0 - New 1 - Change 2 -Delete
int64_t MDEntryPx_Mantissa;
int16_t MDEntryPx_Exponent;
int64_t MDEntrySize_Mantissa;
int16_t MDEntrySize_Exponent;
uint32_t RptSeq;
uint32_t MDEntryTime;
uint32_t OrigTime;
int32_t SecurityTradingStatus;
char MDEntryType; // 0 - buy; 1 - sell; other values in documentation
char MsgType;
};
```
Main requirement is, of course, speed. I've found in internet several projects:
- http://www.ociweb.com/products/liquibook
- https://github.com/chuvpilo/OrderBook
- https://github.com/jordanbaucke/Limit-Order-Book
- https://code.google.com/p/rex-matching-engine/
- http://www.quantcup.org/
Unfortunately most of these implementations are "matching" engines and not exactly what I'm looking for.
What is better to use to reconstruct orderbook from FAST messages?
## Answer by Louis Marascio (score 12)
https://quant.stackexchange.com/a/9588
You don't just simply grab some random open source order book implementation and expect it to work. Every market is different. For example, markets have different rules for how you should handle priority in the order book (some are price-time, some are price-size-time, etc). Grabbing Joe Blow's code and expecting it to just work is only going to lead to pain and failure.
You have two separate issues. First, you must decode the FAST messages, and second you must build a book from them based on the specifications from the exchange and market in question.
For your question to be even be well-formed you should indicate exactly where the data is coming from. Of course, there is probably a 0% chance that someone is going to be able to provide an affirmative reference for you where you can download a working order book for the data you have.Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.