Optimizing High-Performance Trading Solutions: An Engineering Perspective Matt Davey, CTO, Lab49 (www.lab49.com) Blog: http://mdavey.wordpress.com April 2011 V0.84
About Lab49 Lab49 is a strategy, design and technology consulting firm. Lab49 deliver strategic consulting and advanced solutions for the financial services industry. Our clients include many of the world s largest investment banks, hedge funds and exchanges. We design and deliver some of the most sophisticated and forward thinking financial applications in the industry today, and have an impeccable delivery record on mission critical systems. Our focus on innovation has led us to adopt usercentric practices that drive the design of solutions based on user needs and goals whilst delivering against the business requirements and delivery timescales. We achieve this through the combination of our industry leading Strategy Group, User Experience practice, Domain-Driven Development philosophy and Lean Agile processes. Our History Lab49 was founded in 2002 and now comprises over 200 people, with major offices in New York and London. We offer: An exclusive focus on Financial Services Emphasis on the development of Front Office Trading Systems End-to-end solutions, from Strategy to User Interface to Server 2
Overview Lab49 and Solace Systems Low Latency Trading - Statistical Arbitrage Exchange-Traded Fund (ETF) Single Dealer Platform (SDP) - Foreign Exchange 3
Low Latency Trading 4
Overview - Statistical Arbitrage ETF (Equities) Challenge: To improve scalability and lower latency within the statistical arbitrage ETF space Approach: Leveraging existing software pattern, a User Experience driven process and hardware appliances to deliver a solution to satisfy the business demand Lab49 is the leading provider of innovative Lab49 Innovation On Demand 5
Problem Domain Calculation of the sum of the Exchange-Traded Fund (ETF) parts could show that the ETF is temporarily mispriced. There maybe an opportunity for arbitrage while they re-converge. May not be reproduced by any means without express permission. All rights reserved, 6
Solution Lab49 Statistical Arbitrage Exchange-Traded Fund (ETF) = Solace Systems Messaging Middleware (Hardware) + Microsoft.NET TPL Dataflow Library (Software) 7
Hardware: Appliance Driven Messaging Middleware Hardware Messaging Middleware Offers consistent out-of-the-box experience Options: Guaranteed Messaging, Message Caching, Geospatial Routing Lower deployment costs Unified API Inter-Process Communication (IPC) - shared memory channel Solace Systems: Messaging Made Easy 8
Software: Messaging & Dataflow Patterns We are all trained to think like machines in terms of sequential flow of operation on data, Microsoft.NET tasks are better than Operating System (OS) threads because tasks enable you to think in terms of chunks of work rather than execution flow. Tasks, however, still require coordination of state around shared data tasks/thread complexity increases with size of code base Writing to actor-message or dataflow patterns enable you to design around data flow avoiding shared state Value grows as system size and parallelism scales up Microsoft.NET TPL Dataflow Library 9
Statistical Arbitrage ETF Agent-Actor Architecture OMS... CCY Pair (ETF) CCY Pair Per ETF Per ETF Normal Normal isation Normal Virtual isation isation NormalETF isation Normal isation Normal Real isation isation ETF Normal Real (ETF) isation ETF Trade Arb Signal Trade Signal Virtual ETF Arb ETF Fabric ETF ETF Trade Signals CCY Pair CCY Pair RIA Agent-Actor Architecture leveraging OMS both off-host and shared-memory low latency messaging FX/Equity/ETF Market Data and appropriate static data Normalisaton Virtual ETF Normalisaton Virtual ETF Arbitrag Normalisaton Real ETF Arbitrag Normalisaton Real ETF Trade Signal Trade Signal 10
Demo - The Server 11
Demo - The Client 12
Single Dealer Platform Building Scalable Distributed Systems 13
Overview - Single Dealer Platform Challenge: Reduce the last mile message latency Approach: Moving from, historically, software internet messaging push product solutions to hardware appliances to improve scalability and reduce latency Lab49 is the leading provider of innovative Lab49 Innovation On Demand 14
Problem Domain Wikipedia - A single-dealer platform (SDP) is software used by an investment bank dealing in the capital markets to deliver trading and associated services via the Web. The function of an SDP is to integrate pricing, liquidity, and pre-sales content from multiple sources within a bank and provide access to them via a single user interface. It is thus both an integration platform and a delivery platform. 15
Solution Lab49 Foreign Exchange (FX) Single Dealer Platform (SDP) = Solace Systems Web Streaming (Hardware) + Paremus OSGi Service Fabric and Akka (Software) 16
Hardware: Web Streaming ( Last Mile ) Performance 9,000 client connections and 900,000 messages per second throughput, average latency of 37 microseconds and just 44 microseconds at the 99.9 th percentile Lower deployment costs Unified API Full publisher/subscriber or request/reply messaging semantics Solace Systems Web Messaging May not be reproduced by e=any means without express permission. All rights reserved. 17
Software: Actor Composite Application Paremus Service Fabric Enables composite applications (OSGi, WAR or JEE) to be simply deployed, scaled and managed Utilise available resources dynamically Model-Driven to improve business agility and reduce labor intensive upgrades Robust self healing fabric Low latency DDS based distributed messaging backplane for service monitoring, discovery and configuration Akka (Open Source) Actor framework for Java and Scala Software Transactional Memory Paremus Service Fabric and Akka 18
SDP Architecture Internet HTML5 RIA CCY Pair (ETF) CCY Pair Per ETF Per ETF Normal Normal isation Normal Virtual isation isation NormalETF isation Normal isation Normal Real isation isation ETF Normal Real (ETF) isation ETF Trade Arb Signal Trade Signal Virtual ETF Arb Trade Signals RIA RIA Services Layer Authentication/ Entitlements World s 1 st FX SDP architecture leveraging Solace Systems Web Messaging (for Last Mile ) OMS CCY Pair (ETF) Internal sell-side systems CCY Pair Per ETF Normal Normal isation Normal Virtual isation isation NormalETF isation Normal isation Normal Real isation isation ETF Normal Real (ETF) isation ETF Trade Arb Signal Trade Signal Tick Repository Per ETF FX/Equity/ETF Market Data and appropriate static data Virtual ETF Arb Trade Repository Trade Signals Settlement/ Confirmation Content Repository RIA OMS Streaming Engine Pricing Engine Credit Tiering 19
Demo - Single Dealer Platform (Foreign Exchange) 20
Demo - Price Failover 21