Take the 2-minute tour ×
Quantitative Finance Stack Exchange is a question and answer site for finance professionals and academics. It's 100% free, no registration required.

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:

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?

share|improve this question
    
Each exchange may provide its own algorithm to manage order book. Please provide more info. I see that your struct does not contain Order ID, so it looks like fixed depth order book (e.g. CME). But there is also no NumberOfOrders field in your struct. Is this just a fixed depth order book where each level contains only <price,size> entry? In this case it's just 20 lines of code. –  Serg Nov 30 '13 at 2:12
    
this is for moex.com for this template ftp.micex.com/pub/FAST/ASTS/template/FIX50SP2-ALL.xml –  javapowered Nov 30 '13 at 2:59
    
MDEntryID is OrderId (not equal to real order id but this is not important). MDEntryPx is order price and MDEntrySize is order volume and MDUpdateAction is what happened with order (added, modified or removed) –  javapowered Nov 30 '13 at 3:02

1 Answer 1

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.

share|improve this answer
    
decoding FAST messages is separate task, let's assume I have decoded messages. in general FAST messages are all prety similar and looks something like my structure in question. I don't care about priority. Just give me good implementation of orderbook from FAST for SOME case and I think I will be able to adjust it for MY case. –  javapowered Nov 29 '13 at 17:58
2  
Order books are all about priority. –  Louis Marascio Nov 29 '13 at 18:00
    
in simplest case I just need best bid and best offer –  javapowered Nov 29 '13 at 18:14
    
If the data is message by message depth of book data you can't get the best bid/offer without building and maintaining a book. –  Louis Marascio Nov 29 '13 at 18:40
1  
@javapowered, with all due respect but it sounds like you are missing some crucial basics here. You can't derive your best bid/offer without building and maintaining the book and that is precisely what Louis has already told you –  Matt Wolf Nov 30 '13 at 15:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.