public virtual void bucketedCs01SingleNodeCurveTest() { ImmutableCreditRatesProvider ratesProviderNoCredit = ImmutableCreditRatesProvider.builder().valuationDate(VALUATION_DATE).recoveryRateCurves(ImmutableMap.of(LEGAL_ENTITY, RECOVERY_CURVE)).discountCurves(ImmutableMap.of(USD, YIELD_CURVE)).build(); QuoteId quoteId = QuoteId.of(StandardId.of("OG", END2.ToString())); CdsIsdaCreditCurveNode node = CdsIsdaCreditCurveNode.ofParSpread(DatesCdsTemplate.of(START, END2, CDS_CONV), quoteId, LEGAL_ENTITY); ImmutableMarketData marketData = ImmutableMarketData.builder(VALUATION_DATE).addValue(quoteId, DEAL_SPREAD * ONE_BP).build(); IsdaCreditCurveDefinition definition = IsdaCreditCurveDefinition.of(CREDIT_CURVE_NAME, USD, VALUATION_DATE, ACT_365F, ImmutableList.of(node), true, false); LegalEntitySurvivalProbabilities creditCurve = BUILDER.calibrate(definition, marketData, ratesProviderNoCredit, REF_DATA); ImmutableCreditRatesProvider ratesProvider = ImmutableCreditRatesProvider.builder().valuationDate(VALUATION_DATE).recoveryRateCurves(ImmutableMap.of(LEGAL_ENTITY, RECOVERY_CURVE)).discountCurves(ImmutableMap.of(USD, YIELD_CURVE)).creditCurves(ImmutableMap.of(Pair.of(LEGAL_ENTITY, USD), creditCurve)).build(); double[] expectedFd = new double[] { -6.876275937539589E-4, 1.1832215762730414E-4, 0.0012340982402658796, 0.002784985575488008, 0.005287295115619095, 2429.636217554099, 3101.303324461041 }; CurrencyParameterSensitivity analytic = CS01_AN.bucketedCs01(CDS2, ImmutableList.copyOf(MARKET_CDS), ratesProvider, REF_DATA); CurrencyParameterSensitivity fd = CS01_FD.bucketedCs01(CDS2, ImmutableList.copyOf(MARKET_CDS), ratesProvider, REF_DATA); assertEquals(fd.Currency, USD); assertEquals(fd.MarketDataName, CurveName.of("impliedSpreads")); assertEquals(fd.ParameterCount, NUM_MARKET_CDS); assertEquals(fd.ParameterMetadata, CDS_METADATA); assertTrue(DoubleArrayMath.fuzzyEquals(fd.Sensitivity.multipliedBy(ONE_BP).toArray(), expectedFd, NOTIONAL * TOL)); assertEquals(analytic.Currency, USD); assertEquals(analytic.MarketDataName, CurveName.of("impliedSpreads")); assertEquals(analytic.ParameterCount, NUM_MARKET_CDS); assertEquals(analytic.ParameterMetadata, CDS_METADATA); assertTrue(DoubleArrayMath.fuzzyEquals(analytic.Sensitivity.toArray(), fd.Sensitivity.toArray(), NOTIONAL * ONE_BP * 10d)); }
public virtual void test_parse() { EtdContractSpecId test = EtdContractSpecId.parse("A~B"); assertEquals(test.StandardId, StandardId.of("A", "B")); assertEquals(test.ToString(), "A~B"); }
public virtual void getMarketDataKey() { QuoteId quoteId = QuoteId.of(StandardId.of("test", "1"), FieldName.of("fieldName"), ObservableSource.NONE); assertThat(KEY.MarketDataId).isEqualTo(quoteId); assertThat(QuoteScenarioArrayId.of(quoteId)).isEqualTo(KEY); }
public virtual void test_of() { EtdContractSpecId test = EtdContractSpecId.of(StandardId.of("A", "B")); assertEquals(test.StandardId, StandardId.of("A", "B")); assertEquals(test.ReferenceDataType, typeof(EtdContractSpec)); assertEquals(test.ToString(), "A~B"); }
//------------------------------------------------------------------------- public virtual void coverage() { CreditCurveZeroRateSensitivity test = CreditCurveZeroRateSensitivity.of(LEGAL_ENTITY, GBP, YEAR_FRACTION, 32d); coverImmutableBean(test); CreditCurveZeroRateSensitivity test2 = CreditCurveZeroRateSensitivity.of(StandardId.of("OG", "AAA"), USD, YEAR_FRACTION, 16d); coverBeanEquals(test, test2); }
static IsdaHomogenousCdsIndexTradePricerTest() { ImmutableList.Builder <StandardId> builder = ImmutableList.builder(); for (int i = 0; i < 97; ++i) { builder.add(StandardId.of("OG", i.ToString())); } LEGAL_ENTITIES = builder.build(); }
//------------------------------------------------------------------------- public virtual void coverage() { ConstantRecoveryRates test1 = ConstantRecoveryRates.of(LEGAL_ENTITY, VALUATION, RECOVERY_RATE); coverImmutableBean(test1); ConstantRecoveryRates test2 = ConstantRecoveryRates.of(StandardId.of("OG", "DEF"), DATE_AFTER, 0.2d); coverBeanEquals(test1, test2); }
//------------------------------------------------------------------------- public virtual void test_summary_trade() { StandardId id = StandardId.of("X", "Y"); Trade trade = new TradeAnonymousInnerClass(this, id); string description = "desc"; PortfolioItemSummary expected = PortfolioItemSummary.of(id, PortfolioItemType.TRADE, ProductType.FRA, ImmutableSet.of(GBP), description); assertEquals(SummarizerUtils.summary(trade, ProductType.FRA, description, GBP), expected); }
public virtual void coverage() { Quote test = Quote.of(QUOTE_ID_1, 1.234); coverImmutableBean(test); Quote test2 = Quote.of(QuoteId.of(StandardId.of("a", "b")), 4.321); coverBeanEquals(test, test2); }
//------------------------------------------------------------------------- public virtual void coverage() { TradeInfo test = TradeInfo.builder().addAttribute(AttributeType.DESCRIPTION, "A").counterparty(COUNTERPARTY).tradeDate(date(2014, 6, 20)).tradeTime(LocalTime.MIDNIGHT).zone(ZoneId.systemDefault()).settlementDate(date(2014, 6, 20)).build(); coverImmutableBean(test); TradeInfo test2 = TradeInfo.builder().id(StandardId.of("OG-Id", "1")).counterparty(StandardId.of("OG-Party", "Other2")).tradeDate(date(2014, 6, 21)).tradeTime(LocalTime.NOON).zone(ZoneOffset.UTC).settlementDate(date(2014, 6, 21)).build(); coverBeanEquals(test, test2); }
//------------------------------------------------------------------------- public virtual void test_summary_position() { StandardId id = StandardId.of("X", "Y"); SecurityPosition position = SecurityPosition.builder().securityId(SecurityId.of("A", "B")).longQuantity(123).info(PositionInfo.of(id)).build(); string description = "desc"; PortfolioItemSummary expected = PortfolioItemSummary.of(id, PortfolioItemType.POSITION, ProductType.SECURITY, ImmutableSet.of(GBP), description); assertEquals(SummarizerUtils.summary(position, ProductType.SECURITY, description, GBP), expected); }
//------------------------------------------------------------------------- public virtual void coverage() { CdsIsdaCreditCurveNode test1 = CdsIsdaCreditCurveNode.ofQuotedSpread(TEMPLATE, QUOTE_ID, LEGAL_ENTITY, 0.01); coverImmutableBean(test1); CdsIsdaCreditCurveNode test2 = CdsIsdaCreditCurveNode.ofPointsUpfront(TenorCdsTemplate.of(TENOR_10Y, CdsConventions.EUR_GB_STANDARD), QuoteId.of(StandardId.of("OG-Ticker", "Cds2")), StandardId.of("OG", "DEF"), 0.01); QuoteId.of(StandardId.of("OG-Ticker", "Deposit2")); coverBeanEquals(test1, test2); }
public virtual void test_of_3args() { IndexQuoteId test = IndexQuoteId.of(GBP_SONIA, FIELD, OBS_SOURCE); assertEquals(test.Index, GBP_SONIA); assertEquals(test.FieldName, FIELD); assertEquals(test.ObservableSource, OBS_SOURCE); assertEquals(test.StandardId, StandardId.of("OG-Index", GBP_SONIA.Name)); assertEquals(test.MarketDataType, typeof(Double)); assertEquals(test.ToString(), "IndexQuoteId:GBP-SONIA/Field/Vendor"); }
//------------------------------------------------------------------------- public virtual void test_of_1arg() { IndexQuoteId test = IndexQuoteId.of(GBP_SONIA); assertEquals(test.Index, GBP_SONIA); assertEquals(test.FieldName, FieldName.MARKET_VALUE); assertEquals(test.ObservableSource, ObservableSource.NONE); assertEquals(test.StandardId, StandardId.of("OG-Index", GBP_SONIA.Name)); assertEquals(test.MarketDataType, typeof(Double)); assertEquals(test.ToString(), "IndexQuoteId:GBP-SONIA/MarketValue"); }
static FxOptionVolatilitiesDefinitionTest() { ImmutableList.Builder <FxOptionVolatilitiesNode> builder = ImmutableList.builder(); ImmutableList.Builder <QuoteId> quoteBuilder = ImmutableList.builder(); for (int i = 0; i < TENORS.size(); ++i) { QuoteId id = QuoteId.of(StandardId.of("OG", TENORS.get(i).ToString() + "_" + DELTAS.get(i).ToString() + "_" + QUOTE_TYPE.get(i).ToString())); builder.add(FxOptionVolatilitiesNode.of(EUR_GBP, SPOT_OFFSET, BUS_ADJ, QUOTE_TYPE.get(i), id, TENORS.get(i), DeltaStrike.of(DELTAS.get(i)))); quoteBuilder.add(id); } NODES = builder.build(); QUOTE_IDS = quoteBuilder.build(); }
//------------------------------------------------------------------------- public virtual void test_equalsHashCode() { EtdContractSpecId a = EtdContractSpecId.of(StandardId.of("A", "B")); EtdContractSpecId a2 = EtdContractSpecId.of(StandardId.of("A", "B")); EtdContractSpecId b = EtdContractSpecId.of(StandardId.of("C", "D")); assertEquals(a.GetHashCode(), a2.GetHashCode()); assertEquals(a.Equals(a), true); assertEquals(a.Equals(a2), true); assertEquals(a.Equals(b), false); assertEquals(a.Equals(null), false); assertEquals(a.Equals(ANOTHER_TYPE), false); }
static CreditDataSet() { ImmutableList.Builder <StandardId> builder = ImmutableList.builder(); for (int i = 0; i < 97; ++i) { builder.add(StandardId.of("OG", i.ToString())); } LEGAL_ENTITIES = builder.build(); double flatRate = 0.05; double t = 20.0; IsdaCreditDiscountFactors yieldCurve = IsdaCreditDiscountFactors.of(USD, VALUATION_DATE, CurveName.of("discount"), DoubleArray.of(t), DoubleArray.of(flatRate), ACT_365F); DISCOUNT_CURVE = yieldCurve.Curve; RecoveryRates recoveryRate = ConstantRecoveryRates.of(LEGAL_ENTITY, VALUATION_DATE, RECOVERY_RATE); // create the curve nodes and input market quotes ImmutableMarketDataBuilder marketQuoteBuilder = ImmutableMarketData.builder(VALUATION_DATE); ImmutableList.Builder <CdsIsdaCreditCurveNode> nodesBuilder = ImmutableList.builder(); ImmutableList.Builder <ResolvedTradeParameterMetadata> cdsMetadataBuilder = ImmutableList.builder(); ImmutableList.Builder <ResolvedTradeParameterMetadata> cdsIndexMetadataBuilder = ImmutableList.builder(); for (int i = 0; i < NUM_MARKET_CDS; i++) { QuoteId quoteId = QuoteId.of(StandardId.of("OG", PAR_SPD_DATES[i].ToString())); CdsIsdaCreditCurveNode node = CdsIsdaCreditCurveNode.ofParSpread(DatesCdsTemplate.of(VALUATION_DATE, PAR_SPD_DATES[i], CDS_CONV), quoteId, LEGAL_ENTITY); MARKET_CDS[i] = CdsTrade.builder().product(Cds.of(BUY, LEGAL_ENTITY, USD, NOTIONAL, VALUATION_DATE, PAR_SPD_DATES[i], P3M, SAT_SUN, PAR_SPREADS[i] * ONE_BP)).info(TradeInfo.of(VALUATION_DATE)).build().resolve(REF_DATA); MARKET_CDS_INDEX[i] = CdsIndexTrade.builder().product(CdsIndex.of(BuySell.BUY, INDEX_ID, LEGAL_ENTITIES, USD, NOTIONAL, VALUATION_DATE, PAR_SPD_DATES[i], P3M, SAT_SUN, PAR_SPREADS[i] * ONE_BP)).info(TradeInfo.of(VALUATION_DATE)).build().resolve(REF_DATA); marketQuoteBuilder.addValue(quoteId, PAR_SPREADS[i] * ONE_BP); nodesBuilder.add(node); cdsMetadataBuilder.add(ResolvedTradeParameterMetadata.of(MARKET_CDS[i], MARKET_CDS[i].Product.ProtectionEndDate.ToString())); cdsIndexMetadataBuilder.add(ResolvedTradeParameterMetadata.of(MARKET_CDS_INDEX[i], MARKET_CDS_INDEX[i].Product.ProtectionEndDate.ToString())); } ImmutableMarketData marketQuotes = marketQuoteBuilder.build(); ImmutableList <CdsIsdaCreditCurveNode> nodes = nodesBuilder.build(); CDS_METADATA = cdsMetadataBuilder.build(); CDS_INDEX_METADATA = cdsIndexMetadataBuilder.build(); ImmutableCreditRatesProvider rates = ImmutableCreditRatesProvider.builder().valuationDate(VALUATION_DATE).recoveryRateCurves(ImmutableMap.of(LEGAL_ENTITY, recoveryRate)).discountCurves(ImmutableMap.of(USD, yieldCurve)).build(); IsdaCreditCurveDefinition definition = IsdaCreditCurveDefinition.of(CREDIT_CURVE_NAME, USD, VALUATION_DATE, ACT_365F, nodes, true, true); // calibrate LegalEntitySurvivalProbabilities calibrated = BUILDER.calibrate(definition, marketQuotes, rates, REF_DATA); NodalCurve underlyingCurve = ((IsdaCreditDiscountFactors)calibrated.SurvivalProbabilities).Curve; CDS_CREDIT_CURVE = underlyingCurve; INDEX_CREDIT_CURVE = underlyingCurve.withMetadata(underlyingCurve.Metadata.withInfo(CurveInfoType.CDS_INDEX_FACTOR, INDEX_FACTOR).withParameterMetadata(CDS_INDEX_METADATA)); // replace parameter metadata CDS_RECOVERY_RATE = ConstantCurve.of(Curves.recoveryRates("CDS recovery rate", ACT_365F), RECOVERY_RATE); INDEX_RECOVERY_RATE = ConstantCurve.of(Curves.recoveryRates("Index recovery rate", ACT_365F), RECOVERY_RATE); }
//------------------------------------------------------------------------- public virtual void coverage() { BlackFxOptionSmileVolatilitiesSpecification test1 = BlackFxOptionSmileVolatilitiesSpecification.builder().name(VOL_NAME).currencyPair(EUR_GBP).dayCount(ACT_360).nodes(NODES).timeInterpolator(PCHIP).timeExtrapolatorLeft(LINEAR).timeExtrapolatorRight(LINEAR).strikeInterpolator(PCHIP).strikeExtrapolatorLeft(LINEAR).strikeExtrapolatorRight(LINEAR).build(); coverImmutableBean(test1); CurrencyPair eurUsd = CurrencyPair.of(EUR, USD); ImmutableList.Builder <FxOptionVolatilitiesNode> builder = ImmutableList.builder(); for (int i = 0; i < TENORS.size(); ++i) { QuoteId id = QuoteId.of(StandardId.of("OG", TENORS.get(i).ToString() + "_" + DELTAS.get(i).ToString() + "_" + QUOTE_TYPE.get(i).ToString())); builder.add(FxOptionVolatilitiesNode.of(eurUsd, DaysAdjustment.NONE, BusinessDayAdjustment.NONE, QUOTE_TYPE.get(i), id, TENORS.get(i), DeltaStrike.of(DELTAS.get(i)))); } BlackFxOptionSmileVolatilitiesSpecification test2 = BlackFxOptionSmileVolatilitiesSpecification.builder().name(FxOptionVolatilitiesName.of("other")).currencyPair(eurUsd).dayCount(ACT_365F).nodes(builder.build()).timeInterpolator(DOUBLE_QUADRATIC).strikeInterpolator(DOUBLE_QUADRATIC).build(); coverBeanEquals(test1, test2); }
public virtual void test_getter() { ImmutableCreditRatesProvider test = ImmutableCreditRatesProvider.builder().valuationDate(VALUATION).creditCurves(ImmutableMap.of(Pair.of(LEGAL_ENTITY_ABC, USD), LegalEntitySurvivalProbabilities.of(LEGAL_ENTITY_ABC, CRD_ABC_USD), Pair.of(LEGAL_ENTITY_ABC, JPY), LegalEntitySurvivalProbabilities.of(LEGAL_ENTITY_ABC, CRD_ABC_JPY), Pair.of(LEGAL_ENTITY_DEF, JPY), LegalEntitySurvivalProbabilities.of(LEGAL_ENTITY_DEF, CRD_DEF))).discountCurves(ImmutableMap.of(USD, DSC_USD, JPY, DSC_JPY)).recoveryRateCurves(ImmutableMap.of(LEGAL_ENTITY_ABC, RR_ABC, LEGAL_ENTITY_DEF, RR_DEF)).build(); assertEquals(test.discountFactors(USD), DSC_USD); assertEquals(test.discountFactors(JPY), DSC_JPY); assertEquals(test.survivalProbabilities(LEGAL_ENTITY_ABC, USD), LegalEntitySurvivalProbabilities.of(LEGAL_ENTITY_ABC, CRD_ABC_USD)); assertEquals(test.survivalProbabilities(LEGAL_ENTITY_ABC, JPY), LegalEntitySurvivalProbabilities.of(LEGAL_ENTITY_ABC, CRD_ABC_JPY)); assertEquals(test.survivalProbabilities(LEGAL_ENTITY_DEF, JPY), LegalEntitySurvivalProbabilities.of(LEGAL_ENTITY_DEF, CRD_DEF)); assertEquals(test.recoveryRates(LEGAL_ENTITY_ABC), RR_ABC); assertEquals(test.recoveryRates(LEGAL_ENTITY_DEF), RR_DEF); StandardId entity = StandardId.of("OG", "NONE"); assertThrowsIllegalArg(() => test.discountFactors(EUR)); assertThrowsIllegalArg(() => test.survivalProbabilities(LEGAL_ENTITY_DEF, USD)); assertThrowsIllegalArg(() => test.survivalProbabilities(entity, USD)); assertThrowsIllegalArg(() => test.recoveryRates(entity)); }
static SpreadSensitivityCalculatorTest() { double flatRate = 0.05; double t = 20.0; YIELD_CURVE = IsdaCreditDiscountFactors.of(USD, VALUATION_DATE, CurveName.of("discount"), DoubleArray.of(t), DoubleArray.of(flatRate), ACT_365F); ImmutableMarketDataBuilder dataBuilder = ImmutableMarketData.builder(VALUATION_DATE); ImmutableList.Builder <CdsIsdaCreditCurveNode> nodesBuilder = ImmutableList.builder(); ImmutableList.Builder <ResolvedTradeParameterMetadata> cdsMetadataBuilder = ImmutableList.builder(); ImmutableList.Builder <ResolvedTradeParameterMetadata> cdsIndexMetadataBuilder = ImmutableList.builder(); for (int i = 0; i < NUM_MARKET_CDS; i++) { QuoteId quoteId = QuoteId.of(StandardId.of("OG", PAR_SPD_DATES[i].ToString())); CdsIsdaCreditCurveNode node = CdsIsdaCreditCurveNode.ofParSpread(DatesCdsTemplate.of(VALUATION_DATE, PAR_SPD_DATES[i], CDS_CONV), quoteId, LEGAL_ENTITY); MARKET_CDS[i] = CdsTrade.builder().product(Cds.of(BUY, LEGAL_ENTITY, USD, NOTIONAL, VALUATION_DATE, PAR_SPD_DATES[i], P3M, SAT_SUN, PAR_SPREADS[i] * ONE_BP)).info(TradeInfo.of(VALUATION_DATE)).build().resolve(REF_DATA); MARKET_CDS_INDEX[i] = CdsIndexTrade.builder().product(CdsIndex.of(BuySell.BUY, INDEX_ID, LEGAL_ENTITIES, USD, NOTIONAL, VALUATION_DATE, PAR_SPD_DATES[i], P3M, SAT_SUN, PAR_SPREADS[i] * ONE_BP)).info(TradeInfo.of(VALUATION_DATE)).build().resolve(REF_DATA); dataBuilder.addValue(quoteId, PAR_SPREADS[i] * ONE_BP); nodesBuilder.add(node); cdsMetadataBuilder.add(ResolvedTradeParameterMetadata.of(MARKET_CDS[i], MARKET_CDS[i].Product.ProtectionEndDate.ToString())); cdsIndexMetadataBuilder.add(ResolvedTradeParameterMetadata.of(MARKET_CDS_INDEX[i], MARKET_CDS_INDEX[i].Product.ProtectionEndDate.ToString())); } ImmutableMarketData marketData = dataBuilder.build(); ImmutableList <CdsIsdaCreditCurveNode> nodes = nodesBuilder.build(); CDS_METADATA = cdsMetadataBuilder.build(); CDS_INDEX_METADATA = cdsIndexMetadataBuilder.build(); ImmutableCreditRatesProvider rates = ImmutableCreditRatesProvider.builder().valuationDate(VALUATION_DATE).recoveryRateCurves(ImmutableMap.of(LEGAL_ENTITY, RECOVERY_CURVE)).discountCurves(ImmutableMap.of(USD, YIELD_CURVE)).build(); IsdaCreditCurveDefinition definition = IsdaCreditCurveDefinition.of(CREDIT_CURVE_NAME, USD, VALUATION_DATE, ACT_365F, nodes, true, true); CREDIT_CURVE = BUILDER.calibrate(definition, marketData, rates, REF_DATA); NodalCurve underlyingCurve = ((IsdaCreditDiscountFactors)CREDIT_CURVE.SurvivalProbabilities).Curve; NodalCurve curveWithFactor = underlyingCurve.withMetadata(underlyingCurve.Metadata.withInfo(CurveInfoType.CDS_INDEX_FACTOR, INDEX_FACTOR).withParameterMetadata(CDS_INDEX_METADATA)); // replace parameter metadata CREDIT_CURVE_INDEX = LegalEntitySurvivalProbabilities.of(INDEX_ID, IsdaCreditDiscountFactors.of(USD, VALUATION_DATE, curveWithFactor)); }
//------------------------------------------------------------------------- public virtual void coverage() { DepositIsdaCreditCurveNode test1 = DepositIsdaCreditCurveNode.of(OBS_ID, ADJ_3D, BUS_ADJ, TENOR, ACT_360); coverImmutableBean(test1); DepositIsdaCreditCurveNode test2 = DepositIsdaCreditCurveNode.builder().observableId(QuoteId.of(StandardId.of("OG", "foo"))).spotDateOffset(DaysAdjustment.NONE).businessDayAdjustment(BusinessDayAdjustment.NONE).tenor(Tenor.TENOR_6M).dayCount(DayCounts.ACT_365F).label("test2").build(); coverBeanEquals(test1, test2); }
public virtual void test_contractSpecId_future() { EtdContractSpecId test = EtdIdUtils.contractSpecId(EtdType.FUTURE, ExchangeIds.ECAG, FGBS); assertEquals(test.StandardId, StandardId.of("OG-ETD", "F-ECAG-FGBS")); }
public virtual void test_contractSpecId_option() { EtdContractSpecId test = EtdIdUtils.contractSpecId(EtdType.OPTION, ExchangeIds.ECAG, OGBS); assertEquals(test.StandardId, StandardId.of("OG-ETD", "O-ECAG-OGBS")); }
//------------------------------------------------------------------------- public virtual void test_futureId_monthly() { SecurityId test = EtdIdUtils.futureId(ExchangeIds.ECAG, FGBS, YearMonth.of(2017, 6), MONTHLY); assertEquals(test.StandardId, StandardId.of("OG-ETD", "F-ECAG-FGBS-201706")); }
internal TestObservableId(string id, ObservableSource obsSource) : this(StandardId.of("test", id), obsSource) { }
public virtual void test_futureId_daily() { SecurityId test = EtdIdUtils.futureId(ExchangeIds.ECAG, FGBS, YearMonth.of(2017, 6), EtdVariant.ofDaily(2)); assertEquals(test.StandardId, StandardId.of("OG-ETD", "F-ECAG-FGBS-20170602")); }
public virtual void test_futureId_flex() { SecurityId test = EtdIdUtils.futureId(ExchangeIds.ECAG, FGBS, YearMonth.of(2017, 6), EtdVariant.ofFlexFuture(26, EtdSettlementType.DERIVATIVE)); assertEquals(test.StandardId, StandardId.of("OG-ETD", "F-ECAG-FGBS-20170626D")); }
//------------------------------------------------------------------------- public virtual void test_optionId_monthly() { SecurityId test = EtdIdUtils.optionId(ExchangeIds.ECAG, FGBS, YearMonth.of(2017, 6), MONTHLY, 0, PutCall.PUT, 12.34); assertEquals(test.StandardId, StandardId.of("OG-ETD", "O-ECAG-FGBS-201706-P12.34")); }
public virtual void test_optionId_weekly() { SecurityId test = EtdIdUtils.optionId(ExchangeIds.ECAG, FGBS, YearMonth.of(2017, 6), EtdVariant.ofWeekly(3), 0, PutCall.CALL, -1.45); assertEquals(test.StandardId, StandardId.of("OG-ETD", "O-ECAG-FGBS-201706W3-CM1.45")); }
public virtual void test_optionId_daily21_version() { SecurityId test = EtdIdUtils.optionId(ExchangeIds.ECAG, FGBS, YearMonth.of(2017, 6), EtdVariant.ofDaily(21), 11, PutCall.PUT, 12.34); assertEquals(test.StandardId, StandardId.of("OG-ETD", "O-ECAG-FGBS-20170621-V11-P12.34")); }