Pricing Swaps daily


#1

In the “HistoricalScenarioExample” it prices the swap up until the start date of the swap, using the scenario builder.
But, if we change the dates of the swap, i.e change the start date to an earlier date. The code returns an error: “Unable to get fixing for USD-LIBOR-3M on date 2015-02-05” but there is data for 2015-02-05 in the marketdata folder.

Why does it not allow us to price the swap during the progress of the swap?

In the SwapPricingExample, you are able to price the swap in between the start and end date, but that does not use a “all-curves.csv” marketdata file, it uses individual csv files for individual dates instead.

Is there a way to a price a swap through all the days during the start and end date of the swap, whilst passing through 1 csv file called “all-curves.csv” as shows in “HistoricalScenarioExample”.


#2

The error refers to missing time-series information.

HistoricalScenarioExample uses market data with a valuation date of 2015-04-23, any fixing before that date will need the time-series.

The file example-historicalscenario-marketdata/historical-fixings\usd-libor-3m.csv file is basically empty. If you copy the example-marketdata/historical-fixings\usd-libor-3m.csv and usd-libor-6m.csv files to the example-historicalscenario-marketdata subfolder, it works.


#3

okay thank you. I added those files and that works now.

From “SwapPricingExample” it uses the valuation date as “2014-01-22” and in the marketdata curves folder, it has two files. One for 2009-07-31 and 2014-01-22.
Is there any way to just have one file (allcurves.csv) instead of separate files, and have:

MarketData marketData = marketDataBuilder.buildSnapshot(valuationDate);

look directly into that one file and search for the date? That way I can iterate through dates whilst only having one file for the marketdata instead of several files each for a separate date.


#4

The example market data builder will load all curve files in the folder, regardless of name.

Each curves file can contain more than one curve, and contain them for more than one date. So, a file just like allcurves.csv file will just work if placed in the right folder.