Applications of Dataflow Computing to Finance Florian Widmann
Overview 1. Requirement Shifts in the Financial World 2. Case 1: Real Time Margin 3. Case 2: FX Option Monitor 4. Conclusions
Market Context - Old Complex stochastic models for exotic derivatives Grid based overnight batch jobs Relatively low emphasis on regulatory capital models Little if any risk analysis for algorithmic and HFT trading End-of-day computation for margin, CVA, VaR, etc. Little if any pre-trade risk analysis Business level silos for risk management
Market Context - New Real time pricing and risk analytics Pre-trade risk and margin computation Risk management for algorithmic and HFT trading Cross trading platform multivariate analysis of live tick data Exchange integrity: anomaly detection (e.g. fat finger), market liquidity metrics, execution risk Enhanced price feed with real time Greeks
Compute Requirements Financial analytics at network speed Scale from HFT to Enterprise Risk on same technology Guaranteed performance Ease of integration into existing IT frameworks and analytics libraries Accessible programming model to support in house development (proprietary models) Software development cycles rather than hardware
Maxeler Dataflow Computing Programming of bitstreams via Java based maxj code using Eclipse based IDE Feels like software development Almost no VHDL knowledge required MPC-X invocation via generated shared libraries Conven tional PC Infiniband Stratix V D8 MPC-X DRAM 48GB x 8
Real Time Margin: Background All Interest Rate Swap trades must be centrally cleared at a Clearing House (novation: A B A CH B) CH will charge A and B margin to protect CH against default Margin computed using hvar: reprice swap over 1,500+ historical market scenarios CH must compute margin on client submitted portfolios of 50,000 swaps in 5 seconds
Real Time Margin: Computation Construct Swap PV Vector Load OIS and LIBOR curves for 1,500+ scenarios Generate swap cash flows from swap specification and LIBOR curve Discount cash flows to spot using OIS curve Repeat for all 1,500+ scenarios Compute hvar Add swap PV vector to account PV vector Compute 95% percentile Possibly allocate hvar to sectors / maturities / currencies
Real Time Margin: Data Flow Solution 1 Maths view: swaps are easy Compute science view: swaps are quite tricky Even vanilla swaps have dozens of attributes, e.g.: Several day-count and business day conventions, etc. Payment and compounding frequencies, etc. DFE cannot handle everything directly Our approach: DFE implements interpreter of domain-specific cash flow language CPU translates swap into sequence of cash flow instructions
Real Time Margin: Data Flow Solution 2 Cash flow instructions contain e.g.: Notional, rate, compounding flags, etc. Discounting curve and currency index, etc. Can handle 3-degree polynomial interpolation and log versions, e.g. linear, cubic spline, monotone cubic (actual coefficients are pre-computed on CPU) Catch: calculating instructions (on CPU) takes almost as long as pricing the swap But: each swap is priced in 1500+ scenarios (SIMD)
Real Time Margin: Data Flow Solution 3 CPU: receives swap portfolio and market data CPU: computes cash flow instructions and scenarios CPU: splits computation into batch jobs so that the DFE s input limits are not breached (mostly FMem) DFE: batch scenario data is loaded into FMem DFE: batch cash flow instructions are streamed in and the resulting PVs are returned to the CPU CPU: stitches together the batch results
Real Time Margin: Performance Complete system on middle end PC with 4 DFEs manages ca. 240,000,000 swap pricings per second. Using our software library, one (real) core can price ca. 110,000 swaps per second That is ca. 1,320,000 swaps per second on the PC
Real Time Margin: Demo Video (if possible, else tell a joke)
FX Options Monitor: Background Vanilla FX options: option on currency pair e.g. USD/GBP Black-Scholes price driven by: Spot FX rate: FX rate as of today (fast update) Volatility: market consensus of expected lognormal volatility from spot to option expiry (slow update) Potential for 30+ live currency pairs Black-Scholes formula for European options, BAW approximation for American options (if feasible) Soon: Monte-Carlo for more complex options
Real Time Margin: Background
FX Options Monitor: Problem Given a portfolio of vanilla FX options (200,000) compute for each spot FX tick and each position: Price Delta (1 st derivative w.r.t. spot) Gamma (2 nd derivative w.r.t. spot) Vega (1 st derivative w.r.t. volatility) Theta (1 st derivative w.r.t. time) Up to 80 further derivatives
FX Options Monitor: Architecture Volatility curves (several per currency pair) and yield curves are stored in DRAM and updated every 5 mins Derivatives are computed via finite difference Spot prices are streamed in from CPU Trade data is streamed in from CPU grouped by currency pairs Currency pair volatility curves etc. are read from DRAM into FMem and used for all corresponding trades
FX Option Monitor: Demo Video (if possible, else look awkward)
Conclusions FPGAs and the Maxeler infrastructure on top meet many of the compute requirements Interest from industry but still some hesitation since it is an unknown (to them) technology In house development feasible but consultation time from experts still necessary Have not said anything about low latency