SlideShare a Scribd company logo
STRATA
Open Source Market Risk
STEPHEN COLEBOURNE
• Java Champion, regular conference speaker
• Best known for date & time - Joda-Time and JSR-310
• More Joda projects - http://www.joda.org
• Major contributions in Apache Commons
• Blog - http://blog.joda.org
• Worked at OpenGamma for 6 years
OPENGAMMA
• Founded in 2009
• Financed by Venture Capital
• Mission to bring Open Source values to finance industry
• Focus on Market Risk Analytics, Derivatives and Clearing
• Cloud-based offering coming soon
MARKET RISK
MARKET RISK
• Providing pricing and analytics on a financial portfolio
• “present value (NPV) of an interest rate swap”
• “PV01 of a forward rate agreement (FRA)”
• “vega and gamma of an FX vanilla option”
• “examine the portfolio against a set of scenarios”
COMPONENTS FOR MARKET RISK
• Pricing/Analytic models
• Trade representations - for each supported asset class
• Market data representations - quotes, curves, surfaces, etc.
• Calibration - curves, surfaces, etc.
• Market data management and Scenario creation
• Reference data - holiday calendars, securities
• Basics - schedules, day counts, currencies, etc.
BUILD, BUY OR OPEN SOURCE?
• Build it in-house
• Buy from a vendor
• Open Source
• QuantLib (C++, with exports to other languages)
• Strata (Java/JVM)
STRATA
OVERVIEW
• Open Source - Apache v2 license
• Lightweight, easy-to-use library
• Just jar files - no servers or databases needed
• Released in Maven Central
• Foundation for OpenGamma commercial products
Commons
Trade Model
Market
Data
Pricing &
Analytics
Measures
Data Mgmt
Business day conventions, currencies, day counts, holidays,
identifiers, indices, roll conventions, time-series
Products, trades, securities
Built-in pricers
Sensitivities
Curve framework
Interpolators
Calculation API, scenarios, job execution
Calc functions
Market Data API
Data sourcing
Scenarios
Live data providers
Data sources
Loaders
Source integration
Holiday calendars
Day counts
Currencies
Asset classes
Indices
Pricers
Market data types
Perturbations
Config types
Filters
Measures
Reporting Simple, yet powerful, reporting facilities
Report templates
QUICK START
• Built in examples
• Up and running in minutes
• Hard coded reference data
• Holidays, indices, conventions
• Simple command line reporting
JAVA 8
• Early decision to use Java 8 for Strata
• Features very beneficial for Market Risk Analytics
• Date and Time
• Streams and Lambdas
• Methods on interfaces
• Affects both macro-level design and micro-level code
DEPENDENCIES
• Guava
• Joda-Beans
• Joda-Convert
• SLF4J
• Commons-Math
• Colt
MODULES
• strata-collect - low-level, arrays, time-series, IO, tuples
• strata-basics - holidays, schedules, indices, reference data
• strata-data - market data containers
• strata-market - market data structures - curves, surfaces, etc
• strata-product - trades, products, securities
• strata-loader - data loaders from csv and xml
• strata-pricer - analytic pricers
• strata-calc - calculation engine, scenarios, market data building
• strata-measure - high-level measures, potentially multi-scenario
TRADES
TRADES
• Trades are simple immutable beans (data objects)
• Built using Joda-Beans
• Use builder or static factory to create
• Real properties and methods with Javadoc
JODA-BEANS
• Source code generator/regenerator
• Just write the fields and add a couple of annotations
• Joda-Beans generates additional high-quality source code
• Mutable and immutable beans
• Provides C# style properties
• Easy and fast serialization to XML, JSON, Binary
JODA-BEANS
@BeanDefinition
public final class Person implements ImmutableBean {
@PropertyDefinition(validate = “notNull”)
private final String forename;
@PropertyDefinition(validate = “notNull”)
private final String surname;
// autogenerated getters, equals, hashCode,
// toString, builder, metabean
}
TRADES AND PRODUCTS
• Trade
• Trade date
• Trade identifier
• Counterparty
• Product
• Financial details of the trade
• Effective/Termination date, notional, rate, index, etc.
TRADES AND PRODUCTS
Trade
ProductProductTrade
FraTrade Fra
FRA
// create Fra using builder
Fra fra = Fra.builder()
.buySell(BuySell.BUY) // Buy
.index(IborIndices.GBP_LIBOR_3M) // GBP LIBOR 3M
.notional(10_000_000) // 10 million GBP
.fixedRate(0.0085) // 0.85%
.startDate(LocalDate.of(2016, 9, 14))
.endDate(LocalDate.of(2016, 12, 14))
.build();
FRA
// create FraTrade
Fra fra = ...
TradeInfo info = TradeInfo.builder()
.tradeDate(LocalDate.of(2016, 6, 14))
.id(StandardId.of(“Trade”, “123456”))
.counterparty(StandardId.of(“Party”, “654321”))
.build();
FraTrade trade = FraTrade.of(info, fra);
CONVENTIONS
• Most OTC trades follow market conventions
• Strata includes definitions of some of these conventions
• Avoids repetitive code
FRA CONVENTION
// create FRA from a convention
FraTrade trade =
FraConvention.of(IborIndices.GBP_LIBOR_3M)
.createTrade(
LocalDate.of(2015, 7, 14), // Trade date
Period.ofMonths(2), // start in 2 months
BuySell.BUY, // Buy
10_000_000, // 10 million GBP
0.012, // 1.2%
ReferenceData.standard()); // Holiday calendars
NOTES
• Built in conventions for FRAs
• Built in conventions for 18 ibor-like indices, such as GBP LIBOR
• Built in conventions for 12 overnight indices, such as GBP SONIA
• Built in conventions for currencies
• Built in holiday calendar data, suitable for evaluation
SWAP
• Flexible interest rate swap
• Fixed legs support variable interest rates and known amounts
• Float legs support Ibor, Overnight and Inflation
• Stubs support fixed, floating, interpolated and known amount
• Support for variable notional, gearing and spread
• Conventions and Templates available
SWAP
Trade
ProductProductTrade
SwapTrade Swap
RateCalculation
SwapLeg
RateCalculation
SwapLeg
Swap PeriodicSchedule
NotionalSchedule
PaymentSchedule
Ibor
RateCalculation
Fixed
RateCalculation
Inflation
RateCalculation
Overnight
RateCalculation
SWAP
// create swap from a convention
SwapTrade trade =
FixedIborSwapConventions.GBP_FIXED_1Y_LIBOR_3M
.createTrade(
LocalDate.of(2015, 7, 14), // Trade date
Tenor.TENOR_10Y, // 10 year swap
BuySell.BUY, // Buy
10_000_000, // 10 million GBP
0.014, // 1.4%
ReferenceData.standard()); // Holiday calendars
SECURITIES
• Two approaches supported
• Define security as and when needed
• Setup reference data map of securities
• Provides ability to use, or avoid, a big security master
SECURITIES AS PRODUCTS
IborFutureOption
Trade
IborFutureOption IborFuture
Trade
ProductProductTrade
SECURITIES AS REFERENCE DATA
Trade
IborFutureOption IborFuture
Security
IborFutureOption
Security
IborFuture
Security
SecurityTrade
ReferenceData used to
lookup SecurityId
ReferenceData used to convert
Security to Product
ASSET CLASSES
• Swaps, Swaptions, DSF, CMS, Cap/Floor
• FRA, STIR futures, STIR future options
• Bond, Bond futures, Bond future options
• FX forward, NDF, FX swap, vanilla option, single barrier option
• CDS
• Term deposit, Bullet payment
• Generic security, ETD future, ETD option
• Additional asset classes may be for commercial customers only
PRICERS
PRICERS
• Lower-level analytics API
• Provides ability to calculate PV, sensitivities, greeks, etc.
• Explain facility to understand how result was calculated
• Operates on resolved trades/products
RESOLVING
• Resolving the trade requires reference data
• Locks in dates to the current holiday calendar rules
• Standard reference data contains hard coded holiday rules
// resolve a swap
SwapTrade trade = …
ReferenceData refData = ReferenceData.standard();
ResolvedSwapTrade resolved = trade.resolve(refData);
RESOLVING
Swap SwapLegSwapTrade
Trade resolved using
ReferenceData
Resolved
SwapTrade
Resolved
Swap
Resolved
SwapLeg
Resolved leg contains full list
of accrual/payment periods,
stubs and notional exchange
USING A PRICER
• Stateless - takes resolved trade and any necessary market data
• Calculates for one trade and one set of market data
• Can usually price at trade or product level
USING A PRICER
// obtain the swap and market data to price against
ResolvedSwapTrade trade = ...
RatesProvider market = ...
// calculate the present value
MultiCurrencyAmount pv =
DiscountingSwapTradePricer.DEFAULT
.presentValue(trade, market);
MARKET DATA
MARKET DATA
• Support for all kinds of market data
• Built in classes for FX, quotes, curves, surfaces, etc.
• Many types can be loaded from CSV
• Multi-curve rates calibration
• Scenarios, stored efficiently as arrays
RATES PROVIDER
• RatesProvider is a single, coherent, set of market data
• FX rates, Discount factors, Ibor rates
• Overnight rates, Inflation price indices, Historic fixings
// get discount factors for GBP
DiscountFactors df = ratesProvider.discountFactors(GBP);
double factor = df.discountFactor(date);
MARKET DATA
• MarketData is a container of market data
• Hash-map like
• Keys are MarketDataId<T>
// get curve by identifier
CurveId id = CurveId.of(“Default”, “USD-DSC”);
Curve curve = marketData.getValue(id);
SCENARIO MARKET DATA
• ScenarioMarketData is a container of scenario data
• Hash-map like, where values are arrays
• Keys are MarketDataId<T>
// get curves by identifier
CurveId id = CurveId.of(“Default”, “USD-DSC”);
MarketDataBox<Curve> curves = scenarioData.getValue(id);
// process using a stream (for example)
curves.stream().forEach( curve -> … );
MARKET DATA LOOKUP
• Market data containers hold arbitrary sets of market data
• May hold multiple USD discounting curves
• RatesMarketDataLookup is used to select a coherent set
CurveId usdDscId = CurveId.of(“Default”, “USD-DSC”);
CurveId usdLiborId = CurveId.of(“Default”, “USD-LIBOR”);
// map currency/index to curve
RatesMarketDataLookup md = RatesMarketDataLookup.of(
ImmutableMap.of(Currency.USD, usdDscId),
ImmutableMap.of(
IborIndices.USD_LIBOR_3M, usdLiborId),
IborIndices.USD_LIBOR_6M, usdLiborId));
COMBINATIONS
MarketData RatesProviderRatesMarketDataLookup+ =
• Many curves
• Keyed by curve ID
• Map currency to curve ID
• Map index to curve ID
• DF by currency+date
• Rate by index+date
MARKET DATA BUILDING
• Can create market data manually, loading from CSV or by factory
• MarketDataFactory can
• Query quotes from a simple provider interface
• Query time-series from a simple provider interface
• Calibrate
• Create scenarios by shifting/bumping
• See SwapPricingWithCalibrationExample
MEASURES
MEASURE-LEVEL API
• Higher-level than pricers
• Stateless - takes resolved trade and any necessary market data
• Calculates for one trade and one or more sets of market data
• ie. supports scenarios
• Only operates on trades, not products
• Scaled output
• eg. PV01 in basis points
USING THE MEASURE-LEVEL API
// obtain the swap and market data to price against
ResolvedSwapTrade trade = ...
RatesProvider market = ...
// calculate the present value
MultiCurrencyAmount pv =
SwapTradeCalculations.DEFAULT
.presentValue(trade, market);
USING THE MEASURE-LEVEL API
// obtain the swap and market data to price against
ResolvedSwapTrade trade = ...
RatesMarketDataLookup lookup = ...
ScenarioMarketData market = ...
// calculate the present value for many scenarios
MultiCurrencyScenarioArray scenarioPv =
SwapTradeCalculations.DEFAULT
.presentValue(trade, lookup, market);
CALCULATIONS
CALCULATION-LEVEL API
• Highest-level API
• Calculates for many trades and one or more sets of market data
• ie. supports scenarios
• Optional currency conversion
• Multi-threaded
• Results can be received asynchronously
CALCULATION-LEVEL API
• Calculation API result is a grid
• Rows are trades, positions, or similar
• Columns are measures, such as PV, PV01, Par rate
• Mixed portfolio of trades (PV for Swap, FRA and future in one call)
NPV (USD) NPV (GBP) PV01 (USD) Par rate
Trade 1 - Swap 13,487.25 10,176.72 12.7365 0.23
Trade 2 - Swap -34,276.73 -27,273.28 76.2725 0.24
Trade 3 - FRA 12,835.26 9,263.75 -26.8367 0.31
Trade 4 - STIR -965.76 -754.23 1.2676 0.52
CALCULATIONS
• CalculationRunner is entry to Calculation API
• Provides a multi-threaded executor
• Also allow callers to use their own executor
// obtains a multithreaded runner
try (CalculationRunner runner =
CalculationRunner.ofMultiThreaded()) {
// use the runner
}
RULES
• CalculationRules defines how to calculate
• Functions mapping from trade type to code
• Reporting currency
• Market data lookup
// setup the rules
CalculationRules rules = CalculationRules.of(
StandardComponents.calculationFunctions(),
Currency.USD,
ratesMarketDataLookup);
CALCULATIONS
• Each column defined by Column
• Measure specifies what to calculate
• Can control reporting currency per column
// specify the columns
List<Column> columns = ImmutableList.of(
Column.of(Measure.PRESENT_VALUE),
Column.of(Measure.PRESENT_VALUE, Currency.GBP),
Column.of(Measure.PV01_CALIBRATED_SUM),
Column.of(Measure.PAR_RATE));
CALCULATIONS
• Calculation runner is stateless
• Pass in all inputs, get back results
• Separate API allows results to be received asynchronously
// calculate the results
Results results = runner.calculate(
rules, // How to calculate
trades, // Trades to process
columns, // Columns, eg PV, PV01, par rate
marketData, // Market data
referenceData); // Reference data
CALCULATION-LEVEL API
NPV (USD) NPV (GBP) PV01 (USD) Par rate
Trade 1 - Swap 13,487.25 10,176.72 12.7365 0.23
Trade 2 - Swap -34,276.73 -27,273.28 76.2725 0.24
Trade 3 - FRA 12,835.26 9,263.75 -26.8367 0.31
Trade 4 - STIR -965.76 -754.23 1.2676 0.52
... ... ... ... ...
SUMMARY
STRATA v1.2
• Trades are immutable beans
• Pricing/risk logic is stateless, and separate from the trades
• Three levels of pricing/risk API
• Pricer - one trade, one set of market data
• Measure - one trade, one or many sets of market data
• Calc - many trades, one or many sets of market data
STRATA v1.2
• Modern market risk library in Java 8
• Lightweight and easy-to-use, lots of examples
• Good asset class coverage, lots of built-in conventions
• Open source, Apache v2 license
• Foundation of commercial products
• cloud-based calculations for derivatives trading
• Commercial support available from OpenGamma
http://strata.opengamma.io/
THANK YOU

More Related Content

Similar to Strata, Open Source Market Risk

#GeodeSummit - Wall St. Derivative Risk Solutions Using Geode
#GeodeSummit - Wall St. Derivative Risk Solutions Using Geode#GeodeSummit - Wall St. Derivative Risk Solutions Using Geode
#GeodeSummit - Wall St. Derivative Risk Solutions Using Geode
PivotalOpenSourceHub
 
Wall Street Derivative Risk Solutions Using Apache Geode
Wall Street Derivative Risk Solutions Using Apache GeodeWall Street Derivative Risk Solutions Using Apache Geode
Wall Street Derivative Risk Solutions Using Apache Geode
Andre Langevin
 
Wall Street Derivative Risk Solutions Using Geode
Wall Street Derivative Risk Solutions Using GeodeWall Street Derivative Risk Solutions Using Geode
Wall Street Derivative Risk Solutions Using Geode
VMware Tanzu
 
WSO2 Analytics Platform: The one stop shop for all your data needs
WSO2 Analytics Platform: The one stop shop for all your data needsWSO2 Analytics Platform: The one stop shop for all your data needs
WSO2 Analytics Platform: The one stop shop for all your data needs
Sriskandarajah Suhothayan
 
Abc financial analyticsdemo
Abc financial analyticsdemoAbc financial analyticsdemo
Abc financial analyticsdemo
Guan Khoo
 
WSO2Con USA 2017: Analytics Patterns for Your Digital Enterprise
WSO2Con USA 2017: Analytics Patterns for Your Digital EnterpriseWSO2Con USA 2017: Analytics Patterns for Your Digital Enterprise
WSO2Con USA 2017: Analytics Patterns for Your Digital Enterprise
WSO2
 
Analytics Patterns for Your Digital Enterprise
Analytics Patterns for Your Digital EnterpriseAnalytics Patterns for Your Digital Enterprise
Analytics Patterns for Your Digital Enterprise
Sriskandarajah Suhothayan
 
Are You Trading Stocks Securely? Exposing Security Flaws in Trading Technologies
Are You Trading Stocks Securely? Exposing Security Flaws in Trading TechnologiesAre You Trading Stocks Securely? Exposing Security Flaws in Trading Technologies
Are You Trading Stocks Securely? Exposing Security Flaws in Trading Technologies
Alejandro Hernández
 
[WSO2Con USA 2018] Patterns for Building Streaming Apps
[WSO2Con USA 2018] Patterns for Building Streaming Apps[WSO2Con USA 2018] Patterns for Building Streaming Apps
[WSO2Con USA 2018] Patterns for Building Streaming Apps
WSO2
 
Building A Feature Factory
Building A Feature FactoryBuilding A Feature Factory
Building A Feature Factory
Databricks
 
Quantlogic Product &amp; Services Offerring
Quantlogic Product &amp; Services OfferringQuantlogic Product &amp; Services Offerring
Quantlogic Product &amp; Services Offerringnscarr
 
Juanjo Hierro_FIWARE Marketplace and Data Publication features.pptx
Juanjo Hierro_FIWARE Marketplace and Data Publication features.pptxJuanjo Hierro_FIWARE Marketplace and Data Publication features.pptx
Juanjo Hierro_FIWARE Marketplace and Data Publication features.pptx
FIWARE
 
WSO2Con USA 2015: WSO2 Analytics Platform - The One Stop Shop for All Your Da...
WSO2Con USA 2015: WSO2 Analytics Platform - The One Stop Shop for All Your Da...WSO2Con USA 2015: WSO2 Analytics Platform - The One Stop Shop for All Your Da...
WSO2Con USA 2015: WSO2 Analytics Platform - The One Stop Shop for All Your Da...
WSO2
 
Real Time Business Intelligence with Cassandra, Kafka and Hadoop - A Real Sto...
Real Time Business Intelligence with Cassandra, Kafka and Hadoop - A Real Sto...Real Time Business Intelligence with Cassandra, Kafka and Hadoop - A Real Sto...
Real Time Business Intelligence with Cassandra, Kafka and Hadoop - A Real Sto...
DataStax
 
Search Analytics Component: Presented by Steven Bower, Bloomberg L.P.
Search Analytics Component: Presented by Steven Bower, Bloomberg L.P.Search Analytics Component: Presented by Steven Bower, Bloomberg L.P.
Search Analytics Component: Presented by Steven Bower, Bloomberg L.P.
Lucidworks
 
Reigning in Protobuf with David Navalho and Graham Stirling | Kafka Summit Lo...
Reigning in Protobuf with David Navalho and Graham Stirling | Kafka Summit Lo...Reigning in Protobuf with David Navalho and Graham Stirling | Kafka Summit Lo...
Reigning in Protobuf with David Navalho and Graham Stirling | Kafka Summit Lo...
HostedbyConfluent
 
WSO2 Analytics Platform - The one stop shop for all your data needs
WSO2 Analytics Platform - The one stop shop for all your data needsWSO2 Analytics Platform - The one stop shop for all your data needs
WSO2 Analytics Platform - The one stop shop for all your data needs
Sriskandarajah Suhothayan
 
Patterns for Building Streaming Apps
Patterns for Building Streaming AppsPatterns for Building Streaming Apps
Patterns for Building Streaming Apps
Mohanadarshan Vivekanandalingam
 
Why You Should NOT Be Using an RDBMS for Time-stamped Data
Why You Should NOT Be Using an RDBMS for Time-stamped DataWhy You Should NOT Be Using an RDBMS for Time-stamped Data
Why You Should NOT Be Using an RDBMS for Time-stamped Data
DevOps.com
 

Similar to Strata, Open Source Market Risk (20)

#GeodeSummit - Wall St. Derivative Risk Solutions Using Geode
#GeodeSummit - Wall St. Derivative Risk Solutions Using Geode#GeodeSummit - Wall St. Derivative Risk Solutions Using Geode
#GeodeSummit - Wall St. Derivative Risk Solutions Using Geode
 
Wall Street Derivative Risk Solutions Using Apache Geode
Wall Street Derivative Risk Solutions Using Apache GeodeWall Street Derivative Risk Solutions Using Apache Geode
Wall Street Derivative Risk Solutions Using Apache Geode
 
Wall Street Derivative Risk Solutions Using Geode
Wall Street Derivative Risk Solutions Using GeodeWall Street Derivative Risk Solutions Using Geode
Wall Street Derivative Risk Solutions Using Geode
 
WSO2 Analytics Platform: The one stop shop for all your data needs
WSO2 Analytics Platform: The one stop shop for all your data needsWSO2 Analytics Platform: The one stop shop for all your data needs
WSO2 Analytics Platform: The one stop shop for all your data needs
 
Abc financial analyticsdemo
Abc financial analyticsdemoAbc financial analyticsdemo
Abc financial analyticsdemo
 
WSO2Con USA 2017: Analytics Patterns for Your Digital Enterprise
WSO2Con USA 2017: Analytics Patterns for Your Digital EnterpriseWSO2Con USA 2017: Analytics Patterns for Your Digital Enterprise
WSO2Con USA 2017: Analytics Patterns for Your Digital Enterprise
 
Analytics Patterns for Your Digital Enterprise
Analytics Patterns for Your Digital EnterpriseAnalytics Patterns for Your Digital Enterprise
Analytics Patterns for Your Digital Enterprise
 
Are You Trading Stocks Securely? Exposing Security Flaws in Trading Technologies
Are You Trading Stocks Securely? Exposing Security Flaws in Trading TechnologiesAre You Trading Stocks Securely? Exposing Security Flaws in Trading Technologies
Are You Trading Stocks Securely? Exposing Security Flaws in Trading Technologies
 
[WSO2Con USA 2018] Patterns for Building Streaming Apps
[WSO2Con USA 2018] Patterns for Building Streaming Apps[WSO2Con USA 2018] Patterns for Building Streaming Apps
[WSO2Con USA 2018] Patterns for Building Streaming Apps
 
Building A Feature Factory
Building A Feature FactoryBuilding A Feature Factory
Building A Feature Factory
 
Quantlogic Product &amp; Services Offerring
Quantlogic Product &amp; Services OfferringQuantlogic Product &amp; Services Offerring
Quantlogic Product &amp; Services Offerring
 
Juanjo Hierro_FIWARE Marketplace and Data Publication features.pptx
Juanjo Hierro_FIWARE Marketplace and Data Publication features.pptxJuanjo Hierro_FIWARE Marketplace and Data Publication features.pptx
Juanjo Hierro_FIWARE Marketplace and Data Publication features.pptx
 
Ucits
UcitsUcits
Ucits
 
WSO2Con USA 2015: WSO2 Analytics Platform - The One Stop Shop for All Your Da...
WSO2Con USA 2015: WSO2 Analytics Platform - The One Stop Shop for All Your Da...WSO2Con USA 2015: WSO2 Analytics Platform - The One Stop Shop for All Your Da...
WSO2Con USA 2015: WSO2 Analytics Platform - The One Stop Shop for All Your Da...
 
Real Time Business Intelligence with Cassandra, Kafka and Hadoop - A Real Sto...
Real Time Business Intelligence with Cassandra, Kafka and Hadoop - A Real Sto...Real Time Business Intelligence with Cassandra, Kafka and Hadoop - A Real Sto...
Real Time Business Intelligence with Cassandra, Kafka and Hadoop - A Real Sto...
 
Search Analytics Component: Presented by Steven Bower, Bloomberg L.P.
Search Analytics Component: Presented by Steven Bower, Bloomberg L.P.Search Analytics Component: Presented by Steven Bower, Bloomberg L.P.
Search Analytics Component: Presented by Steven Bower, Bloomberg L.P.
 
Reigning in Protobuf with David Navalho and Graham Stirling | Kafka Summit Lo...
Reigning in Protobuf with David Navalho and Graham Stirling | Kafka Summit Lo...Reigning in Protobuf with David Navalho and Graham Stirling | Kafka Summit Lo...
Reigning in Protobuf with David Navalho and Graham Stirling | Kafka Summit Lo...
 
WSO2 Analytics Platform - The one stop shop for all your data needs
WSO2 Analytics Platform - The one stop shop for all your data needsWSO2 Analytics Platform - The one stop shop for all your data needs
WSO2 Analytics Platform - The one stop shop for all your data needs
 
Patterns for Building Streaming Apps
Patterns for Building Streaming AppsPatterns for Building Streaming Apps
Patterns for Building Streaming Apps
 
Why You Should NOT Be Using an RDBMS for Time-stamped Data
Why You Should NOT Be Using an RDBMS for Time-stamped DataWhy You Should NOT Be Using an RDBMS for Time-stamped Data
Why You Should NOT Be Using an RDBMS for Time-stamped Data
 

More from Stephen Colebourne

Java SE 9 modules - an introduction (July 2018)
Java SE 9 modules - an introduction (July 2018)Java SE 9 modules - an introduction (July 2018)
Java SE 9 modules - an introduction (July 2018)
Stephen Colebourne
 
Amber and beyond: Java language changes
Amber and beyond: Java language changesAmber and beyond: Java language changes
Amber and beyond: Java language changes
Stephen Colebourne
 
Java SE 9 modules (JPMS) - an introduction
Java SE 9 modules (JPMS) - an introductionJava SE 9 modules (JPMS) - an introduction
Java SE 9 modules (JPMS) - an introduction
Stephen Colebourne
 
Java SE 8 library design
Java SE 8 library designJava SE 8 library design
Java SE 8 library design
Stephen Colebourne
 
Code generating beans in Java
Code generating beans in JavaCode generating beans in Java
Code generating beans in Java
Stephen Colebourne
 
Java SE 8 best practices
Java SE 8 best practicesJava SE 8 best practices
Java SE 8 best practices
Stephen Colebourne
 

More from Stephen Colebourne (6)

Java SE 9 modules - an introduction (July 2018)
Java SE 9 modules - an introduction (July 2018)Java SE 9 modules - an introduction (July 2018)
Java SE 9 modules - an introduction (July 2018)
 
Amber and beyond: Java language changes
Amber and beyond: Java language changesAmber and beyond: Java language changes
Amber and beyond: Java language changes
 
Java SE 9 modules (JPMS) - an introduction
Java SE 9 modules (JPMS) - an introductionJava SE 9 modules (JPMS) - an introduction
Java SE 9 modules (JPMS) - an introduction
 
Java SE 8 library design
Java SE 8 library designJava SE 8 library design
Java SE 8 library design
 
Code generating beans in Java
Code generating beans in JavaCode generating beans in Java
Code generating beans in Java
 
Java SE 8 best practices
Java SE 8 best practicesJava SE 8 best practices
Java SE 8 best practices
 

Recently uploaded

AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)
abdulrafaychaudhry
 
Pro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp BookPro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp Book
abdulrafaychaudhry
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
Hornet Dynamics
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 
Game Development with Unity3D (Game Development lecture 3)
Game Development  with Unity3D (Game Development lecture 3)Game Development  with Unity3D (Game Development lecture 3)
Game Development with Unity3D (Game Development lecture 3)
abdulrafaychaudhry
 
Nidhi Software Price. Fact , Costs, Tips
Nidhi Software Price. Fact , Costs, TipsNidhi Software Price. Fact , Costs, Tips
Nidhi Software Price. Fact , Costs, Tips
vrstrong314
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
Shane Coughlan
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
Boni García
 

Recently uploaded (20)

AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)Introduction to Pygame (Lecture 7 Python Game Development)
Introduction to Pygame (Lecture 7 Python Game Development)
 
Pro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp BookPro Unity Game Development with C-sharp Book
Pro Unity Game Development with C-sharp Book
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 
Game Development with Unity3D (Game Development lecture 3)
Game Development  with Unity3D (Game Development lecture 3)Game Development  with Unity3D (Game Development lecture 3)
Game Development with Unity3D (Game Development lecture 3)
 
Nidhi Software Price. Fact , Costs, Tips
Nidhi Software Price. Fact , Costs, TipsNidhi Software Price. Fact , Costs, Tips
Nidhi Software Price. Fact , Costs, Tips
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
 

Strata, Open Source Market Risk

  • 2. STEPHEN COLEBOURNE • Java Champion, regular conference speaker • Best known for date & time - Joda-Time and JSR-310 • More Joda projects - http://www.joda.org • Major contributions in Apache Commons • Blog - http://blog.joda.org • Worked at OpenGamma for 6 years
  • 3. OPENGAMMA • Founded in 2009 • Financed by Venture Capital • Mission to bring Open Source values to finance industry • Focus on Market Risk Analytics, Derivatives and Clearing • Cloud-based offering coming soon
  • 5. MARKET RISK • Providing pricing and analytics on a financial portfolio • “present value (NPV) of an interest rate swap” • “PV01 of a forward rate agreement (FRA)” • “vega and gamma of an FX vanilla option” • “examine the portfolio against a set of scenarios”
  • 6. COMPONENTS FOR MARKET RISK • Pricing/Analytic models • Trade representations - for each supported asset class • Market data representations - quotes, curves, surfaces, etc. • Calibration - curves, surfaces, etc. • Market data management and Scenario creation • Reference data - holiday calendars, securities • Basics - schedules, day counts, currencies, etc.
  • 7. BUILD, BUY OR OPEN SOURCE? • Build it in-house • Buy from a vendor • Open Source • QuantLib (C++, with exports to other languages) • Strata (Java/JVM)
  • 9. OVERVIEW • Open Source - Apache v2 license • Lightweight, easy-to-use library • Just jar files - no servers or databases needed • Released in Maven Central • Foundation for OpenGamma commercial products
  • 10. Commons Trade Model Market Data Pricing & Analytics Measures Data Mgmt Business day conventions, currencies, day counts, holidays, identifiers, indices, roll conventions, time-series Products, trades, securities Built-in pricers Sensitivities Curve framework Interpolators Calculation API, scenarios, job execution Calc functions Market Data API Data sourcing Scenarios Live data providers Data sources Loaders Source integration Holiday calendars Day counts Currencies Asset classes Indices Pricers Market data types Perturbations Config types Filters Measures Reporting Simple, yet powerful, reporting facilities Report templates
  • 11. QUICK START • Built in examples • Up and running in minutes • Hard coded reference data • Holidays, indices, conventions • Simple command line reporting
  • 12.
  • 13. JAVA 8 • Early decision to use Java 8 for Strata • Features very beneficial for Market Risk Analytics • Date and Time • Streams and Lambdas • Methods on interfaces • Affects both macro-level design and micro-level code
  • 14. DEPENDENCIES • Guava • Joda-Beans • Joda-Convert • SLF4J • Commons-Math • Colt
  • 15. MODULES • strata-collect - low-level, arrays, time-series, IO, tuples • strata-basics - holidays, schedules, indices, reference data • strata-data - market data containers • strata-market - market data structures - curves, surfaces, etc • strata-product - trades, products, securities • strata-loader - data loaders from csv and xml • strata-pricer - analytic pricers • strata-calc - calculation engine, scenarios, market data building • strata-measure - high-level measures, potentially multi-scenario
  • 17. TRADES • Trades are simple immutable beans (data objects) • Built using Joda-Beans • Use builder or static factory to create • Real properties and methods with Javadoc
  • 18. JODA-BEANS • Source code generator/regenerator • Just write the fields and add a couple of annotations • Joda-Beans generates additional high-quality source code • Mutable and immutable beans • Provides C# style properties • Easy and fast serialization to XML, JSON, Binary
  • 19. JODA-BEANS @BeanDefinition public final class Person implements ImmutableBean { @PropertyDefinition(validate = “notNull”) private final String forename; @PropertyDefinition(validate = “notNull”) private final String surname; // autogenerated getters, equals, hashCode, // toString, builder, metabean }
  • 20. TRADES AND PRODUCTS • Trade • Trade date • Trade identifier • Counterparty • Product • Financial details of the trade • Effective/Termination date, notional, rate, index, etc.
  • 22. FRA // create Fra using builder Fra fra = Fra.builder() .buySell(BuySell.BUY) // Buy .index(IborIndices.GBP_LIBOR_3M) // GBP LIBOR 3M .notional(10_000_000) // 10 million GBP .fixedRate(0.0085) // 0.85% .startDate(LocalDate.of(2016, 9, 14)) .endDate(LocalDate.of(2016, 12, 14)) .build();
  • 23. FRA // create FraTrade Fra fra = ... TradeInfo info = TradeInfo.builder() .tradeDate(LocalDate.of(2016, 6, 14)) .id(StandardId.of(“Trade”, “123456”)) .counterparty(StandardId.of(“Party”, “654321”)) .build(); FraTrade trade = FraTrade.of(info, fra);
  • 24. CONVENTIONS • Most OTC trades follow market conventions • Strata includes definitions of some of these conventions • Avoids repetitive code
  • 25. FRA CONVENTION // create FRA from a convention FraTrade trade = FraConvention.of(IborIndices.GBP_LIBOR_3M) .createTrade( LocalDate.of(2015, 7, 14), // Trade date Period.ofMonths(2), // start in 2 months BuySell.BUY, // Buy 10_000_000, // 10 million GBP 0.012, // 1.2% ReferenceData.standard()); // Holiday calendars
  • 26. NOTES • Built in conventions for FRAs • Built in conventions for 18 ibor-like indices, such as GBP LIBOR • Built in conventions for 12 overnight indices, such as GBP SONIA • Built in conventions for currencies • Built in holiday calendar data, suitable for evaluation
  • 27. SWAP • Flexible interest rate swap • Fixed legs support variable interest rates and known amounts • Float legs support Ibor, Overnight and Inflation • Stubs support fixed, floating, interpolated and known amount • Support for variable notional, gearing and spread • Conventions and Templates available
  • 30. SWAP // create swap from a convention SwapTrade trade = FixedIborSwapConventions.GBP_FIXED_1Y_LIBOR_3M .createTrade( LocalDate.of(2015, 7, 14), // Trade date Tenor.TENOR_10Y, // 10 year swap BuySell.BUY, // Buy 10_000_000, // 10 million GBP 0.014, // 1.4% ReferenceData.standard()); // Holiday calendars
  • 31. SECURITIES • Two approaches supported • Define security as and when needed • Setup reference data map of securities • Provides ability to use, or avoid, a big security master
  • 33. SECURITIES AS REFERENCE DATA Trade IborFutureOption IborFuture Security IborFutureOption Security IborFuture Security SecurityTrade ReferenceData used to lookup SecurityId ReferenceData used to convert Security to Product
  • 34. ASSET CLASSES • Swaps, Swaptions, DSF, CMS, Cap/Floor • FRA, STIR futures, STIR future options • Bond, Bond futures, Bond future options • FX forward, NDF, FX swap, vanilla option, single barrier option • CDS • Term deposit, Bullet payment • Generic security, ETD future, ETD option • Additional asset classes may be for commercial customers only
  • 36. PRICERS • Lower-level analytics API • Provides ability to calculate PV, sensitivities, greeks, etc. • Explain facility to understand how result was calculated • Operates on resolved trades/products
  • 37. RESOLVING • Resolving the trade requires reference data • Locks in dates to the current holiday calendar rules • Standard reference data contains hard coded holiday rules // resolve a swap SwapTrade trade = … ReferenceData refData = ReferenceData.standard(); ResolvedSwapTrade resolved = trade.resolve(refData);
  • 38. RESOLVING Swap SwapLegSwapTrade Trade resolved using ReferenceData Resolved SwapTrade Resolved Swap Resolved SwapLeg Resolved leg contains full list of accrual/payment periods, stubs and notional exchange
  • 39. USING A PRICER • Stateless - takes resolved trade and any necessary market data • Calculates for one trade and one set of market data • Can usually price at trade or product level
  • 40. USING A PRICER // obtain the swap and market data to price against ResolvedSwapTrade trade = ... RatesProvider market = ... // calculate the present value MultiCurrencyAmount pv = DiscountingSwapTradePricer.DEFAULT .presentValue(trade, market);
  • 42. MARKET DATA • Support for all kinds of market data • Built in classes for FX, quotes, curves, surfaces, etc. • Many types can be loaded from CSV • Multi-curve rates calibration • Scenarios, stored efficiently as arrays
  • 43. RATES PROVIDER • RatesProvider is a single, coherent, set of market data • FX rates, Discount factors, Ibor rates • Overnight rates, Inflation price indices, Historic fixings // get discount factors for GBP DiscountFactors df = ratesProvider.discountFactors(GBP); double factor = df.discountFactor(date);
  • 44. MARKET DATA • MarketData is a container of market data • Hash-map like • Keys are MarketDataId<T> // get curve by identifier CurveId id = CurveId.of(“Default”, “USD-DSC”); Curve curve = marketData.getValue(id);
  • 45. SCENARIO MARKET DATA • ScenarioMarketData is a container of scenario data • Hash-map like, where values are arrays • Keys are MarketDataId<T> // get curves by identifier CurveId id = CurveId.of(“Default”, “USD-DSC”); MarketDataBox<Curve> curves = scenarioData.getValue(id); // process using a stream (for example) curves.stream().forEach( curve -> … );
  • 46. MARKET DATA LOOKUP • Market data containers hold arbitrary sets of market data • May hold multiple USD discounting curves • RatesMarketDataLookup is used to select a coherent set CurveId usdDscId = CurveId.of(“Default”, “USD-DSC”); CurveId usdLiborId = CurveId.of(“Default”, “USD-LIBOR”); // map currency/index to curve RatesMarketDataLookup md = RatesMarketDataLookup.of( ImmutableMap.of(Currency.USD, usdDscId), ImmutableMap.of( IborIndices.USD_LIBOR_3M, usdLiborId), IborIndices.USD_LIBOR_6M, usdLiborId));
  • 47. COMBINATIONS MarketData RatesProviderRatesMarketDataLookup+ = • Many curves • Keyed by curve ID • Map currency to curve ID • Map index to curve ID • DF by currency+date • Rate by index+date
  • 48. MARKET DATA BUILDING • Can create market data manually, loading from CSV or by factory • MarketDataFactory can • Query quotes from a simple provider interface • Query time-series from a simple provider interface • Calibrate • Create scenarios by shifting/bumping • See SwapPricingWithCalibrationExample
  • 50. MEASURE-LEVEL API • Higher-level than pricers • Stateless - takes resolved trade and any necessary market data • Calculates for one trade and one or more sets of market data • ie. supports scenarios • Only operates on trades, not products • Scaled output • eg. PV01 in basis points
  • 51. USING THE MEASURE-LEVEL API // obtain the swap and market data to price against ResolvedSwapTrade trade = ... RatesProvider market = ... // calculate the present value MultiCurrencyAmount pv = SwapTradeCalculations.DEFAULT .presentValue(trade, market);
  • 52. USING THE MEASURE-LEVEL API // obtain the swap and market data to price against ResolvedSwapTrade trade = ... RatesMarketDataLookup lookup = ... ScenarioMarketData market = ... // calculate the present value for many scenarios MultiCurrencyScenarioArray scenarioPv = SwapTradeCalculations.DEFAULT .presentValue(trade, lookup, market);
  • 54. CALCULATION-LEVEL API • Highest-level API • Calculates for many trades and one or more sets of market data • ie. supports scenarios • Optional currency conversion • Multi-threaded • Results can be received asynchronously
  • 55. CALCULATION-LEVEL API • Calculation API result is a grid • Rows are trades, positions, or similar • Columns are measures, such as PV, PV01, Par rate • Mixed portfolio of trades (PV for Swap, FRA and future in one call) NPV (USD) NPV (GBP) PV01 (USD) Par rate Trade 1 - Swap 13,487.25 10,176.72 12.7365 0.23 Trade 2 - Swap -34,276.73 -27,273.28 76.2725 0.24 Trade 3 - FRA 12,835.26 9,263.75 -26.8367 0.31 Trade 4 - STIR -965.76 -754.23 1.2676 0.52
  • 56. CALCULATIONS • CalculationRunner is entry to Calculation API • Provides a multi-threaded executor • Also allow callers to use their own executor // obtains a multithreaded runner try (CalculationRunner runner = CalculationRunner.ofMultiThreaded()) { // use the runner }
  • 57. RULES • CalculationRules defines how to calculate • Functions mapping from trade type to code • Reporting currency • Market data lookup // setup the rules CalculationRules rules = CalculationRules.of( StandardComponents.calculationFunctions(), Currency.USD, ratesMarketDataLookup);
  • 58. CALCULATIONS • Each column defined by Column • Measure specifies what to calculate • Can control reporting currency per column // specify the columns List<Column> columns = ImmutableList.of( Column.of(Measure.PRESENT_VALUE), Column.of(Measure.PRESENT_VALUE, Currency.GBP), Column.of(Measure.PV01_CALIBRATED_SUM), Column.of(Measure.PAR_RATE));
  • 59. CALCULATIONS • Calculation runner is stateless • Pass in all inputs, get back results • Separate API allows results to be received asynchronously // calculate the results Results results = runner.calculate( rules, // How to calculate trades, // Trades to process columns, // Columns, eg PV, PV01, par rate marketData, // Market data referenceData); // Reference data
  • 60. CALCULATION-LEVEL API NPV (USD) NPV (GBP) PV01 (USD) Par rate Trade 1 - Swap 13,487.25 10,176.72 12.7365 0.23 Trade 2 - Swap -34,276.73 -27,273.28 76.2725 0.24 Trade 3 - FRA 12,835.26 9,263.75 -26.8367 0.31 Trade 4 - STIR -965.76 -754.23 1.2676 0.52 ... ... ... ... ...
  • 62. STRATA v1.2 • Trades are immutable beans • Pricing/risk logic is stateless, and separate from the trades • Three levels of pricing/risk API • Pricer - one trade, one set of market data • Measure - one trade, one or many sets of market data • Calc - many trades, one or many sets of market data
  • 63. STRATA v1.2 • Modern market risk library in Java 8 • Lightweight and easy-to-use, lots of examples • Good asset class coverage, lots of built-in conventions • Open source, Apache v2 license • Foundation of commercial products • cloud-based calculations for derivatives trading • Commercial support available from OpenGamma http://strata.opengamma.io/