Prepare the Portfolio Data
Document and Pricing data files are requested to evaluate your portfolio. In this section you will use the Financial Model Builder to create these files.
Portfolio Documents
The Portfolio Valuation App leverages the use of the FPP API and workflows. As you are dealing with different scripts, each document is assigned to a script, and then all documents assigned to the same script are executed in parallel. This approach is called heterogeneous pricing.
To find out more about executing scripts in parallel, follow the Parallelization tutorial from the Financial Model Builder Documentation.
To identify what script to use, each document contains a field called script
, and other information about the deal such as currency, counterparty, etc.
To create a document that contains the deals of the portfolio
- Log into Financial Model Builder.
- Create a document file in src > test > resources > documents, and name it
tutorial_Portfolio
. - Open the newly created document file, and paste the following JSON document definition; the documents of the portfolio are defined in the JSON array:
[
{
"dealStamp": "Option_Document_1",
"type": "call",
"script": "tutorial_EUadvanced",
"maturity_date": "2019-04-25",
"strike": 43000,
"value_date": "2017-04-13",
"curve": "projection_Libor_3M",
"typeOfDeals": "Option",
"currency": "USD",
"counterparty": "Bank of America",
"stockdata": {
"instrument": "EQUITY",
"name": "Company_A"
}
},
{
"dealStamp": "Option_Document_2",
"type": "call",
"script": "tutorial_EUadvanced",
"maturity_date": "2019-04-25",
"strike": 44000,
"value_date": "2017-04-13",
"curve": "projection_Libor_3M",
"typeOfDeals": "Option",
"currency": "USD",
"counterparty": "Citi",
"stockdata": {
"instrument": "EQUITY",
"name": "Company_A"
}
},
{
"dealStamp": "Option_Document_3",
"type": "call",
"script": "tutorial_EUadvanced",
"maturity_date": "2019-04-25",
"strike": 45000,
"value_date": "2017-04-13",
"curve": "projection_Libor_3M",
"typeOfDeals": "Option",
"currency": "USD",
"counterparty": "BNP",
"stockdata": {
"instrument": "EQUITY",
"name": "Company_A"
}
},
{
"dealStamp": "Option_Document_4",
"type": "call",
"script": "tutorial_EUadvanced",
"maturity_date": "2019-04-25",
"strike": 46000,
"value_date": "2017-04-13",
"curve": "projection_Libor_3M",
"typeOfDeals": "Option",
"currency": "USD",
"counterparty": "UBS",
"stockdata": {
"instrument": "EQUITY",
"name": "Company_A"
}
},
{
"dealStamp": "Option_Document_5",
"type": "call",
"script": "tutorial_EUadvanced",
"maturity_date": "2019-04-25",
"strike": 47000,
"value_date": "2017-04-13",
"curve": "projection_Libor_3M",
"typeOfDeals": "Option",
"currency": "USD",
"counterparty": "Societe Generale",
"stockdata": {
"instrument": "EQUITY",
"name": "Company_A"
}
},
{
"dealStamp": "IRS_Document_1",
"typeOfDeals": "IRS",
"currency": "USD",
"counterparty": "Bank of America",
"script": "tutorial_IRS",
"legs": [
{
"basis": "ACT/365.FIXED",
"discountCurve": "discount_Libor_3M",
"fixedRate": 0.016,
"indexationType": "fixed",
"notional": 100000,
"payOrRec": "receiving",
"schedule": [
{
"endDate": "2017-06-01",
"startDate": "2017-03-01"
},
{
"endDate": "2017-09-01",
"startDate": "2017-06-01"
},
{
"endDate": "2017-12-01",
"startDate": "2017-09-01"
},
{
"endDate": "2018-03-01",
"startDate": "2017-12-01"
}
]
},
{
"basis": "ACT/365.FIXED",
"discountCurve": "discount_Libor_3M",
"indexationType": "floating",
"notional": 100000,
"payOrRec": "paying",
"projectionCurve": "projection_Libor_3M",
"schedule": [
{
"endDate": "2017-06-01",
"startDate": "2017-03-01"
},
{
"endDate": "2017-09-01",
"startDate": "2017-06-01"
},
{
"endDate": "2017-12-01",
"startDate": "2017-09-01"
},
{
"endDate": "2018-03-01",
"startDate": "2017-12-01"
}
]
}
]
},
{
"dealStamp": "IRS_Document_2",
"typeOfDeals": "IRS",
"currency": "USD",
"counterparty": "Citi",
"script": "tutorial_IRS",
"legs": [
{
"basis": "ACT/365.FIXED",
"discountCurve": "discount_Libor_3M",
"fixedRate": 0.016,
"indexationType": "fixed",
"notional": 110000,
"payOrRec": "receiving",
"schedule": [
{
"endDate": "2017-06-01",
"startDate": "2017-03-01"
},
{
"endDate": "2017-09-01",
"startDate": "2017-06-01"
},
{
"endDate": "2017-12-01",
"startDate": "2017-09-01"
},
{
"endDate": "2018-03-01",
"startDate": "2017-12-01"
}
]
},
{
"basis": "ACT/365.FIXED",
"discountCurve": "discount_Libor_3M",
"indexationType": "floating",
"notional": 110000,
"payOrRec": "paying",
"projectionCurve": "projection_Libor_3M",
"schedule": [
{
"endDate": "2017-06-01",
"startDate": "2017-03-01"
},
{
"endDate": "2017-09-01",
"startDate": "2017-06-01"
},
{
"endDate": "2017-12-01",
"startDate": "2017-09-01"
},
{
"endDate": "2018-03-01",
"startDate": "2017-12-01"
}
]
}
]
},
{
"dealStamp": "IRS_Document_3",
"typeOfDeals": "IRS",
"currency": "USD",
"counterparty": "BNP",
"script": "tutorial_IRS",
"legs": [
{
"basis": "ACT/365.FIXED",
"discountCurve": "discount_Libor_3M",
"fixedRate": 0.016,
"indexationType": "fixed",
"notional": 120000,
"payOrRec": "receiving",
"schedule": [
{
"endDate": "2017-06-01",
"startDate": "2017-03-01"
},
{
"endDate": "2017-09-01",
"startDate": "2017-06-01"
},
{
"endDate": "2017-12-01",
"startDate": "2017-09-01"
},
{
"endDate": "2018-03-01",
"startDate": "2017-12-01"
}
]
},
{
"basis": "ACT/365.FIXED",
"discountCurve": "discount_Libor_3M",
"indexationType": "floating",
"notional": 120000,
"payOrRec": "paying",
"projectionCurve": "projection_Libor_3M",
"schedule": [
{
"endDate": "2017-06-01",
"startDate": "2017-03-01"
},
{
"endDate": "2017-09-01",
"startDate": "2017-06-01"
},
{
"endDate": "2017-12-01",
"startDate": "2017-09-01"
},
{
"endDate": "2018-03-01",
"startDate": "2017-12-01"
}
]
}
]
},
{
"dealStamp": "IRS_Document_4",
"typeOfDeals": "IRS",
"currency": "USD",
"counterparty": "UBS",
"script": "tutorial_IRS",
"legs": [
{
"basis": "ACT/365.FIXED",
"discountCurve": "discount_Libor_3M",
"fixedRate": 0.016,
"indexationType": "fixed",
"notional": 140000,
"payOrRec": "paying",
"schedule": [
{
"endDate": "2017-06-01",
"startDate": "2017-03-01"
},
{
"endDate": "2017-09-01",
"startDate": "2017-06-01"
},
{
"endDate": "2017-12-01",
"startDate": "2017-09-01"
},
{
"endDate": "2018-03-01",
"startDate": "2017-12-01"
}
]
},
{
"basis": "ACT/365.FIXED",
"discountCurve": "discount_Libor_3M",
"indexationType": "floating",
"notional": 140000,
"payOrRec": "receiving",
"projectionCurve": "projection_Libor_3M",
"schedule": [
{
"endDate": "2017-06-01",
"startDate": "2017-03-01"
},
{
"endDate": "2017-09-01",
"startDate": "2017-06-01"
},
{
"endDate": "2017-12-01",
"startDate": "2017-09-01"
},
{
"endDate": "2018-03-01",
"startDate": "2017-12-01"
}
]
}
]
},
{
"dealStamp": "IRS_Document_5",
"typeOfDeals": "IRS",
"currency": "USD",
"counterparty": "Societe Generale",
"script": "tutorial_IRS",
"legs": [
{
"basis": "ACT/365.FIXED",
"discountCurve": "discount_Libor_3M",
"fixedRate": 0.016,
"indexationType": "fixed",
"notional": 150000,
"payOrRec": "receiving",
"schedule": [
{
"endDate": "2017-06-01",
"startDate": "2017-03-01"
},
{
"endDate": "2017-09-01",
"startDate": "2017-06-01"
},
{
"endDate": "2017-12-01",
"startDate": "2017-09-01"
},
{
"endDate": "2018-03-01",
"startDate": "2017-12-01"
}
]
},
{
"basis": "ACT/365.FIXED",
"discountCurve": "discount_Libor_3M",
"indexationType": "floating",
"notional": 150000,
"payOrRec": "paying",
"projectionCurve": "projection_Libor_3M",
"schedule": [
{
"endDate": "2017-06-01",
"startDate": "2017-03-01"
},
{
"endDate": "2017-09-01",
"startDate": "2017-06-01"
},
{
"endDate": "2017-12-01",
"startDate": "2017-09-01"
},
{
"endDate": "2018-03-01",
"startDate": "2017-12-01"
}
]
}
]
}
]
Portfolio Pricing Data
The portfolio pricing data file is composed of the pricing data used to price the two type of deals: Equity Options and Interest Rate Swaps.
To create the pricing data
- In Financial Model Builder, create a pricing data file in src > test > resources >pricingData, and name it
tutorial_Portfolio
. - Open the newly created pricing data file, and paste the following code:
{
"dates" : [
"2017-04-13"
],
"scenarioData" : [
{
"id" : {
"type" : "DIVIDEND",
"parameters" : [
"Company_A",
"CONTINUOUS"
]
},
"points" : {
"2017-04-13" : [
{
"values" : [
0.01
]
}
]
},
"metaData" : { }
},
{
"id" : {
"type" : "EQUITY",
"parameters" : [
"Company_A"
]
},
"points" : {
"2017-04-13" : [
{
"values" : [
46000.0
]
}
]
},
"metaData" : { }
},
{
"id" : {
"type" : "Volatility",
"parameters" : [
"Company_A"
]
},
"points" : {
"2017-04-13" : [
{
"values" : [
0.0221
]
}
]
},
"metaData" : { }
},
{
"id" : {
"type" : "YIELD_CURVE",
"parameters" : [
"discount_Libor_3M",
"discountFactor"
]
},
"points" : {
"2017-04-13" : [
{
"x" : 17269.0,
"values" : [
1.0
]
},
{
"x" : 17294.0,
"values" : [
0.99976
]
},
{
"x" : 17319.0,
"values" : [
0.99952
]
},
{
"x" : 17344.0,
"values" : [
0.99928
]
},
{
"x" : 17369.0,
"values" : [
0.99904
]
},
{
"x" : 17394.0,
"values" : [
0.9988
]
},
{
"x" : 17419.0,
"values" : [
0.99856
]
},
{
"x" : 17444.0,
"values" : [
0.99799
]
},
{
"x" : 17469.0,
"values" : [
0.99742
]
},
{
"x" : 17494.0,
"values" : [
0.99685
]
},
{
"x" : 17519.0,
"values" : [
0.99628
]
},
{
"x" : 17544.0,
"values" : [
0.99572
]
},
{
"x" : 17569.0,
"values" : [
0.99515
]
},
{
"x" : 17594.0,
"values" : [
0.99458
]
},
{
"x" : 17619.0,
"values" : [
0.99424
]
},
{
"x" : 17644.0,
"values" : [
0.99391
]
},
{
"x" : 17669.0,
"values" : [
0.99357
]
},
{
"x" : 17694.0,
"values" : [
0.99323
]
},
{
"x" : 17719.0,
"values" : [
0.9929
]
},
{
"x" : 17787.0,
"values" : [
0.99256
]
}
]
},
"metaData" : {
"zeroCouponFormula" : "exponential",
"zeroCouponBasis" : "ACT/365.FIXED",
"switchDates" : [ ],
"currency" : "USD",
"interpolationMethods" : [
"flat"
],
"interpolationVariables" : [
"discountFactor"
]
}
},
{
"id" : {
"type" : "YIELD_CURVE",
"parameters" : [
"projection_Libor_3M",
"discountFactor"
]
},
"points" : {
"2017-04-13" : [
{
"x" : 17269.0,
"values" : [
1.0
]
},
{
"x" : 17294.0,
"values" : [
0.99943
]
},
{
"x" : 17319.0,
"values" : [
0.99886
]
},
{
"x" : 17344.0,
"values" : [
0.99829
]
},
{
"x" : 17369.0,
"values" : [
0.99772
]
},
{
"x" : 17394.0,
"values" : [
0.99715
]
},
{
"x" : 17419.0,
"values" : [
0.99658
]
},
{
"x" : 17444.0,
"values" : [
0.99629
]
},
{
"x" : 17469.0,
"values" : [
0.99601
]
},
{
"x" : 17494.0,
"values" : [
0.99572
]
},
{
"x" : 17519.0,
"values" : [
0.99544
]
},
{
"x" : 17544.0,
"values" : [
0.99515
]
},
{
"x" : 17569.0,
"values" : [
0.99486
]
},
{
"x" : 17594.0,
"values" : [
0.99458
]
},
{
"x" : 17619.0,
"values" : [
0.99403
]
},
{
"x" : 17644.0,
"values" : [
0.99347
]
},
{
"x" : 17669.0,
"values" : [
0.99292
]
},
{
"x" : 17694.0,
"values" : [
0.99236
]
},
{
"x" : 17719.0,
"values" : [
0.99181
]
},
{
"x" : 17787.0,
"values" : [
0.99125
]
}
]
},
"metaData" : {
"zeroCouponFormula" : "exponential",
"zeroCouponBasis" : "ACT/365.FIXED",
"switchDates" : [ ],
"currency" : "USD",
"interpolationMethods" : [
"flat"
],
"interpolationVariables" : [
"discountFactor"
]
}
}
],
"historicalData" : [ ],
"calendars" : [ ],
"configuration" : { }
}