Main Content

Use Numerix for Interest-Rate Risk Assessment

This example shows how to use the Numerix® CROSSASSET API for interest-rate curve stripping for risk assessment.

Initialize Numerix environment.

import com.numerix.integration.*;
import com.numerix.integration.implementation.*;

n = numerix('i:\NumeriX_java_10_3_0\data')
n = 

              Path: 'i:\NumeriX_java_10_3_0\data'
    RepositoryPath: 'i:\NumeriX_java_10_3_0\data\Repository'
        Repository: [1x1 com.numerix.integration.implementation.FileSystemRepository]
           Context: [1x1 com.numerix.integration.implementation.LocalCalculationContext]
       LookupsPath: 'i:\NumeriX_java_10_3_0\data\Data\LookupRules'
       MarketsPath: 'i:\NumeriX_java_10_3_0\data\Data\Markets'
       FixingsPath: 'i:\NumeriX_java_10_3_0\data\Data\Fixings'
        TradesPath: 'i:\NumeriX_java_10_3_0\data\Data\Trades'
        Parameters: [1x1 com.numerix.integration.implementation.CalculationParameters]

Specify the current market associated with the Numerix CROSSASSET environment.

markets = get(n.Parameters,'Markets');
currentMarket = markets.get(0);
outInstance = RefObject(currentMarket);

Define the interest-rate curve key IR.USD-LIBOR-3M.MID.

n.Context.tryResolveId('IR.USD-LIBOR-3M.MID',outInstance);
currentInstance = outInstance.argvalue;

Set the instance and market.

n.Parameters.setMarkets(java.util.Arrays.asList(currentMarket));
n.Parameters.setInstances(java.util.Arrays.asList(currentInstance));

Calculate the interest-rate curve stripping.

results = n.Context.calculate(n.Parameters,Request.getAll);

The calculation returns the results from stripping the interest-rate curve for IR.USD-LIBOR-3M.MID. Parse the results for MATLAB® and display.

% IR.USD-LIBOR-3M.MID.  
r = n.parseResults(results)

disp([r.Instance r.Market])
disp([r.Results{1}.Name r.Results{1}.Category r.Results{1}.Currency r.Results{1}.Data])
disp([r.Results{1}.Name{1}])
disp([r.Results{1}.Data{1}])
r = 

    Instance: {'IR.USD-LIBOR-3M.MID'}
      Market: {'EOD'}
     Results: {[1x1 struct]}

 'IR.USD-LIBOR-3M.MID'    'EOD'

'Curve Info'    ''    ''    {30x3 cell}
'Messages'      ''    ''    { 7x1 cell}

Curve Info

  'KEY'                                  'DATE'                            'DISCOUNTFACTOR'
    'CASH RATE 16-APR-2012 17-APR-2012'    'Tue Apr 17 13:00:00 EDT 2012'    [        1.0000]
    'CASH RATE 16-APR-2012 18-APR-2012'    'Wed Apr 18 13:00:00 EDT 2012'    [        1.0000]
    'CASH RATE 16-APR-2012 23-APR-2012'    'Mon Apr 23 13:00:00 EDT 2012'    [        1.0000]
    'CASH RATE 16-APR-2012 30-APR-2012'    'Mon Apr 30 13:00:00 EDT 2012'    [        0.9999]
    'CASH RATE 16-APR-2012 16-MAY-2012'    'Wed May 16 13:00:00 EDT 2012'    [        0.9998]
    'CASH RATE 16-APR-2012 18-JUN-2012'    'Mon Jun 18 13:00:00 EDT 2012'    [        0.9994]
    'CASH RATE 16-APR-2012 16-JUL-2012'    'Mon Jul 16 13:00:00 EDT 2012'    [        0.9988]
    'CASH RATE 18-MAY-2012 12-AUG-2012'    'Sun Aug 12 13:00:00 EDT 2012'    [        0.9987]
    'CASH RATE 20-JUN-2012 20-SEP-2012'    'Thu Sep 20 13:00:00 EDT 2012'    [        0.9981]
    'CASH RATE 18-JUL-2012 18-OCT-2012'    'Thu Oct 18 13:00:00 EDT 2012'    [        0.9975]
    'CASH RATE 15-AUG-2012 15-NOV-2012'    'Thu Nov 15 12:00:00 EST 2012'    [        0.9973]
    'CASH RATE 19-SEP-2012 19-DEC-2012'    'Wed Dec 19 12:00:00 EST 2012'    [        0.9968]
    'CASH RATE 17-OCT-2012 17-JAN-2013'    'Thu Jan 17 12:00:00 EST 2013'    [        0.9962]
    'CASH RATE 19-DEC-2012 19-MAR-2013'    'Tue Mar 19 13:00:00 EDT 2013'    [        0.9955]
    'SWAP RATE 18-APR-2012 19-APR-2016'    'Tue Apr 19 13:00:00 EDT 2016'    [        0.9645]
    'SWAP RATE 18-APR-2012 18-APR-2017'    'Tue Apr 18 13:00:00 EDT 2017'    [        0.9445]
    'SWAP RATE 18-APR-2012 18-APR-2018'    'Wed Apr 18 13:00:00 EDT 2018'    [        0.9199]
    'SWAP RATE 18-APR-2012 18-APR-2019'    'Thu Apr 18 13:00:00 EDT 2019'    [        0.8925]
    'SWAP RATE 18-APR-2012 21-APR-2020'    'Tue Apr 21 13:00:00 EDT 2020'    [        0.8639]
    'SWAP RATE 18-APR-2012 19-APR-2021'    'Mon Apr 19 13:00:00 EDT 2021'    [        0.8356]
    'SWAP RATE 18-APR-2012 19-APR-2022'    'Tue Apr 19 13:00:00 EDT 2022'    [        0.8069]
    'SWAP RATE 18-APR-2012 18-APR-2023'    'Tue Apr 18 13:00:00 EDT 2023'    [        0.7784]
    'SWAP RATE 18-APR-2012 18-APR-2024'    'Thu Apr 18 13:00:00 EDT 2024'    [        0.7506]
    'SWAP RATE 18-APR-2012 19-APR-2027'    'Mon Apr 19 13:00:00 EDT 2027'    [        0.6733]
    'SWAP RATE 18-APR-2012 20-APR-2032'    'Tue Apr 20 13:00:00 EDT 2032'    [        0.5682]
    'SWAP RATE 18-APR-2012 20-APR-2037'    'Mon Apr 20 13:00:00 EDT 2037'    [        0.4828]
    'SWAP RATE 18-APR-2012 21-APR-2042'    'Mon Apr 21 13:00:00 EDT 2042'    [        0.4112]
    'SWAP RATE 18-APR-2012 18-APR-2052'    'Thu Apr 18 13:00:00 EDT 2052'    [        0.3087]
    'SWAP RATE 18-APR-2012 18-APR-2062'    'Tue Apr 18 13:00:00 EDT 2062'    [        0.2414]

See Also

| |

Related Topics

External Websites