public virtual void test_trade_noMarketData() { IborFutureCurveNode node = IborFutureCurveNode.of(TEMPLATE, QUOTE_ID, SPREAD); MarketData marketData = MarketData.empty(VAL_DATE); assertThrows(() => node.trade(1d, marketData, REF_DATA), typeof(MarketDataNotFoundException)); }
public virtual void test_of_withSpreadAndLabel() { IborFutureCurveNode test = IborFutureCurveNode.of(TEMPLATE, QUOTE_ID, SPREAD, LABEL); assertEquals(test.RateId, QUOTE_ID); assertEquals(test.AdditionalSpread, SPREAD); assertEquals(test.Template, TEMPLATE); }
public virtual void test_of_no_spread() { IborFutureCurveNode test = IborFutureCurveNode.of(TEMPLATE, QUOTE_ID); assertEquals(test.RateId, QUOTE_ID); assertEquals(test.AdditionalSpread, 0.0d); assertEquals(test.Template, TEMPLATE); }
//------------------------------------------------------------------------- public virtual void coverage() { IborFutureCurveNode test = IborFutureCurveNode.of(TEMPLATE, QUOTE_ID, SPREAD); coverImmutableBean(test); IborFutureCurveNode test2 = IborFutureCurveNode.of(IborFutureTemplate.of(PERIOD_TO_START, NUMBER, CONVENTION), QuoteId.of(StandardId.of("OG-Ticker", "Unknown"))); coverBeanEquals(test, test2); }
public virtual void test_metadata_fixed() { LocalDate nodeDate = VAL_DATE.plusMonths(1); IborFutureCurveNode node = IborFutureCurveNode.of(TEMPLATE, QUOTE_ID, SPREAD, 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_trade() { IborFutureCurveNode node = IborFutureCurveNode.of(TEMPLATE, QUOTE_ID, SPREAD); double price = 0.99; MarketData marketData = ImmutableMarketData.builder(VAL_DATE).addValue(QUOTE_ID, price).build(); IborFutureTrade trade = node.trade(1d, marketData, REF_DATA); IborFutureTrade expected = TEMPLATE.createTrade(VAL_DATE, SecurityId.of(STANDARD_ID), 1L, 1.0, price + SPREAD, REF_DATA); assertEquals(trade, expected); }
public virtual void test_requirements() { IborFutureCurveNode test = IborFutureCurveNode.of(TEMPLATE, QUOTE_ID, SPREAD); ISet <ObservableId> set = test.requirements(); IEnumerator <ObservableId> itr = set.GetEnumerator(); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertEquals(itr.next(), QUOTE_ID); //JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops: assertFalse(itr.hasNext()); }
public virtual void test_metadata_last_fixing() { IborFutureCurveNode node = IborFutureCurveNode.of(TEMPLATE, QUOTE_ID, SPREAD, LABEL).withDate(CurveNodeDate.LAST_FIXING); ImmutableMarketData marketData = ImmutableMarketData.builder(VAL_DATE).addValue(QUOTE_ID, 0.0d).build(); IborFutureTrade trade = node.trade(1d, marketData, REF_DATA); LocalDate fixingDate = trade.Product.FixingDate; DatedParameterMetadata metadata = node.metadata(VAL_DATE, REF_DATA); assertEquals(metadata.Date, fixingDate); LocalDate referenceDate = TEMPLATE.calculateReferenceDateFromTradeDate(VAL_DATE, REF_DATA); assertEquals(((YearMonthDateParameterMetadata)metadata).YearMonth, YearMonth.from(referenceDate)); }
public virtual void test_metadata_end() { IborFutureCurveNode node = IborFutureCurveNode.of(TEMPLATE, QUOTE_ID, SPREAD, LABEL); LocalDate date = LocalDate.of(2015, 10, 20); LocalDate referenceDate = TEMPLATE.calculateReferenceDateFromTradeDate(date, REF_DATA); LocalDate maturityDate = TEMPLATE.Index.calculateMaturityFromEffective(referenceDate, REF_DATA); ParameterMetadata metadata = node.metadata(date, REF_DATA); assertEquals(metadata.Label, LABEL); assertTrue(metadata is YearMonthDateParameterMetadata); assertEquals(((YearMonthDateParameterMetadata)metadata).Date, maturityDate); assertEquals(((YearMonthDateParameterMetadata)metadata).YearMonth, YearMonth.from(referenceDate)); }
public virtual void test_initialGuess() { IborFutureCurveNode node = IborFutureCurveNode.of(TEMPLATE, QUOTE_ID, SPREAD); double price = 0.99; MarketData marketData = ImmutableMarketData.builder(VAL_DATE).addValue(QUOTE_ID, price).build(); assertEquals(node.initialGuess(marketData, ValueType.ZERO_RATE), 1.0 - price, TOLERANCE_RATE); assertEquals(node.initialGuess(marketData, ValueType.FORWARD_RATE), 1.0 - price, TOLERANCE_RATE); double approximateMaturity = TEMPLATE.approximateMaturity(VAL_DATE); double df = Math.Exp(-approximateMaturity * (1.0 - price)); assertEquals(node.initialGuess(marketData, ValueType.DISCOUNT_FACTOR), df, TOLERANCE_RATE); assertEquals(node.initialGuess(marketData, ValueType.UNKNOWN), 0.0d, TOLERANCE_RATE); }
public virtual void test_serialization() { IborFutureCurveNode test = IborFutureCurveNode.of(TEMPLATE, QUOTE_ID, SPREAD); assertSerialization(test); }