Historical Scenario Analysis for Generic Securities


#1

The “HistoricalScenarioExample” illustrates how to price a an asset over a large date range using the “runner.calculateMultiScenario” method. This works for all assets that use Interest Rate Curves for pricing as there is a “loadAllRatesCurves()” method in MarketDataBuilder.

How do we implement this for Generic Securities. How do we price the generic securities over a large date range using the calculateMultiScenario method. There is no “loadAllQuotes()” method, therefore how would one go about passing multiple dates to be priced without changing the valuationDate() every time.


#2

The example market data builder was primarily intended for use in examples, rather than real code. As such, it only contains the methods necessary for the current examples.

If you look within ExampleMarketDataBuilder, you will see that the quotes are loaded using QuotesCsvLoader. This can be used to load the multiple dates you desire. Unfortunately, there is no single convenient loadAllDates() method there either, but if you know all the dates you need to load, you can simply loop and call QuotesCsvLoader many times. (This loadAllDates() method is one we need to add to QuotesCsvLoader)

Once you have the data, you have to add the quotes for each day to the scenario applicable to that day. This will entail using ImmutableScenarioMarketDataBuilder. Note that two instances of ScenarioMarketData can be combined using scenarioMarketData1.combinedWith(scenarioMarketData2) which may come in handy.

Hope that helps