public virtual void test_trade_noMarketData() { XCcyIborIborSwapCurveNode node = XCcyIborIborSwapCurveNode.of(TEMPLATE, SPREAD_ID, SPREAD_ADJ); MarketData marketData = MarketData.empty(VAL_DATE); assertThrows(() => node.trade(1d, marketData, REF_DATA), typeof(MarketDataNotFoundException)); }
public virtual void test_initialGuess() { XCcyIborIborSwapCurveNode node = XCcyIborIborSwapCurveNode.of(TEMPLATE, SPREAD_ID, SPREAD_ADJ); assertEquals(node.initialGuess(MARKET_DATA, ValueType.ZERO_RATE), 0d); assertEquals(node.initialGuess(MARKET_DATA, ValueType.DISCOUNT_FACTOR), 1.0d); }
//------------------------------------------------------------------------- public virtual void coverage() { XCcyIborIborSwapCurveNode test = XCcyIborIborSwapCurveNode.of(TEMPLATE, SPREAD_ID, SPREAD_ADJ); coverImmutableBean(test); XCcyIborIborSwapCurveNode test2 = XCcyIborIborSwapCurveNode.builder().label(LABEL).template(TEMPLATE2).fxRateId(FX_RATE_ID2).spreadId(SPREAD_ID2).additionalSpread(0.1).date(CurveNodeDate.LAST_FIXING).build(); coverBeanEquals(test, test2); }
public virtual void test_metadata_fixed() { LocalDate nodeDate = VAL_DATE.plusMonths(1); XCcyIborIborSwapCurveNode node = XCcyIborIborSwapCurveNode.of(TEMPLATE, SPREAD_ID, SPREAD_ADJ, LABEL).withDate(CurveNodeDate.of(nodeDate)); DatedParameterMetadata metadata = node.metadata(VAL_DATE, REF_DATA); assertEquals(metadata.Date, nodeDate); assertEquals(metadata.Label, node.Label); }
public virtual void test_of_withSpreadAndLabel() { XCcyIborIborSwapCurveNode test = XCcyIborIborSwapCurveNode.of(TEMPLATE, SPREAD_ID, SPREAD_ADJ, LABEL); assertEquals(test.Label, LABEL); assertEquals(test.SpreadId, SPREAD_ID); assertEquals(test.AdditionalSpread, SPREAD_ADJ); assertEquals(test.Template, TEMPLATE); }
public virtual void test_of_noSpread() { XCcyIborIborSwapCurveNode test = XCcyIborIborSwapCurveNode.of(TEMPLATE, SPREAD_ID); assertEquals(test.Label, LABEL_AUTO); assertEquals(test.SpreadId, SPREAD_ID); assertEquals(test.AdditionalSpread, 0.0d); assertEquals(test.Template, TEMPLATE); }
public virtual void test_builder_defaults() { XCcyIborIborSwapCurveNode test = XCcyIborIborSwapCurveNode.builder().template(TEMPLATE).spreadId(SPREAD_ID).build(); assertEquals(test.Label, LABEL_AUTO); assertEquals(test.FxRateId, FX_RATE_ID); assertEquals(test.SpreadId, SPREAD_ID); assertEquals(test.Template, TEMPLATE); assertEquals(test.Date, CurveNodeDate.END); }
public virtual void test_metadata_last_fixing() { XCcyIborIborSwapCurveNode node = XCcyIborIborSwapCurveNode.of(TEMPLATE, SPREAD_ID, SPREAD_ADJ, LABEL).withDate(CurveNodeDate.LAST_FIXING); LocalDate valuationDate = LocalDate.of(2015, 1, 22); DatedParameterMetadata metadata = node.metadata(valuationDate, REF_DATA); LocalDate fixingExpected = LocalDate.of(2024, 10, 24); assertEquals(metadata.Date, fixingExpected); assertEquals(((TenorDateParameterMetadata)metadata).Tenor, TENOR_10Y); }
public virtual void test_metadata_end() { XCcyIborIborSwapCurveNode node = XCcyIborIborSwapCurveNode.of(TEMPLATE, SPREAD_ID, SPREAD_ADJ); LocalDate valuationDate = LocalDate.of(2015, 1, 22); ParameterMetadata metadata = node.metadata(valuationDate, REF_DATA); // 2015-01-22 is Thursday, start is 2015-01-26, but 2025-01-26 is Sunday, so end is 2025-01-27 assertEquals(((TenorDateParameterMetadata)metadata).Date, LocalDate.of(2025, 1, 27)); assertEquals(((TenorDateParameterMetadata)metadata).Tenor, Tenor.TENOR_10Y); }
//------------------------------------------------------------------------- public virtual void test_builder() { XCcyIborIborSwapCurveNode test = XCcyIborIborSwapCurveNode.builder().label(LABEL).template(TEMPLATE).fxRateId(FX_RATE_ID2).spreadId(SPREAD_ID).additionalSpread(SPREAD_ADJ).build(); assertEquals(test.Label, LABEL); assertEquals(test.FxRateId, FX_RATE_ID2); assertEquals(test.SpreadId, SPREAD_ID); assertEquals(test.AdditionalSpread, SPREAD_ADJ); assertEquals(test.Template, TEMPLATE); assertEquals(test.Date, CurveNodeDate.END); }
public virtual void test_trade() { XCcyIborIborSwapCurveNode node = XCcyIborIborSwapCurveNode.of(TEMPLATE, SPREAD_ID, SPREAD_ADJ); double quantity = -1234.56; SwapTrade trade = node.trade(quantity, MARKET_DATA, REF_DATA); double rate = FX_EUR_USD.fxRate(Currency.EUR, Currency.USD); SwapTrade expected = TEMPLATE.createTrade(VAL_DATE, BUY, -quantity, rate, SPREAD_XCS + SPREAD_ADJ, REF_DATA); assertEquals(trade, expected); assertEquals(node.resolvedTrade(quantity, MARKET_DATA, REF_DATA), trade.resolve(REF_DATA)); }
public virtual void test_requirements() { XCcyIborIborSwapCurveNode test = XCcyIborIborSwapCurveNode.of(TEMPLATE, SPREAD_ID, SPREAD_ADJ); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: java.util.Set<? extends com.opengamma.strata.data.MarketDataId<?>> setExpected = com.google.common.collect.ImmutableSet.of(SPREAD_ID, FX_RATE_ID); ISet <MarketDataId <object> > setExpected = ImmutableSet.of(SPREAD_ID, FX_RATE_ID); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: java.util.Set<? extends com.opengamma.strata.data.MarketDataId<?>> set = test.requirements(); ISet <MarketDataId <object> > set = test.requirements(); assertTrue(set.SetEquals(setExpected)); }
public override bool Equals(object obj) { if (obj == this) { return(true); } if (obj != null && obj.GetType() == this.GetType()) { XCcyIborIborSwapCurveNode other = (XCcyIborIborSwapCurveNode)obj; return(JodaBeanUtils.equal(template, other.template) && JodaBeanUtils.equal(fxRateId, other.fxRateId) && JodaBeanUtils.equal(spreadId, other.spreadId) && JodaBeanUtils.equal(additionalSpread, other.additionalSpread) && JodaBeanUtils.equal(label, other.label) && JodaBeanUtils.equal(date_Renamed, other.date_Renamed) && JodaBeanUtils.equal(dateOrder, other.dateOrder)); } return(false); }
public virtual void test_serialization() { XCcyIborIborSwapCurveNode test = XCcyIborIborSwapCurveNode.of(TEMPLATE, SPREAD_ID, SPREAD_ADJ); assertSerialization(test); }
public virtual void test_builder_noTemplate() { assertThrowsIllegalArg(() => XCcyIborIborSwapCurveNode.builder().label(LABEL).spreadId(SPREAD_ID).build()); }