22

Since Quant Cup 1's objective was an efficient price/time matching engine, the data structure of the winning implementation might partly be what you are looking for. Else the setup of LOBSTER is supposed to be quick.


21

The specifics depend on if you're implementing for equities (order-based) or futures (level-based). I recommend https://web.archive.org/web/20110219163448/http://howtohft.wordpress.com/2011/02/15/how-to-build-a-fast-limit-order-book/ for a general overview of a good architecture for the former. Building off of that, though, I have found that using array-...


10

Repeating groups are a way for FIX to represent arrays. A "number of" field prepends the repeating group to alert the recipient how many elements to expect. For example, Arca uses TradingSessionID (tag 336) to identify pre-open (P1), primary (P2), and post-close (P3) market hours. This group is prepended by NoTradingSessions (tag 386). So, I would use the ...


10

The flickered orders are postonly bid at 15.16. The exchange slides it back to 15.15 to avoid a locked market. Submitting firm sees the slideback and cancels. Then tries again. When the 15.16 offer is executed or cancelled out, the offer moves to 15.17 then the postonly bid at 15.16 goes through at the targeted price and gains good queue position.


10

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 ...


8

I can think of 3 reasons: 1) Queue position 2) To be on the other side when an alogrithm has a disastrous error, which happens quite often on singular stocks and doesn't get reported (but someone will get fined) . I've seen cases where the price will drop over 99% almost instantaneously. For this to occur a backfiring algo will clear out the entire bid ...


8

As Alex C. notes, OHLC bars are meant to be calculated using transaction ticks. However, you could try to make bars from bid/ask individually (or perhaps even the mean of the two as an approximation), but bear in mind that they are not the 'real thing'. But assuming you acquire transaction data, there are a number of possible methods for forming OHLC bars (...


7

Your first definition is wrong; I'm not sure where you got that from. Your second definition is correct: the ISO alerts the exchange that the submitting party has taken responsibility for RegNMS and requests a fill at only that venue's price; there is no routing away. Obviously, there is a huge red-tape burden to get permission to do this.


7

I recently stumbled upon this question after needing to do this to do some real-time microstructure analysis and have taken a look at the various possible implementations. Here are some of the pros/cons of each implementation (I'll use C/C++ terminology): Array: You have an array of structs ordered from top of book (index 0) to worst (index N). You have to ...


7

The Queue Reactive Model (by Huang, L and Rosenbaum) is an improvement of what Cont and de Larrard (CL) did. This model is capturing the inflows and outflows in each queue given the current state of the orderbook (it is one of your remark) but more importantly, once one queue depletes, the discovered quantity is not taken at random (like in the CL model) ...


6

You have two ways to estimate your position in an order book: first if you have access to an ITCH feed, you can recognize your order into the ITCH updates, and know exactly where you are, but you will have to build an engine to translate an order-by-order ITCH feed to a limit order book; or you have to use estimates; the easiest way to build one is to ...


6

I am not aware on any rules preventing a too high number of entries at a limit price. Nevertheless you usually have controls for each trader id. A trader cannot have too many orders in the book or send them at a too high frequency. [EDIT] Moreover, on most trading platforms you cannot have orders too far away from the mid (or a reference price like the ...


6

In my opinion, instead of developing an analytical model, it's better to evaluate this probability directly from the data. Place your simulated orders at different price levels, and check whether and when they would be executed. Then use this probability model to simulate your trading strategy. However, assuming that you want to simulate a trading strategy,...


5

Each venue will allow diferent order types, and will have different matching rules (the queue positions you mentioned), so this is not general to the whole market, but this is a paper from Nyse that is pretty much explains most of the order types I have heard of: http://www.nyse.com/pdfs/fact_sheet_nyse_orders.pdf Also, one factsheet/regulation from the ...


5

http://lobster.wiwi.hu-berlin.de/forum/viewtopic.php?f=4&t=30 R code, pictures and discussion, it's easy to modify it


5

I do not know in which context you want to implement a matching engine (ME). But according to me the two nice challenges in this context are: implement one in an FPGA for simulation / fast replay purpose, design the most efficient in/out bus to put synthetic traders in front of the ME. The last point is about simulating one day in few seconds. To answer ...


5

Don't discount the fact that it could be a fund testing a strategy or order type. I do this all the time. I'll take an algo that should penny on say, VWAP, and make it penny on VWAP - $10 to ensure that it works but if it does go a bit crazy then atleast I have a buffer before it starts going active. Same thing with order types, if I'm testing a new fix ...


5

I fully agree with all potential rationals written here to put bids and asks deep in the book. All these interests are part of what we should name the latent order book, since potentially agent would be glad to buy or sell at such prices in an hypothetical future. Philosophically, I would say that the more mature a market is, the less you should see such ...


5

I have heard of several allegations in the recent days, but they are mostly baseless. However, there are a rare, few trading venues whose matching rules are most often accused of giving unfair order execution advantages to certain firms. These usually arise from violations of the standard price-time priority: IEX's broker priority rule. "All orders will be ...


5

The round-trip latency from point A to a matching engine at point B can be thought of being comprised of two components: $RTT_{total,A \rightarrow B} = RTT_{network\_transit,A \rightarrow B} + MPL_{matching\_engine,B}$ Where $RTT$ is the round-trip time and $MPL$ is the message processing latency (how long it takes to receive a message and produce an event)...


5

A "flickering" order is one which is repeatedly submitted and cancelled (whether it's at the top of book or not). The answer from @chollida mentions that "the goal typically is to either slow down competitors quotes by flooding the gateway interface with noise" but I don't think that's necessarily true. Rather, I think many flickering quotes are caused by ...


5

Orders stay in order book for as long as you specify, e.g. "good till cancelled" (GTC) will be sitting there until it's executed or you cancel it. There are many types, just google them - IOC, FOK, GTD, at open, at close etc. Many brokers have introduced their own, proprietary types, see e.g. Interactive Broker's list here: https://ibkr.info/video/1037 ...


5

This is somewhat of an opinion based response with some factual anecdotes at the end. Spoofing is a very difficult concept to define, identify and prove. In voice brokered markets where transactions are executed with levels of discretion, spoofing can be more readily identified by people refusing to commit to trades with insufficient reasons of cancellation....


4

It depends on your goal. Suppose we have a stock whose top-of-book quotes show far more size on the bid than on the ask. If you want the weighted mid to reflect sentiment at this moment, then certainly the market participants agree that the fair price is less than the mid. However, if you assume that these participants are informed market makers and your ...


4

Some exchanges have agreements with market makers to provide liquidity (the market makers often get some kind of preferential treatment in return). Often these agreements will include obligations to be actively quoting some minimum percentage of the time, on both sides of the book (bid & offer). Quoting non-marketable prices is one way to meet these ...


4

The two types of orders are called "Attributed" and "Non-Attributed". Venues will sometimes provide incentives to encourage order attribution. For example, Direct Edge has their "Edge Attribution Incentive Program" which you can read about on their price list. I believe NASDAQ has offered incentives for attribution in the past, but I don't think they do ...


4

Yes. Increasing the size of an order is like cancelling and reinserting it. You lose queue priority and insert behind the other orders.


4

You are usually given an option to either - Request a re-transmission of the messages you missed (through a different channel). Request a snapshot of the current book from a dedicated server. Both are likely TCP based.


4

One way to do this is a simple Monte-Carlo simulation. There are formulae you can use to get the likelihood of a stock being below a price if you know the stock's volatility and time frame - see for example this question. For an unknown time frame, the Monte-Carlo method is (IMO) simpler than the mathematics. You would simply run a number of simulations ...


Only top voted, non community-wiki answers of a minimum length are eligible