# Tag Info

18

This is determined through order precedence rules. In most markets, these are Price priority: precedence goes to the best ask or bid offers. Time precedence: precedence goes to who improves the current ask or bid offers. In computer-speak that's FIFO. It encourages the market participants to improve prices aggressively. Public order precedence: public ...

12

IMO transaction data is a better approach, because you have both sides of the trade agreeing that the price is "right." The literature tends to decompose the transaction price $P$ into a true/efficient price $P^e$ plus micro-structure noise, which I think originates from Hasbrouck '93 in the Review of Financial Studies. So you end up with something like P^...

12

I don't know why it was removed, but the R package "orderbook" was available: http://journal.r-project.org/archive/2011-1/RJournal_2011-1_Kane~et~al.pdf http://cran.r-project.org/web/packages/orderbook/index.html In the IBrokers package, the function "reqMktDepth" is used for streaming order book data. http://cran.r-project.org/web/packages/IBrokers/...

12

All exchanges allocate to best price. This is by law in the US, and it's unimaginable that an exchange would do otherwise in other jurisdictions. As for tie-breaks, there are two possibilities for public orders: Time: first-come first-served; used for most equities exchanges Pro-rata: larger quote sizes get more of an incoming market order; common for ...

11

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.

10

As RYogi indicated, this depends on the exchange and product type. e.g. here is a summary of the matching algorithms at the CME The answer to the second part of your question is yes. Even in a market like the Eurodollar futures -- which is mostly pro-rata, but has a FIFO component -- a common strategy is to "stack the book." So that you will be first in ...

10

Here's a blog post with a general overview of some possible implementations. howtohft_howtobuildafastlimitorderbook - (mirror of the original posting) The posting was originally on the website www.quantcup.org - this site is up for sale but I leave the broken URL to help future searchers:

9

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.

8

Why not just use the weighted mid-market price, quoted as (Bsize * Aprc + Asize * Bprc) / (Asize + Bsize)? This measure doesn't suffer a bounce per se and allows you to directly take moving or exponential moving averages.

8

Market makers place quotes on both sides (ie, the bid and the ask). Depending on the market, the MM might even be contractually obligated to provide liquidity within some threshold. NYSE's designated market makers (who replaced the specialists a few years back) are an example. Even when there is no explicit requirement, the MM will quote both sides and ...

8

You don't say what it is that you do with trade data that is made difficult by the bid-ask bounce. If it's for the purpose of establishing the price at which you can trade and it's at a frequency where the bid-ask bounce is a problem, then I think having realistic execution assumptions is the way to go. In particular this means that you should be mainly ...

7

Validating tops against the consolidated is a good method. Obviously the time stamps won't match up, but the event stream should. Bear in mind that this won't tell you much about whether you're getting the inner dynamics of the book correct (for example, did the newly inserted order go into the right spot within a given price level). You should build ...

7

There is a paper of mine answering To this question: Dealing with the Inventory Risk. A solution to the market making problem by Olivier Guéant, Charles-Albert Lehalle, Joaquin Fernandez Tapia.

7

So one such visualization package is demonstrated in http://www.tradeworx.com/movie/booklet_demo/temp/booklet_demo2.mov. AFAICT it looks like a tk script. Trading Technologies (TT) sells another visualization tool. But TBH writing your own tool takes a few hours and allows you to focus on what information you are interested in finding.

7

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

7

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

6

i am not a F# expert but when it comes to performance and thread safety try sorted list or hashset. sorted list if the data needs to be sorted (it gets sorted when added to the list) otherwise hashset, no sorting hence better performance. they are both generic. in addition i would think you need thread safety when reading/writing/updating your data in ...

6

You won't know who made the trade, so you'll need to look at the quotes. Specifically, you should look to see if there are a lot of cancellations in the full order book. That will tell you if there's higher "churn" for a particular stock since HTFs often have low fill ratios (<1% for some shops). But you'll need to control for volatility since wild market ...

6

There is no need to complicate things: ... d = getBdepth(); d = getOdepth(); // for the calls below pos == 0 means the best bid/offer p = getB(int pos); // bid price at pos p = getO(int pos); // offer price at pos q = getBq(int pos); // bid quantity at pos q = getOq(int pos);// offer quantity at pos Note that the above API is not the best choice if your ...

6

If you're writing a "highly-optimized" book then you should be tailoring that book to the venues from which you will be receiving data. Max price, for example, is published in NASDAQ's Itch spec: 200,000.0000. If you plan on trading US equities you better go read each of the venues depth of book specs very carefully. You'll find all sorts of ways to ...

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

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

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

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

4

Assuming that: limit prices of Long and Short orders are equally pre-calculated in all 3 strategies; there is no risk-free return; strategies 1 and 2 have equal quality, and strategy 3 is slightly better. However, the only advantage that strategy 3 takes over 1,and 2, is better location of the orders in the price level queue. In case of FIFO (price-time ...

4

You might find the paper "Low-Latency Trading" by Hasbrouck and Saar useful. In it they discuss the episodic nature of some high-frequency flow and construct some useful measures of this flow. Generally, I would think some model that relates the cancel rate with the quote rate is most useful.

4

A simple way to do this with the TAQ database (Nasdaq trade and quote) is to measure the amount of time between a quote update and a trade inside that quote. The shorter that time, the higher probability HFT is present.

4

F# provides you with many data structures for collections, but in functional programming, you try to have immutable data structures, such as the F# List. It becomes quite handy if you want to do some parallel computing, for example. You can have a look at my post on SO which is probably where you could ask your question in a more generic way such as "What ...

4

A correct answer would depend on the instruments and markets you're trading, and whether this is for handling public or propietary orders. For example, if I were to design for the simple case, US equities and a public market, I'd want the queue size at each price level to be able to handle at least the maximum daily volume of, say, QQQ. I know that's in no ...

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