TradeReport.of() unexpected result

Hi,
The result supplied to TradeReport.of contains results of FixedCouponBondTrade as expected (all wanted measures), but the TradeReport.of returns invalid measures for all but PV. I suppose this has to do with the fact that I have loaded FixedCoupon as a Security with details in Ref data. What is the issue? Thanks!

Hi,
There isn’t enough info here for me to be able to provide meaningful advice I’m afraid. TradeReport itself is a relatively simple data class that wraps the output of a calculation. I’d recommend debugging step by step to see if there is an obvious point at which data is being lost.
Stephen

1 Like

Hi again,
I’ve added a derived measure which does not seem to come up in the list of available measures through calculationFunctions.findFunction(target). The derived measure and its function are listed in calculationFunctions as sub elements to the regular FixedCouponTradeCalculationFunction. As mentioned, the target SecurityTrade represents a FixedCouponBondTrade for which the derived measure is defined. Hopefully the problem is more clear now. Thanks!

Sorry, My derived measure was not properly registered. Now I fixed that the measure pops up. KR, Oyvind

Unfortunately I encountered another problem as the derived measure cannot longer be found. I think the problem is related to the registering of the derived function. Am I using the right class defintion for the FixedCouponBond asset class where trades are loaded as securities?

public class PresentValueWithZspread extends AbstractDerivedCalculationFunction<SecurityTrade, CurrencyScenarioArray> {

Thanks in advance

The class signature looks fine. Registering should be like this:

var fns = StandardComponents.calculationFunctions()
            .composedWith(PresentValueWithZspread.INSTANCE);

findFunction() should then return an instance of DerivedCalculationFunctionWrapper

Thanks! I am sorry but I only get Optional[com.opengamma.strata.measure.bond.FixedCouponBondTradeCalculationFunction@711bf2] from findFunction() with target FixedCouponBondTrade{info=TradeInfo{id=OG-Ticker~AT0000A001X2,... . PresentValueWithZspread is registered as shown in the screenshot:

. Hope a solution is evident:)

Your debug is for a SecurityTrade yet you are querting it with FixedCouponBondTrade, thus the debug doesn’t match the query.

The FixedCouponBondTrade is resolved from a SecurityTrade somewhere before this point. The debug frame is looking at the functions1 object in findFunctions(). Sorry for the confusion! Should I change the signature of my PresentValueWithZspread class so that it is applicable for FixedCouponBondTrade ? In the original situation I had a FixedCouponBondTrade as target, but then the TradeReport didnt work as the calculation function during this process could not be found. Ideally Id like to do it the way its supposed to be by the design