Project

General

Profile

<xweld/>-valuation

The valuation framework defines an extensible, configurable and griddable mechanism for valuing trades, positions or products and supporting the market data required by each model. While the framework is completely general in design, it is particularly useful when building configurable quantitative applications that require the dynamic configuration of models or valuation routines, market data and how they are bound to things that can be measured. The valuation framework uses the grid model supported by the xweld-core module. The valuation framework does not contain production ready analytics, rather, it supports a flexible mechanism for an application to plug in any third-party or custom analytics and focuses on supporting the configuration and binding between models, measurands and market data.

Primary Features and Benefits

What? A Financial Toolkit With No Pricing Models?

Each market participant has a different take on which analytic or model should be used to value each asset class. Often, different groups within the same organization will need or want to use different models as a matter of policy. In addition the choice of models and pricing routines is seen as a competitive advantage. Others rely on third-party analytics vendors. The valuation framework supports building flexible systems and applications that can reflect these needs through configuration and dynamic binding.

Therefore, the <xweld/>-valuation framework does not provide industrial grade models or analytic routines out of the box. While there are default implementations for many analytics for schedule generation, curve fitting, and pricers, we don't recommend these for production use. The valuation framework focuses on supporting the bindings and extension points required to build configurable applications that support dynamically pluggable analytics and market data generation. The valuation framework is the glue that dynamically binds market data to models to things that can be valued or measured, for example financial trades or positions. There are many analytics vendors and open source libraries that may be used as the actual implementations and the valuation framework defines the plug-and-play framework for including any third party or proprietary valuation library in your application.

In sum, the valuation framework:

  • supports the definition, storage and retrieval of market data for use by models (curves, surfaces, quotes etc.)
  • provides the dynamic binding between measurands and their associated pricing models
  • provides clear and clean extension points for interpolators, pricing methods, curve and surface generation
  • supports the configuration of hierarchical groupings of market data called Valuation Contexts
  • marshals market data, models and measurands together at run time using a configurable set of discriminating values (see below)

The <xweld/> valuation framework is a candidate for use in your application if any of the following are true:

  • you need to store and retrieve market data for valuation purposes
  • you want a plug and play, configurable mechanism to add any third-party, vendor or in house set of pricers, analytics, curve builders and schedule generators to your application
  • a way to configure models with their associated parameters and market data on a per user basis
  • your application needs a way to dynamically bind analytics, market data and models
  • you want to build a system that supports any of the above using a distributed grid/cache

Key Concepts

Valuation Context, Models and Measures and Market Data

Market data refers to the collection of curves, surfaces and quotes required to value trades.Market data items can be persisted in the JPA data store, and further grouped into named sets of related data called a ValuationContext. Market data types that can be included in a valuation context include:

  • Zero Curves
  • Repo Curves
  • FX Curves
  • Recovery and Probability Curves
  • Quotes
  • Volatility Curves and Surfaces
  • Correlation Matrices

The Valuation Context binds, but loosely couples, objects that can be valued such as trades, positions or products with the models that are used to value them.The context also associates the set of curves and surfaces and other market data items that each model requires to value measurands.

A model is an analytical method that given a measurand, some market data and a list of measures to calculate, returns valuation results. All models must implement the IModel interface, and the Model abstract class may be used as a base class when implementing new models.

valuation-context diagram

A Valuation Context controls how models are dynamically associated with the market data they require and the things that can be measured, e.g. trades. The context tells the system what models (pricing algorithms) and market data (interest rate curves, volatility surfaces, security quotes etc.) to use to value each measurand. Valuation Contexts may be persisted in JPA backing store so at any time a valuation configuration can be restored exactly to a prior state. Further, valuation contexts support real time updates. As market data changes in real time, the changes are automatically propagated to all dependant instances.

Measurands and Discriminators

Objects that can be measured, such as trades, are called measurands and must implement the IMeasurand interface. This interface defines the API for retrieving properties of the measurand at run time, such as the trade date, the currency or the product type. The set of properties a measurand must support are determined by the model used to value that measurand. A valuation context configuration specifies special properties of all measurands, called discriminators. They are so named because the values of the discriminators returned from an instance of a measurand determine the binding between measurands and models.

For example, if our measurands are OTC trades, the asset classes could be divided into families, such as Commodities, Fixed Income or Credit, and further divided into asset types in each family such as:

  • Commodities : Energy, Grains
  • Fixed Income: Bonds and Interest Rate Swaps
  • Credit: Credit Default Swaps and Collateralized Debt Obligations.

To support this valuation model, our configuration would define two descriminators, one called "Family" and the other called "Asset Type" where each measurand would be able to return a suitable value for each descriminator when the method String getDiscriminator(String name) is called.

Packages and Classes

com.xweld.finance.valuation

com.xweld.finance.valuation class library

The example below shows how to programatically create a new valuation context, add some market data to it, and bind models and measurands via that context:

// create a new configuration for our bond pricing model 
// normally this would be done at application configuration time

ModelConfiguration config = new ModelConfiguration("BondModel");
ValuationContextConfiguration vconfig = new ValuationContextConfiguration ();
// configure the names of the discriminators our products will use
vconfig.setDiscriminatorNames(new String[] { "Family", "Category" });

ValuationContext context = new ValuationContext("test");
context.configure(vconfig);

// bind our sub-classes of Model to the descrininators
// this also would normally done at configuration time

context.bind(new String[] { "Equity", "ANY" }, EquityModel.class);
context.bind(new String[] { "Bond", "UST" }, BondUSTModel.class);
context.bind(new String[] { "Bond", "ANY" }, BondModel.class);
context.addDiscountCurve(new String[] { "Bond", "ANY" }, CurrencyCode.EUR,
        null, null, curve);

// now for any instance of a measurand, we can get the associated model instance

IModel<Bond> bondModel = context.getModel(new Bond());
IModel<Equity> equityModel = context.getModel(new Equity());

// we can also get our configured market data from an instance of a measurand
Curve curve = context.getForecastCurve(new Bond());

Adding a New Model To The System

A new model can easily be incorporated into an application as follows:

  • create a sub-class of com.xweld.finance.valuation.Model that implements your custom pricing methodologies
  • create a model configuration that defines the parameters, measures and market data types required by the model implementation
  • create an implementation of IMeasurand that supports the descriminators and properties required by the model
  • bind the model to types of measurands using an valuation context configuration at application setup time

That's it! Now you application can use the valuation context to retrieve perconfigured model instances at run time.

com.xweld.finance.curve

Curves a created using Curve Generators. Curves may be generated by bootstrapping from underlying insgruments or by constructing them from a series of points (tenors and values) provided by the caller. The Curve Generator Manager is used to instantiate generators at run time, and any nukber of generators may be plugged into a application via configuration. The class diagram below shows the relationships between curves, their generators and the manager:

com.xweld.finance.curve gernartion class digram

The following snippet shows how to generate a new zero curve using the ZeroCurveGenerator class:

static Tenor[]  tenors = { Tenor.fromString("1W"), Tenor.fromString("1M"),
      Tenor.fromString("2M"), Tenor.fromString("3M"), Tenor.fromString("6M"),
      Tenor.fromString("9M"), Tenor.fromString("1Y"), Tenor.fromString("2Y"),
      Tenor.fromString("3Y"), Tenor.fromString("4Y"), Tenor.fromString("5Y"),
      Tenor.fromString("6Y"), Tenor.fromString("7Y"), Tenor.fromString("8Y"),
      Tenor.fromString("9Y"), Tenor.fromString("10Y"), Tenor.fromString("12Y"),
      Tenor.fromString("15Y"), Tenor.fromString("20Y"),
      Tenor.fromString("25Y"), Tenor.fromString("30Y"), };

  static double[] bids   = { 4.559, 4.581, 4.573, 4.557, 4.496, 4.490, 4.54,
      4.63, 4.75, 4.86, 4.99, 5.11, 5.23, 5.33, 5.41, 5.47, 5.60, 5.75, 5.89,
      5.95, 5.96        };

ZeroCurveGenerator g = new ZeroCurveGenerator(new LinearCurveInterpolator());
ZeroCurve curve = g.generate(InstanceType.CLOSE, new GregorianCalendar(),
tenors, bids, bids);

curve.setCurrency(CurrencyCode.EUR);
curve.setTenor(Tenor.fromString("3M"));
curve.setIndex("EURIBOR");

In the example above, we are instantiating the generator along with an interpolator. We can also use the curve generator manager via configuration to obtain a generator for us at run time as follows:

// set up a configuration for the manager in advance
// bind the xero curve generator to the type zero curve
// set the interpolation type to use spline interolation

CurveGeneratorManagerConfiguration c = new CurveGeneratorManagerConfiguration();
c.addGeneratorType(ZeroCurve.class, ZeroCurveGenerator.class);
c.addInterpolatorType(ZeroCurve.class, SplineCurveInterpolator.class);

// at run time, as the manager for the configured generator for type ZeroCurve
CurveGenerator<?> g = m.getGenerator(ZeroCurve.class);
Curve curve = g.generate(InstanceType.CLOSE, cal, tenors, bids, bids);

System.out.println("Curve has " + curve.size() + " points.");

Contact Us

For more information, please contact us at

Copyright

Copyright © 1999-2014 Free North Alliance Inc. All Rights Reserved.

The contents of this web site, including all images, text, graphics and software, are the sole property of Free North Alliance Inc. and its agents. Unauthorized use or transmission is strictly forbidden by international copyright law.

com.xweld.finance.valuation.JPG View - com.xweld.finance.valuation class library (102 KB) John Free, 04 May 2012 10:43 AM

com.xweld.finance.curve.generation.JPG View - com.xweld.finance.curve gernartion class digram (84.8 KB) John Free, 07 May 2012 01:20 PM

market-environment-small.gif View - valuation-context diagram (10.7 KB) John Free, 08 August 2012 10:39 AM