//------------------------------------------------------------------------- /// <summary> /// Returns a collector that builds a multi-currency scenerio result. /// <para> /// This is used at the end of a stream to collect per-scenario instances of <seealso cref="MultiCurrencyAmount"/> /// into a single instance of <seealso cref="MultiCurrencyScenarioArray"/>, which is designed to be space-efficient. /// /// </para> /// </summary> /// <returns> a collector used at the end of a stream of <seealso cref="MultiCurrencyAmount"/> /// to build a <seealso cref="MultiCurrencyScenarioArray"/> </returns> public static Collector <MultiCurrencyAmount, IList <MultiCurrencyAmount>, MultiCurrencyScenarioArray> toMultiCurrencyValuesArray() { //JAVA TO C# CONVERTER TODO TASK: Method reference constructor syntax is not converted by Java to C# Converter: return(Collector.of(List <MultiCurrencyAmount>::new, (a, b) => a.add(b), (l, r) => { l.addAll(r); return l; }, list => MultiCurrencyScenarioArray.of(list))); }
public virtual void toMultiCurrencyArray() { IList <MultiCurrencyAmount> amounts = ImmutableList.of(MultiCurrencyAmount.of(CurrencyAmount.of(Currency.GBP, 20), CurrencyAmount.of(Currency.USD, 30), CurrencyAmount.of(Currency.EUR, 40)), MultiCurrencyAmount.of(CurrencyAmount.of(Currency.GBP, 21), CurrencyAmount.of(Currency.USD, 32), CurrencyAmount.of(Currency.EUR, 43)), MultiCurrencyAmount.of(CurrencyAmount.of(Currency.GBP, 22), CurrencyAmount.of(Currency.USD, 33), CurrencyAmount.of(Currency.EUR, 44))); MultiCurrencyScenarioArray expected = MultiCurrencyScenarioArray.of(amounts); //JAVA TO C# CONVERTER TODO TASK: Most Java stream collectors are not converted by Java to C# Converter: MultiCurrencyScenarioArray array = amounts.collect(FunctionUtils.toMultiCurrencyValuesArray()); assertThat(array).isEqualTo(expected); }
public virtual void test_pv01_quote() { FixedCouponBondTradeCalculationFunction <FixedCouponBondTrade> function = FixedCouponBondTradeCalculationFunction.TRADE; ScenarioMarketData md = marketData(); LegalEntityDiscountingProvider provider = LOOKUP.marketDataView(md.scenario(0)).discountingProvider(); DiscountingFixedCouponBondTradePricer pricer = DiscountingFixedCouponBondTradePricer.DEFAULT; PointSensitivities pvPointSens = pricer.presentValueSensitivity(RTRADE, provider); CurrencyParameterSensitivities pvParamSens = provider.parameterSensitivity(pvPointSens); CurrencyParameterSensitivities expectedPv01CalBucketed = MQ_CALC.sensitivity(pvParamSens, provider).multipliedBy(1e-4); MultiCurrencyAmount expectedPv01Cal = expectedPv01CalBucketed.total(); ISet <Measure> measures = ImmutableSet.of(Measures.PV01_MARKET_QUOTE_SUM, Measures.PV01_MARKET_QUOTE_BUCKETED); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: java.util.Map<com.opengamma.strata.calc.Measure, com.opengamma.strata.collect.result.Result<?>> computed = function.calculate(TRADE, measures, PARAMS, md, REF_DATA); IDictionary <Measure, Result <object> > computed = function.calculate(TRADE, measures, PARAMS, md, REF_DATA); MultiCurrencyScenarioArray sumComputed = (MultiCurrencyScenarioArray)computed[Measures.PV01_MARKET_QUOTE_SUM].Value; ScenarioArray <CurrencyParameterSensitivities> bucketedComputed = (ScenarioArray <CurrencyParameterSensitivities>)computed[Measures.PV01_MARKET_QUOTE_BUCKETED].Value; assertEquals(sumComputed.ScenarioCount, 1); assertEquals(sumComputed.get(0).Currencies, ImmutableSet.of(GBP)); assertTrue(DoubleMath.fuzzyEquals(sumComputed.get(0).getAmount(GBP).Amount, expectedPv01Cal.getAmount(GBP).Amount, 1.0e-10)); assertEquals(bucketedComputed.ScenarioCount, 1); assertTrue(bucketedComputed.get(0).equalWithTolerance(expectedPv01CalBucketed, 1.0e-10)); }
public virtual void test_simpleMeasures() { TermDepositTradeCalculationFunction function = new TermDepositTradeCalculationFunction(); ScenarioMarketData md = marketData(); RatesProvider provider = RATES_LOOKUP.ratesProvider(md.scenario(0)); DiscountingTermDepositTradePricer pricer = DiscountingTermDepositTradePricer.DEFAULT; CurrencyAmount expectedPv = pricer.presentValue(RTRADE, provider); double expectedParRate = pricer.parRate(RTRADE, provider); double expectedParSpread = pricer.parSpread(RTRADE, provider); MultiCurrencyAmount expectedCurrencyExposure = pricer.currencyExposure(RTRADE, provider); CurrencyAmount expectedCurrentCash = pricer.currentCash(RTRADE, provider); ISet <Measure> measures = ImmutableSet.of(Measures.PRESENT_VALUE, Measures.PAR_RATE, Measures.PAR_SPREAD, Measures.CURRENCY_EXPOSURE, Measures.CURRENT_CASH, Measures.RESOLVED_TARGET); assertThat(function.calculate(TRADE, measures, PARAMS, md, REF_DATA)).containsEntry(Measures.PRESENT_VALUE, Result.success(CurrencyScenarioArray.of(ImmutableList.of(expectedPv)))).containsEntry(Measures.PAR_RATE, Result.success(DoubleScenarioArray.of(ImmutableList.of(expectedParRate)))).containsEntry(Measures.PAR_SPREAD, Result.success(DoubleScenarioArray.of(ImmutableList.of(expectedParSpread)))).containsEntry(Measures.CURRENCY_EXPOSURE, Result.success(MultiCurrencyScenarioArray.of(ImmutableList.of(expectedCurrencyExposure)))).containsEntry(Measures.CURRENT_CASH, Result.success(CurrencyScenarioArray.of(ImmutableList.of(expectedCurrentCash)))).containsEntry(Measures.RESOLVED_TARGET, Result.success(RTRADE)); }
public virtual void test_pv01() { TermDepositTradeCalculationFunction function = new TermDepositTradeCalculationFunction(); ScenarioMarketData md = marketData(); RatesProvider provider = RATES_LOOKUP.ratesProvider(md.scenario(0)); DiscountingTermDepositProductPricer pricer = DiscountingTermDepositProductPricer.DEFAULT; ResolvedTermDeposit resolved = TRADE.Product.resolve(REF_DATA); PointSensitivities pvPointSens = pricer.presentValueSensitivity(resolved, provider); CurrencyParameterSensitivities pvParamSens = provider.parameterSensitivity(pvPointSens); MultiCurrencyAmount expectedPv01 = pvParamSens.total().multipliedBy(1e-4); CurrencyParameterSensitivities expectedBucketedPv01 = pvParamSens.multipliedBy(1e-4); ISet <Measure> measures = ImmutableSet.of(Measures.PV01_CALIBRATED_SUM, Measures.PV01_CALIBRATED_BUCKETED); assertThat(function.calculate(TRADE, measures, PARAMS, md, REF_DATA)).containsEntry(Measures.PV01_CALIBRATED_SUM, Result.success(MultiCurrencyScenarioArray.of(ImmutableList.of(expectedPv01)))).containsEntry(Measures.PV01_CALIBRATED_BUCKETED, Result.success(ScenarioArray.of(ImmutableList.of(expectedBucketedPv01)))); }
public virtual void test_curveSensitivityMeasures() { double oneBp = 1e-4; PointSensitivities pvPointSens = PRICER.presentValueSensitivity(RTRADE, RATES_PROVIDER, CreditDataSet.REF_DATA); CurrencyParameterSensitivities pvParamSens = RATES_PROVIDER.parameterSensitivity(pvPointSens); MultiCurrencyAmount expectedPv01Cal = pvParamSens.total().multipliedBy(oneBp); CurrencyParameterSensitivities expectedPv01CalBucketed = pvParamSens.multipliedBy(oneBp); CurrencyParameterSensitivity expectedCs01Bucketed = CS01_CALC.bucketedCs01(RTRADE, RATES_PROVIDER, CreditDataSet.REF_DATA); CurrencyAmount expectedCs01Parallel = CS01_CALC.parallelCs01(RTRADE, RATES_PROVIDER, CreditDataSet.REF_DATA); PointSensitivities pvPointSensOnSettle = PRICER.presentValueOnSettleSensitivity(RTRADE, RATES_PROVIDER, CreditDataSet.REF_DATA); CurrencyParameterSensitivity ir01 = RATES_PROVIDER.singleDiscountCurveParameterSensitivity(pvPointSensOnSettle, USD); CurrencyAmount expectedIr01Cal = ir01.total().multipliedBy(oneBp); CurrencyParameterSensitivity expectedIr01CalBucketed = ir01.multipliedBy(oneBp); ISet <Measure> measures = ImmutableSet.of(Measures.PV01_CALIBRATED_SUM, Measures.PV01_CALIBRATED_BUCKETED, CreditMeasures.CS01_PARALLEL, CreditMeasures.CS01_BUCKETED, CreditMeasures.IR01_CALIBRATED_PARALLEL, CreditMeasures.IR01_CALIBRATED_BUCKETED); assertThat(FUNCTION.calculate(TRADE, measures, CreditDataSet.CDS_PARAMS, CreditDataSet.MARKET_DATA, CreditDataSet.REF_DATA)).containsEntry(Measures.PV01_CALIBRATED_SUM, Result.success(MultiCurrencyScenarioArray.of(ImmutableList.of(expectedPv01Cal)))).containsEntry(Measures.PV01_CALIBRATED_BUCKETED, Result.success(ScenarioArray.of(ImmutableList.of(expectedPv01CalBucketed)))).containsEntry(CreditMeasures.CS01_PARALLEL, Result.success(CurrencyScenarioArray.of(ImmutableList.of(expectedCs01Parallel)))).containsEntry(CreditMeasures.CS01_BUCKETED, Result.success(ScenarioArray.of(ImmutableList.of(expectedCs01Bucketed)))).containsEntry(CreditMeasures.IR01_CALIBRATED_PARALLEL, Result.success(CurrencyScenarioArray.of(ImmutableList.of(expectedIr01Cal)))).containsEntry(CreditMeasures.IR01_CALIBRATED_BUCKETED, Result.success(ScenarioArray.of(ImmutableList.of(expectedIr01CalBucketed)))); }
public virtual void test_pv01() { FxVanillaOptionTradeCalculationFunction function = new FxVanillaOptionTradeCalculationFunction(); ScenarioMarketData md = marketData(); RatesProvider provider = RATES_LOOKUP.ratesProvider(md.scenario(0)); BlackFxVanillaOptionTradePricer pricer = BlackFxVanillaOptionTradePricer.DEFAULT; PointSensitivities pvPointSens = pricer.presentValueSensitivityRatesStickyStrike(RTRADE, provider, VOLS); CurrencyParameterSensitivities pvParamSens = provider.parameterSensitivity(pvPointSens); MultiCurrencyAmount expectedPv01 = pvParamSens.total().multipliedBy(1e-4); CurrencyParameterSensitivities expectedBucketedPv01 = pvParamSens.multipliedBy(1e-4); ISet <Measure> measures = ImmutableSet.of(Measures.PV01_CALIBRATED_SUM, Measures.PV01_CALIBRATED_BUCKETED); assertThat(function.calculate(TRADE, measures, PARAMS, md, REF_DATA)).containsEntry(Measures.PV01_CALIBRATED_SUM, Result.success(MultiCurrencyScenarioArray.of(ImmutableList.of(expectedPv01)))).containsEntry(Measures.PV01_CALIBRATED_BUCKETED, Result.success(ScenarioArray.of(ImmutableList.of(expectedBucketedPv01)))); }
public virtual void test_simpleMeasures() { FxVanillaOptionTradeCalculationFunction function = new FxVanillaOptionTradeCalculationFunction(); ScenarioMarketData md = marketData(); RatesProvider provider = RATES_LOOKUP.ratesProvider(md.scenario(0)); BlackFxVanillaOptionTradePricer pricer = BlackFxVanillaOptionTradePricer.DEFAULT; MultiCurrencyAmount expectedPv = pricer.presentValue(RTRADE, provider, VOLS); MultiCurrencyAmount expectedCurrencyExp = pricer.currencyExposure(RTRADE, provider, VOLS); CurrencyAmount expectedCash = pricer.currentCash(RTRADE, VAL_DATE); ISet <Measure> measures = ImmutableSet.of(Measures.PRESENT_VALUE, Measures.PAR_SPREAD, Measures.CURRENCY_EXPOSURE, Measures.CURRENT_CASH, Measures.RESOLVED_TARGET); assertThat(function.calculate(TRADE, measures, PARAMS, md, REF_DATA)).containsEntry(Measures.PRESENT_VALUE, Result.success(MultiCurrencyScenarioArray.of(ImmutableList.of(expectedPv)))).containsEntry(Measures.CURRENCY_EXPOSURE, Result.success(MultiCurrencyScenarioArray.of(ImmutableList.of(expectedCurrencyExp)))).containsEntry(Measures.CURRENT_CASH, Result.success(CurrencyScenarioArray.of(ImmutableList.of(expectedCash)))).containsEntry(Measures.RESOLVED_TARGET, Result.success(RTRADE)); }
//------------------------------------------------------------------------- // calculates present value for all scenarios internal MultiCurrencyScenarioArray presentValue(ResolvedSwapTrade trade, RatesScenarioMarketData marketData) { return(MultiCurrencyScenarioArray.of(marketData.ScenarioCount, i => presentValue(trade, marketData.scenario(i).ratesProvider()))); }
//------------------------------------------------------------------------- // calculates market quote sum PV01 for all scenarios internal MultiCurrencyScenarioArray pv01MarketQuoteSum(ResolvedFraTrade trade, RatesScenarioMarketData marketData) { return(MultiCurrencyScenarioArray.of(marketData.ScenarioCount, i => pv01MarketQuoteSum(trade, marketData.scenario(i).ratesProvider()))); }
public virtual void test_simpleMeasures() { IborCapFloorTradeCalculationFunction function = new IborCapFloorTradeCalculationFunction(); ScenarioMarketData md = marketData(); RatesProvider provider = RATES_LOOKUP.ratesProvider(md.scenario(0)); NormalIborCapFloorTradePricer pricer = NormalIborCapFloorTradePricer.DEFAULT; MultiCurrencyAmount expectedPv = pricer.presentValue(RTRADE, provider, VOLS); MultiCurrencyAmount expectedCurrencyExposure = pricer.currencyExposure(RTRADE, provider, VOLS); MultiCurrencyAmount expectedCurrentCash = pricer.currentCash(RTRADE, provider, VOLS); ISet <Measure> measures = ImmutableSet.of(Measures.PRESENT_VALUE, Measures.CURRENCY_EXPOSURE, Measures.CURRENT_CASH); assertThat(function.calculate(TRADE, measures, PARAMS, md, REF_DATA)).containsEntry(Measures.PRESENT_VALUE, Result.success(MultiCurrencyScenarioArray.of(ImmutableList.of(expectedPv)))).containsEntry(Measures.CURRENCY_EXPOSURE, Result.success(MultiCurrencyScenarioArray.of(ImmutableList.of(expectedCurrencyExposure)))).containsEntry(Measures.CURRENT_CASH, Result.success(MultiCurrencyScenarioArray.of(ImmutableList.of(expectedCurrentCash)))); }
public virtual void test_pv01_quote() { BillTradeCalculationFunction <BillTrade> function = BillTradeCalculationFunction.TRADE; ScenarioMarketData md = marketData(); LegalEntityDiscountingProvider provider = LOOKUP.marketDataView(md.scenario(0)).discountingProvider(); DiscountingBillTradePricer pricer = DiscountingBillTradePricer.DEFAULT; PointSensitivities pvPointSens = pricer.presentValueSensitivity(RTRADE, provider); CurrencyParameterSensitivities pvParamSens = provider.parameterSensitivity(pvPointSens); CurrencyParameterSensitivities expectedPv01CalBucketed = MQ_CALC.sensitivity(pvParamSens, provider).multipliedBy(1e-4); MultiCurrencyAmount expectedPv01Cal = expectedPv01CalBucketed.total(); ISet <Measure> measures = ImmutableSet.of(Measures.PV01_MARKET_QUOTE_SUM, Measures.PV01_MARKET_QUOTE_BUCKETED); assertThat(function.calculate(TRADE, measures, PARAMS, md, REF_DATA)).containsEntry(Measures.PV01_MARKET_QUOTE_SUM, Result.success(MultiCurrencyScenarioArray.of(ImmutableList.of(expectedPv01Cal)))).containsEntry(Measures.PV01_MARKET_QUOTE_BUCKETED, Result.success(ScenarioArray.of(ImmutableList.of(expectedPv01CalBucketed)))); }
public virtual void test_simpleMeasures() { BondFutureOptionTradeCalculationFunction <BondFutureOptionTrade> function = BondFutureOptionTradeCalculationFunction.TRADE; ScenarioMarketData md = marketData(); LegalEntityDiscountingProvider provider = LED_LOOKUP.marketDataView(md.scenario(0)).discountingProvider(); BlackBondFutureOptionMarginedTradePricer pricer = BlackBondFutureOptionMarginedTradePricer.DEFAULT; CurrencyAmount expectedPv = pricer.presentValue(RTRADE, provider, VOLS, SETTLE_PRICE); MultiCurrencyAmount expectedCurrencyExposure = pricer.currencyExposure(RTRADE, provider, VOLS, SETTLE_PRICE); ISet <Measure> measures = ImmutableSet.of(Measures.PRESENT_VALUE, Measures.CURRENCY_EXPOSURE, Measures.RESOLVED_TARGET); assertThat(function.calculate(TRADE, measures, PARAMS, md, REF_DATA)).containsEntry(Measures.PRESENT_VALUE, Result.success(CurrencyScenarioArray.of(ImmutableList.of(expectedPv)))).containsEntry(Measures.CURRENCY_EXPOSURE, Result.success(MultiCurrencyScenarioArray.of(ImmutableList.of(expectedCurrencyExposure)))).containsEntry(Measures.RESOLVED_TARGET, Result.success(RTRADE)); }
public virtual void test_simpleMeasures() { CapitalIndexedBondTradeCalculationFunction <CapitalIndexedBondTrade> function = CapitalIndexedBondTradeCalculationFunction.TRADE; ScenarioMarketData md = marketData(); RatesProvider ratesProvider = RATES_LOOKUP.marketDataView(md.scenario(0)).ratesProvider(); LegalEntityDiscountingProvider ledProvider = LED_LOOKUP.marketDataView(md.scenario(0)).discountingProvider(); DiscountingCapitalIndexedBondTradePricer pricer = DiscountingCapitalIndexedBondTradePricer.DEFAULT; CurrencyAmount expectedPv = pricer.presentValue(RTRADE, ratesProvider, ledProvider); MultiCurrencyAmount expectedCurrencyExposure = pricer.currencyExposure(RTRADE, ratesProvider, ledProvider); CurrencyAmount expectedCurrentCash = pricer.currentCash(RTRADE, ratesProvider); ISet <Measure> measures = ImmutableSet.of(Measures.PRESENT_VALUE, Measures.CURRENCY_EXPOSURE, Measures.CURRENT_CASH, Measures.RESOLVED_TARGET); assertThat(function.calculate(TRADE, measures, PARAMS, md, REF_DATA)).containsEntry(Measures.PRESENT_VALUE, Result.success(CurrencyScenarioArray.of(ImmutableList.of(expectedPv)))).containsEntry(Measures.CURRENCY_EXPOSURE, Result.success(MultiCurrencyScenarioArray.of(ImmutableList.of(expectedCurrencyExposure)))).containsEntry(Measures.CURRENT_CASH, Result.success(CurrencyScenarioArray.of(ImmutableList.of(expectedCurrentCash)))).containsEntry(Measures.RESOLVED_TARGET, Result.success(RTRADE)); }
public virtual void test_simpleMeasures() { CmsTradeCalculationFunction function = new CmsTradeCalculationFunction(); ScenarioMarketData md = marketData(); RatesProvider provider = RATES_LOOKUP.ratesProvider(md.scenario(0)); SabrExtrapolationReplicationCmsTradePricer pricer = new SabrExtrapolationReplicationCmsTradePricer(new SabrExtrapolationReplicationCmsProductPricer(new SabrExtrapolationReplicationCmsLegPricer(SabrExtrapolationReplicationCmsPeriodPricer.of(CUT_OFF_STRIKE, MU)))); ResolvedCmsTrade resolved = TRADE.resolve(REF_DATA); MultiCurrencyAmount expectedPv = pricer.presentValue(resolved, provider, VOLS); ISet <Measure> measures = ImmutableSet.of(Measures.PRESENT_VALUE, Measures.RESOLVED_TARGET); assertThat(function.calculate(TRADE, measures, PARAMS, md, REF_DATA)).containsEntry(Measures.PRESENT_VALUE, Result.success(MultiCurrencyScenarioArray.of(ImmutableList.of(expectedPv)))).containsEntry(Measures.RESOLVED_TARGET, Result.success(TRADE.resolve(REF_DATA))); }
public virtual void test_pv01() { CapitalIndexedBondTradeCalculationFunction <CapitalIndexedBondTrade> function = CapitalIndexedBondTradeCalculationFunction.TRADE; ScenarioMarketData md = marketData(); RatesProvider ratesProvider = RATES_LOOKUP.marketDataView(md.scenario(0)).ratesProvider(); LegalEntityDiscountingProvider ledProvider = LED_LOOKUP.marketDataView(md.scenario(0)).discountingProvider(); DiscountingCapitalIndexedBondTradePricer pricer = DiscountingCapitalIndexedBondTradePricer.DEFAULT; PointSensitivities pvPointSens = pricer.presentValueSensitivity(RTRADE, ratesProvider, ledProvider); CurrencyParameterSensitivities pvParamSens = ledProvider.parameterSensitivity(pvPointSens); MultiCurrencyAmount expectedPv01Cal = pvParamSens.total().multipliedBy(1e-4); CurrencyParameterSensitivities expectedPv01CalBucketed = pvParamSens.multipliedBy(1e-4); ISet <Measure> measures = ImmutableSet.of(Measures.PV01_CALIBRATED_SUM, Measures.PV01_CALIBRATED_BUCKETED); assertThat(function.calculate(TRADE, measures, PARAMS, md, REF_DATA)).containsEntry(Measures.PV01_CALIBRATED_SUM, Result.success(MultiCurrencyScenarioArray.of(ImmutableList.of(expectedPv01Cal)))).containsEntry(Measures.PV01_CALIBRATED_BUCKETED, Result.success(ScenarioArray.of(ImmutableList.of(expectedPv01CalBucketed)))); }
public virtual void test_simpleMeasures() { DsfTradeCalculationFunction <DsfTrade> function = DsfTradeCalculationFunction.TRADE; ScenarioMarketData md = marketData(); RatesProvider provider = RATES_LOOKUP.ratesProvider(md.scenario(0)); DiscountingDsfTradePricer pricer = DiscountingDsfTradePricer.DEFAULT; double expectedPrice = pricer.price(RTRADE, provider); CurrencyAmount expectedPv = pricer.presentValue(RTRADE, provider, REF_PRICE); MultiCurrencyAmount expectedCurrencyExposure = pricer.currencyExposure(RTRADE, provider, REF_PRICE); ISet <Measure> measures = ImmutableSet.of(Measures.UNIT_PRICE, Measures.PRESENT_VALUE, Measures.CURRENCY_EXPOSURE, Measures.RESOLVED_TARGET); assertThat(function.calculate(TRADE, measures, PARAMS, md, REF_DATA)).containsEntry(Measures.UNIT_PRICE, Result.success(DoubleScenarioArray.of(ImmutableList.of(expectedPrice)))).containsEntry(Measures.PRESENT_VALUE, Result.success(CurrencyScenarioArray.of(ImmutableList.of(expectedPv)))).containsEntry(Measures.CURRENCY_EXPOSURE, Result.success(MultiCurrencyScenarioArray.of(ImmutableList.of(expectedCurrencyExposure)))).containsEntry(Measures.RESOLVED_TARGET, Result.success(RTRADE)); }
//------------------------------------------------------------------------- // calculates currency exposure for all scenarios internal MultiCurrencyScenarioArray currencyExposure(ResolvedFraTrade trade, RatesScenarioMarketData marketData) { return(MultiCurrencyScenarioArray.of(marketData.ScenarioCount, i => currencyExposure(trade, marketData.scenario(i).ratesProvider()))); }
//------------------------------------------------------------------------- // calculates accrued interest for all scenarios internal MultiCurrencyScenarioArray accruedInterest(ResolvedSwapTrade trade, RatesScenarioMarketData marketData) { return(MultiCurrencyScenarioArray.of(marketData.ScenarioCount, i => accruedInterest(trade, marketData.scenario(i).ratesProvider()))); }