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
Strata, Open Source Market Risk
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

PDF
Homestay tourism
PPTX
Climate change and tourism
PPTX
Presentation Agri-Tourism example
PPSX
Food n wine harmony
PPTX
Desert tourism resources of india sadique ali
PPTX
Tourism Planning
PPT
Mice tourism in delhi
Homestay tourism
Climate change and tourism
Presentation Agri-Tourism example
Food n wine harmony
Desert tourism resources of india sadique ali
Tourism Planning
Mice tourism in delhi

What's hot (20)

PPT
OVERVIEW OF TOURISM PLANNING AND DEVELOPMENT
PPTX
Coastal tourism
PDF
Planning for Competitive and Sustainable Destination
PPTX
Phillipines regions
PPT
Coffee presentation
PDF
ALL ABOUT COFFEE
PPT
PDF
Types of Tourism
PPTX
My coffee presentation
PPTX
Lecture 1. Introduction to Tourism Planning and Development(1).pptx
PPTX
Tourism Impact Assessment
DOCX
ECOTOURISM-MANAGEMENT-2.docx
PPT
Agritourism
PDF
Heritage tourism in India
PPTX
Section 3 Daily Life in Athens
PDF
01 menage
PPSX
garde manger
PPT
Colombian Food
PPT
Mass tourism
PDF
Introduction to coffee
OVERVIEW OF TOURISM PLANNING AND DEVELOPMENT
Coastal tourism
Planning for Competitive and Sustainable Destination
Phillipines regions
Coffee presentation
ALL ABOUT COFFEE
Types of Tourism
My coffee presentation
Lecture 1. Introduction to Tourism Planning and Development(1).pptx
Tourism Impact Assessment
ECOTOURISM-MANAGEMENT-2.docx
Agritourism
Heritage tourism in India
Section 3 Daily Life in Athens
01 menage
garde manger
Colombian Food
Mass tourism
Introduction to coffee
Ad

Similar to Strata, Open Source Market Risk (20)

PDF
#GeodeSummit - Wall St. Derivative Risk Solutions Using Geode
PDF
Building Wall St Risk Systems with Apache Geode
PDF
Wall Street Derivative Risk Solutions Using Geode
PDF
Wall Street Derivative Risk Solutions Using Apache Geode
PPTX
apidays New York 2025 - The FINOS Common Domain Model for Capital Markets by ...
PDF
WSO2 Analytics Platform: The one stop shop for all your data needs
PPTX
Abc financial analyticsdemo
PDF
WSO2Con USA 2017: Analytics Patterns for Your Digital Enterprise
PDF
Analytics Patterns for Your Digital Enterprise
PPTX
Are You Trading Stocks Securely? Exposing Security Flaws in Trading Technologies
PDF
[WSO2Con USA 2018] Patterns for Building Streaming Apps
PDF
Building A Feature Factory
PPTX
Quantlogic Product &amp; Services Offerring
PPTX
Juanjo Hierro_FIWARE Marketplace and Data Publication features.pptx
PPTX
PPTX
WSO2Con USA 2015: WSO2 Analytics Platform - The One Stop Shop for All Your Da...
PPTX
Real Time Business Intelligence with Cassandra, Kafka and Hadoop - A Real Sto...
PDF
Search Analytics Component: Presented by Steven Bower, Bloomberg L.P.
PDF
Reigning in Protobuf with David Navalho and Graham Stirling | Kafka Summit Lo...
PDF
WSO2 Analytics Platform - The one stop shop for all your data needs
#GeodeSummit - Wall St. Derivative Risk Solutions Using Geode
Building Wall St Risk Systems with Apache Geode
Wall Street Derivative Risk Solutions Using Geode
Wall Street Derivative Risk Solutions Using Apache Geode
apidays New York 2025 - The FINOS Common Domain Model for Capital Markets by ...
WSO2 Analytics Platform: The one stop shop for all your data needs
Abc financial analyticsdemo
WSO2Con USA 2017: Analytics Patterns for Your Digital Enterprise
Analytics Patterns for Your Digital Enterprise
Are You Trading Stocks Securely? Exposing Security Flaws in Trading Technologies
[WSO2Con USA 2018] Patterns for Building Streaming Apps
Building A Feature Factory
Quantlogic Product &amp; Services Offerring
Juanjo Hierro_FIWARE Marketplace and Data Publication features.pptx
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...
Search Analytics Component: Presented by Steven Bower, Bloomberg L.P.
Reigning in Protobuf with David Navalho and Graham Stirling | Kafka Summit Lo...
WSO2 Analytics Platform - The one stop shop for all your data needs
Ad

More from Stephen Colebourne (6)

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

Recently uploaded (20)

PPTX
ai tools demonstartion for schools and inter college
PDF
Digital Strategies for Manufacturing Companies
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPTX
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PPTX
Transform Your Business with a Software ERP System
PPTX
L1 - Introduction to python Backend.pptx
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PPTX
Introduction to Artificial Intelligence
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PPTX
Online Work Permit System for Fast Permit Processing
ai tools demonstartion for schools and inter college
Digital Strategies for Manufacturing Companies
Adobe Illustrator 28.6 Crack My Vision of Vector Design
VVF-Customer-Presentation2025-Ver1.9.pptx
Upgrade and Innovation Strategies for SAP ERP Customers
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
Operating system designcfffgfgggggggvggggggggg
2025 Textile ERP Trends: SAP, Odoo & Oracle
How to Choose the Right IT Partner for Your Business in Malaysia
Transform Your Business with a Software ERP System
L1 - Introduction to python Backend.pptx
Odoo Companies in India – Driving Business Transformation.pdf
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Introduction to Artificial Intelligence
Design an Analysis of Algorithms II-SECS-1021-03
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
How to Migrate SBCGlobal Email to Yahoo Easily
Online Work Permit System for Fast Permit Processing

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
  • 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/