Thursday 22 December 2011

Order and Execution Events

Quite recently we had a customer come to us with a question regarding the Execution events received on the API.  The question was: "How do a I recognise the last execution event for a given order event?"  This is a little bit tricky in the Java API as it does not behaviour exactly the same way that FIX does.  E.g. If an individual order with a quantity of 30 aggressively matches multiple price points (quantity of 10 at each) on the exchange, a fix user would expect would expect:

MsgType(35)=8, ExecType(150)=New(0), CumQty(14)=0
MsgType(35)=8, ExecType(150)=Trade(F), CumQty(14)=10
MsgType(35)=8, ExecType(150)=Trade(F), CumQty(14)=20
MsgType(35)=8, ExecType(150)=Trade(F), CumQty(14)=30

As our API is based upon our XML protocol the information that we can return on the API is restricted to what we receive in those events. For a similar scenario over our XML protocol only emits a single order event at the end of the matching cycle, therefore the data output would be:


So the Java API does not have the information about the individual filled quantities as a result of each execution only the final state of the order. This can make it a little tricky to find which execution event represents the end of the matching cycle. The information seen by a user of the Java API for the same scenario would be:

getQuantity() = 10, getOrder.getFilledQuantity() = 30
getQuantity() = 10, getOrder.getFilledQuantity() = 30
getQuantity() = 10, getOrder.getFilledQuantity() = 30

However, it is possible to use some of the additional events that are available on the Java API to derive the same behaviour. By listening to both Execution and Order events we can track the cumulative quantities as we go. It does require a little bit more state management by the client, but the logic is fairly straight forward.

5 comments:

  1. I was wondering what kind of automated tools or tests one would use for a high-speed messaging system like yours.

    Thanks,
    Mohan

    ReplyDelete
    Replies
    1. Hi Mohan,

      Dave Farley talks about our testing strategy in this presentation:

      http://skillsmatter.com/podcast/agile-testing/talk-by-dave-farley

      It's higher-level than specifics around testing for performance, but I think it gives an introduction to some of the techniques we use.

      Delete
  2. Thanks. I viewed part of it and I am familiar with Continuous delivery.

    I was also asking about workload generators for testing performance of threaded application like Java Grande.

    ReplyDelete
    Replies
    1. We've written all our testing tools ourselves, so I can't point you to any more information than the Continuous Delivery presentation (as it mentions the types of tests we run) - we don't use libraries or tools from third parties because when we started doing our testing nothing fit our requirements. One of the tools that we wrote was open sourced - http://code.google.com/p/jmicrobench/ - but we've moved on quite a long way since then.

      In terms of generating content to test, we record real production scenarios and feed those in to see what the performance of the system is like. We can tweak the profile of the test so that it emulates the same data in a shorter amount of time, or twice the data (or more) in the same period of time. This way we get much more accurate performance figures for how the system will work in the real world, rather than other statistical methods of generating load.

      Delete
  3. Harvinder

    How do I store the events and replay it again if needed?

    ReplyDelete