Pricing fails when one of the inside a portfolio trade is bad


#1

We are trying to price IRS trades using strata and are running into issue where the entire task fails

this is the api we are currently invoking

private Results calculateRiskResults(List<Trade> trades, CalculationRules rules, List<Column> columns, MarketEnvironment marketDataSnapshot, ReferenceData refData){
	CalculationTasks tasks = CalculationTasks.of(rules, trades, columns);
MarketDataConfig.empty(), marketDataSnapshot, refData);
        
	Results results = runner.getTaskRunner().calculateSingleScenario(tasks, marketDataSnapshot, refData);
	return results;
}

The error i get is
"Unable to get a value from a failure result: Function ‘SwapCalculationFunction’ threw an exception: Period ‘2011-03-22’ to ‘2017-01-18’ resulted in a disallowed stub with frequency ‘P6M’"

is there anyway to continue pricing the remaining good trades?


#2

The error itself refers to a swap leg that does not have a StubConvention set. When there is no convention set, the convention defaults to “None”, which validates that the start/end dates form an exact 6 month schedule. Clearly in this case, the dates ‘2011-03-22’ to ‘2017-01-18’ do not form an exact 6 month schedule. To get the swap to price it will be necessary to add a stub convention.

On the point about continuing to price the good trades, I have just tested the latest code on the master branch, and it did what I expected it to, which is to catch the error for the bad trade but continue to price the good trades. Looking at the history of the file, it seems that behaviour is not new, therefore I’m surprised you are not seeing the good trades continue to price.

Just to check, that you are receiving an exception stack trace instead of getting back the Results object? ie. with your inputs, calculateRiskResults() is throwing an exception? If you do have an exception could you paste the stack trace?


#3

Thanks Steven, i was about to post the correction to my problem.
I found some other error which caused the entire run to fail.

That being said, I have a separate question now.
about printing PV and PnL series in csv format report.

should i create a new topic for this?


#4

It is best to start a new topic as it allows others to Google the results better (just like Stack Overflow)