Category Archives: finance

LMAX disruptor framework and whitepaper

This is really old news now as I’m very late in posting it but since I’m still coming across people who have remained blissfully unaware I thought this was worth re-iterating. If you haven’t come across this yet drop everything else and read about the LMAX Disruptor framework and the associated whitepaper titled Disruptor: High performance alternative to bounded queues for exchanging data between concurrent threads. There is also an associated (and rather dated now) infoq presentation titled How to Do 100K TPS at Less than 1ms Latency.

In the beginning there was a main thread of execution, then came two and then thousands. Once we had scaled to starvation with threads came SEDA and the concept of queues, hierarchical topologies of queues and lots of writers and readers operating on queues with threads now relegated to second class citizen status. For a while the industry rested in the assurance that it had achieved equilibrium with innovation on latency. Then – out of the blue LMAX happened. LMAX (London Multi Asset eXchange) are the highest performance financial exchange in the world.

Read the whitepaper to find out just how outdated conventional wisdom on concurrent queuing in Java actually is and how a lack of awareness of how your financial code performs end-to-end hardware to VM could be created bottlenecks for your platform. The essence of the disruptor framework is a strikingly simple concept but at the same time profound not only in its effectiveness in attaining its goal – reducing latency – but also in the extent to which it leverages knowledge of hardware and the java virtual machine that it runs on.

It proves wrong beyond doubt the rather outdated mindset that questions employing Java for financial low latency use cases. Ever since Java 5 and particularly Java 6 – the JVM has dwarfed the Java language in its importance, capabilities and scope and as a result utilising Java is now fundamentally synonymous with utilising the JVM which is what makes the language so compelling.

It isn’t about the code that you write. It’s about the code that’s interpreted and then runs natively. It is naive to consider only the language as many seem to be doing in the light of the imminent release of Java 7. It’s important to bear in mind that whilst language sugar is important if runtime matters to you then you’ll want to focus on: (1) the VM (2) writing wholly non-idiomatic Java and (3) opposing conventional wisdom at every level of abstraction every step of the way.

Morgan Stanley Matrix wins UX 2011 Silver award

Morgan Stanley Matrix, a project I worked on for two years as part of the server side dev team, has won Silver in the User Experience 2011 Awards. Read the pitch and watch the application demo. Well done Morgan Stanley. It was a great team and a great project and I wish it continuing success.

Foreign exchange hiring and trading rising

Foreign exchange hiring and trading are reported to be rising. Efinancial careers reports on hiring that:

… a lot of the current opportunities are within the more established FX houses. BarCap is hiring Java and C++ developers for its 250-strong FX IT team, Citi has openings for developers and connectivity specialists for its front office FX IT division, while Morgan Stanley and Credit Suisse are both recruiting techies for their Matrix and Merlin platforms respectively.

Bloomberg says on fx trading that:

[It] rose last year, with the value of transactions handled by CLS Bank, the New York-based operator of the largest currency-settlement system, jumping 22 percent to an average $4.1 trillion a day. Currency markets climbed to record highs for average daily trading volume in the U.K. and North America, according to central bank reports … and … electronic trading volumes increased 25 percent from the previous year, according to the Euromoney survey, to account for 56 percent of all foreign-exchange business.

It seems like FX is a good asset class to bet on right now and an ever more competitive space.

Moody’s Lists U.K. Banks for Downgrade Review

Just as government support helped to raise UK lenders’ credit ratings previously, now, the withdrawal of government support prompts Moody’s to review their credit ratings with a view to downgrade them. Regulators are also attempting to devise rules whereby banks will be allowed to fail without resorting to the taxpayer for help.

Tech arms race in the Tron landscape

On the train, back to the real world, this evening for another year at work I came across a fascinating article in the New York Times titled ‘Electronic Trading Creates A New Trading Landscape – The New Speed Of Money Reshaping Markets‘. For the duration of that journey I was wholly engrossed in the article and the radial thought processes it triggered effortlessly and constantly on technology and finance. It was an inspiring read and one that made me glad and relieved that I happened to work in this industry.

Predominantly it talked about how, over time, smaller exchanges (such as Direct Edge) had reclaimed the overwhelming dominance and market share of the historic exchange duopoly of NASDAQ-NYSE and how, during that process, New Jersey had been transformed to become ‘the heart of Wall St’ through the placements of data centres within it that now host and operate some of the largest stock exchanges in the US. The charming reference to a ‘Tron landscape’ was made in the article based on the likeness of the blue phosphorescent lighting used in the datacentres for illumination to that in the film.

More interesting to me, however, was the story of how this progression had been driven from its core by the breakneck speed and sheer extent of technological automation, advancement and innovation leaving traders, regulators and the market struggling to keep up in its trail. So where are we now? Exchanges are distributed, leaner and more competitive. Through colocation, software advancement, closer proximity to targets and with new fibre optic pathways constantly being laid between critical geographic exchange data routes trading is faster. Through high frequency trading, dark pools and strategic algorithms – trading is more intelligent allowing arbitrage and price exploitation through micro trading under stealth.

What have been the consequences of such advancements over time however? The use of HFT to place a very large bulk order in small increments was found to be the root cause of a market crash last May when this particular HFT algorithm continued placing trades as part of a large order despite prices sinking part way through. As a result the SEC and the exchanges introduced a halt to trading on individual stocks if the price fell more than ten percent in a five minute period. Dark pools have been in the spotlight for being opaque and exempt from public scrutiny. And there is talk of regulation not only of data centres and colocation but of perhaps technology’s greatest achievement of all – speed. The unattended and perahps ill-considered advancement of technology for mostly selfish motives has resulted in a disproportionate loss of control, transparency and ethical considerations away from human discretion and towards machine code. Can technology continue to dominate this industry progression at its core to its advantage or will it become the very victim of its own success? I wonder where we go from here. What do you think?

Spring Integration Series – Getting started

In the past few months I’ve had the good fortune of getting familiar in depth with Spring Integration and being responsible for adopting it for use within a major investment bank. I’ve learnt a lot through many different channels, met in person with people from SpringSource and those directly contributing to Spring Integration and provided my own feedback through all these channels derived from my experiences in using it to fulfil my commercial use-cases.

During all this time I’ve been dying to blog about Spring Integration and particularly my use of it but haven’t been able to due to lack of time and energy outside of work. Going forward, however, my hope is that I’ll write a series of articles, one at a time, each exploring a different perspective on Spring Integration.

Here we begin by looking at how to get started with Spring Integration and how to get close to the source of the project using Eclipse IDE. The value of this will be felt most when browsing the org.springframework.integration.samples project which contains numerous fully working examples of how to use Spring Integration in different ways.

Getting started

My approach to learning any new subject is to put theory first. Here’s what I did to get started.

  1. Read the manual (yes the entire ~100 pages).
  2. Set up the source (as in the next section of this article).
  3. Review the sample applications (once you’ve set up the source).

If you prefer a more pragmatic approach from the start you can dive straight into the sample applications and start to write your own by referring to the manual as and when needed but this approach has the danger of leaving gaps in your knowledge as you start to write code.

Getting close to the source

The tools that you’ll need to work with the source are as follows.

Here’s how to set up the Spring Integration source in Eclipse.

  1. Check out the source.
    svn co https://src.springframework.org/svn/spring-integration/trunk/ si
  2. Increase max perm size available to Ant.
    export ANT_OPTS="-XX:MaxPermSize=512m"
  3. Build the project. This will take approximately ten minutes while it downloads all dependencies using Ivy.

    cd si/build-spring-integration/

    ant

    If you are running on Ubuntu and at this point you get UnknownHostException error messages then see recommended fix.

  4. Import the project into eclipse.

    • File > Import > Existing projects into workspace
    • Select root directory > Browse > Select the si/ folder
    • Deselect the project with no name and click Finish
  5. Create an ivy cache variable as follows.

    • Right click on any of the projects you imported above.
    • Properties > Java Build Path > Libraries
    • Add Variable > Configure Variables > New
    • Enter variable name as ‘IVY_CACHE’ and value as something similar to /home/dhruba/sources/si/ivy-cache/repository
    • Confirm all the dialogue boxes. The projects should automatically rebuild.

At this point you should have all the Spring Integration projects imported into Eclipse with no fatal errors and at the time of writing 94 warnings. Common guys we can reduce that to zero 😉 Now you should be able to open up the org.springframework.integration.samples project and browse through and run the sample applications provided for you.

With any luck a number of further articles on Spring Integration should follow. I have a lot that I want to convey but it is, as always, finding the time and the energy to write not only the articles but fully working illustrative showcase applications.

Thanks to Jonas Partner, Spring Integration committer, for providing the instructions.

Financial turmoil claims more casualties

The UK government nationalises Bradford & Bingley, Citi buys Wachovia for $2bn and the House of Representatives reject the $700bn bail-out plan as Republicans vote two-to-one against it. Just when you thought the short selling ban was stabilising the markets and the bail-out was reaching a positive consensus.

Update: The ban on predatory short selling proves counter-productive for the predator. And is Lloyds reconsidering its takeover of HBOS under falling share prices?

London tops world’s financial centres

FT reports that, out of 59 cities, London has yet again topped the list of the world’s financial centres but the gap between it and other rivals has been cut. The top seven world’s financial centres are as follows.  Note that as this bi-annual survey was taken in July it does not reflect the effects of the financial crises of the last month.

  1. London
  2. New York
  3. Singapore
  4. Hong Kong
  5. Zurich
  6. Geneva
  7. Tokyo

According to the study London lost points for the following.

The study authors suggest that London’s reputation is continuing to suffer from the government’s handling of the Northern Rock bank crisis and concerns that the regulatory environment is unpredictable and unstable.  London also slipped behind New York among government and regulatory respondents for the first time since the survey was taken.

Regarding which cities are likely to be the most significant in the future the following was said.

The survey also asks separate questions about which cities are the most likely to become significant in the future. Here Dubai, which came in 22nd on the main survey, was the big winner, with Singapore, Shanghai and several other Gulf state cities doing well.

It’s reassuring to know that I’m in the right place for now!

Update: FT reports US ‘will lose financial superpower status’.