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 am working on an improvement of my company's order allocation system. We run a central Order Management System (OMS) but currently performance attribution from filled orders leaves room for improvement.

I look to understand how other systems handle order and trade allocation.

Example: Asset 'A'

Fill1; buy A 500 shares; avg px x1
Fill2; buy A 300 shares; avg px x2
Fill3; sell A 700 shares; avg px x3
Fill4; sell A 100 shares; avg px x4

One example how a trade could be defined is as follows:

Trade1, avg entry px=x1; avg exit px=x3 Trade2, avg entry px=x2; avg exit px=(2*x3+x4)/3

To compute performance of individual trades (not total performance as that is trivial) would you apply a FIFO-like approach or allocate filled shares and their filled price in a different way? The reason I attempt to break it down is for various reasons, among others TCA and to better analyze algorithm predictive power in detail.

Can you please share how you would approach this issue and if you know what you believe industry standard is? I want to have a better understanding before having it all spec'ed up and implemented by developers.

Edit:

To avoid confusion, my question is not at all related to order matching on the exchange/ecn side, but fill allocation and trade performance attribution on the liquidity taking side.

share|improve this question
    
Are you asking about how electronic exchanges manage and match orders? –  Serg Oct 22 '13 at 12:18
    
No, I am asking about how trades and fills are managed on the liquidity taking side as part of a larger order management and risk management system. I edited my question a little to make it clearer. –  Matt Wolf Oct 22 '13 at 13:09

3 Answers 3

up vote 6 down vote accepted

Approaches like FIFO and LIFO are most useful for tax accounting. If you don't have a tax accounting reason to do them, I'd recommend avoiding them, as they don't reflect actual realized gains (it's very rare for a position accounting system to move cash in and out of your account based on FIFO or LIFO).

I'm going to discuss everything here in Gross of Fees terms, since Net of Fees complicates the discussion a bit.

Most position accounting systems use average cost accounting. So, the average cost of your position is zero when you are flat (you have no position), and changes as your position gets further away from zero.

You realize gains when your position gets closer to zero/flat. The average cost of that position does not change. Your realized gain or loss is the difference between this "closing" transaction value and the average cost.

Now, how to discuss trades? I think there are two practices that are rational and widely used in this space.

One approach is "flat to flat". If your positions are typically opened and closed in round lots, then flat to flat can make a lot of sense. Even if you tend to open or close positions with partial fills, flat to flat measurement can make a lot of sense, and is pretty easy to do as the cumulative realized P&L of all transactions between the first opening trade and the last closing trade.

The other approach is to count every transaction that reduces the position (moves it closer to zero/flat) as a "trade". This allows you to report the realized P&L from that "trade" as well as track other statistics like time in market, excursion, drawdown, etc.

The third approach that I'll discuss is very algorithm specific, and widely used but not exactly generic. If your algo can tag transactions as opening or closing fills, then you can do average cost accounting and use either the flat to flat or position-reducing methods described above on 'logical' rather than 'physical' positions and "trades". I think that this is some of the rationale behind things like LIFO and FIFO: trying to logically group transactions into "trades". I think that actually having the algo tag the fills and declare whether the transaction should be considered an opening or closing transaction avoids the subjective and arbitrary approaches provided by FIFO and LIFO, letting the intent of the algorithm control the definition.

share|improve this answer
    
Some interesting concepts, thanks a lot. Regarding your comment on the "reduced position transaction" approach, I still believe you need to define a rule around that in terms of where to allocate the shares to. If you had two buy orders, got filled, and now get a fill on a sell order then you still need to decide where to allocate the shares to, hence my mentioning of FIFO. I like the last suggestion, though I would need to think a little more because most our strategy algorithms have very limited knowledge of fills. But logically it makes sense to have the algo define what constitutes a trade –  Matt Wolf Oct 21 '13 at 14:15
1  
I think that you need to decide whether you want a 'neutral' accounting style treatment or an 'active' allocation treatment. If you want a neutral approach, either of the first two methods I described will be consistent with your accounting system. If you want an active treatment, then I think you need to have the algo decide. Allocating on LIFO or FIFO basis can create non-intuitive 'gains' and 'losses' on 'trades' as all of your profit or loss get swallowed by one fill. This is why I think approaches that more closely match the actual movement of cash in the account make more sense. –  Brian G. Peterson Oct 21 '13 at 14:52
    
Will take that into consideration. Thanks for your take on that. –  Matt Wolf Oct 21 '13 at 15:31

I'll add my own experience here based on what we do at our firm, simply to provide more support for what Brian said in his answer.

Fills that move a position further away from 0 contribute to the average price of the position.

Fills that move a position closer to 0 "book profits" against the average price of the position to that point in time.

Any fill that causes a position to cross 0 must be handled so that it hits 0 first, and then crosses to the other side to ensure proper accounting.

In our world we refer to a "trade" as having an open time of the timestamp of the first fill that moves away from open position size of 0. The trade is closed or finalized when the size reaches 0 again. So the lifetime of the trade is simply the time spent not at position size of 0.

From your example, what you refer to as "trades" we call fills. The "trade" is the entire sequence of events that encompass moving from net position size of 0 and back again.

t0 we own 0 shares of A
t1 buy  500 A at x1
t2 buy  300 A at x2, average price is now the wavg of the fills
t3 sell 700 A at x3, book x3 - avg price, position now 100 shares
t4 sell 100 A at x4, book x4 - avg price, position now 0 shares
position or "trade" is now closed and we start over again

t1 is the open time of the trade. t4 is the closing time of the trade. The trade is made up of 4 total fills, 2 of which are "opening" fills and 2 are "closing" fills. A fill is an opening fill if it moves net size farther from 0. It is a closing fill if it moves net size closer to 0. Any time you reach 0 (or cross it) you close the trade and, in the case of crossing 0, start a new one. When I refer to "crossing 0" it is because we model long positions as positive size and short positions as negative size.

share|improve this answer
    
Louis, thanks for adding your take. I get what you mean, and it answers the computation of cost to enter and pnl when releasing utilized capital. What would interest me beyond that is how your firm defines trades. Do you just end up in any given day with one big trade and one pnl or do you break it down into smaller trades and if yes by what metric? –  Matt Wolf Oct 22 '13 at 16:03
1  
I've added a bit more detail, hope that helps. Let me know if you want more clarification. –  Louis Marascio Oct 22 '13 at 16:15
    
Thanks for adding more color, it really helps. And of course I was also referring to fills in my above example, I edited to replace 'trade' with 'fill'. –  Matt Wolf Oct 22 '13 at 18:00
    
Very interesting and I guess it goes in hand with what Brian described, I guess. I come from a slightly different direction in that we mico benchmarked and analyzed each individual fill, hence my ending up with two trades as per my example above. I find the way you described it definitely intriguing, though one issue I am worried about is loss of statistical metrics when defining a trade as essentially "going flat" rather than being able to get a finer-grained average price and the given fills absorbed into more trades. I guess I will ponder about it a little longer, thanks for the edit. –  Matt Wolf Oct 23 '13 at 17:58

Here is a suggestion for performance analysis. It visualizes the quality of individual decisions, taken by the trading strategy. For simplicity purposes lets consider only BUY trades (the SELL trades may be multiplied by -1). Define reasonable trading horizon. Organize all trades in the same graph where:

  • x-axis is time around the execution, such that executions always occurs at t=0.
  • y-axis is the asset's price minus avg. execution price

Optionally, multiply each timeseries by corresponding trade's size. In this case the timeseries represents each trade's P&L.

enter image description here

Such view may provide very important insights about the strategy in addition to total performance. For example, you may observe that only a few trades contribute to total performance while the rest are "noise" trades. Then you can study what distinguishes these "special" decisions. Also, different effect like slippage can be easily observed and measured. You can also add a line that represents the average response. However, this method has its drawbacks, for instance, it doesn't account the position, but only the quality of individual decisions.

share|improve this answer
    
While that looks neat and is called "excursion", it does not answer any of my question unfortunately. –  Matt Wolf Oct 22 '13 at 14:50

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.