public override Builder set(string propertyName, object newValue) { switch (propertyName.GetHashCode()) { case 3373707: // name this.name_Renamed = (string)newValue; break; case 1005147787: // currencyPair this.currencyPair_Renamed = (CurrencyPair)newValue; break; case 394230283: // fixingCalendar this.fixingCalendar_Renamed = (HolidayCalendarId)newValue; break; case 873743726: // fixingDateOffset this.fixingDateOffset_Renamed = (DaysAdjustment)newValue; break; case 1574797394: // maturityDateOffset this.maturityDateOffset_Renamed = (DaysAdjustment)newValue; break; default: throw new NoSuchElementException("Unknown property: " + propertyName); } return(this); }
public override Builder set(string propertyName, object newValue) { switch (propertyName.GetHashCode()) { case 3373707: // name this.name_Renamed = (string)newValue; break; case 1302781851: // spreadLeg this.spreadLeg_Renamed = (IborRateSwapLegConvention)newValue; break; case -778843179: // flatLeg this.flatLeg_Renamed = (IborRateSwapLegConvention)newValue; break; case 746995843: // spotDateOffset this.spotDateOffset_Renamed = (DaysAdjustment)newValue; break; default: throw new NoSuchElementException("Unknown property: " + propertyName); } return(this); }
/// <summary> /// Restricted copy constructor. </summary> /// <param name="beanToCopy"> the bean to copy from, not null </param> internal Builder(ImmutableIborIborSwapConvention beanToCopy) { this.name_Renamed = beanToCopy.Name; this.spreadLeg_Renamed = beanToCopy.SpreadLeg; this.flatLeg_Renamed = beanToCopy.FlatLeg; this.spotDateOffset_Renamed = beanToCopy.SpotDateOffset; }
public override Builder set(string propertyName, object newValue) { switch (propertyName.GetHashCode()) { case 100346066: // index this.index_Renamed = (PriceIndex)newValue; break; case 106898: // lag this.lag_Renamed = (Period)newValue; break; case -1409010088: // indexCalculationMethod this.indexCalculationMethod_Renamed = (PriceIndexCalculationMethod)newValue; break; case -159410813: // notionalExchange this.notionalExchange_Renamed = (bool?)newValue.Value; break; case -716438393: // paymentDateOffset this.paymentDateOffset_Renamed = (DaysAdjustment)newValue; break; case 896049114: // accrualBusinessDayAdjustment this.accrualBusinessDayAdjustment_Renamed = (BusinessDayAdjustment)newValue; break; default: throw new NoSuchElementException("Unknown property: " + propertyName); } return(this); }
private static IborIndex parseIborIndex(CsvRow row) { string name = row.getValue(NAME_FIELD); Currency currency = Currency.parse(row.getValue(CURRENCY_FIELD)); bool active = bool.Parse(row.getValue(ACTIVE_FIELD)); DayCount dayCount = DayCount.of(row.getValue(DAY_COUNT_FIELD)); HolidayCalendarId fixingCal = HolidayCalendarId.of(row.getValue(FIXING_CALENDAR_FIELD)); int offsetDays = int.Parse(row.getValue(OFFSET_DAYS_FIELD)); HolidayCalendarId offsetCal = HolidayCalendarId.of(row.getValue(OFFSET_CALENDAR_FIELD)); HolidayCalendarId effectiveCal = HolidayCalendarId.of(row.getValue(EFFECTIVE_DATE_CALENDAR_FIELD)); Tenor tenor = Tenor.parse(row.getValue(TENOR_FIELD)); LocalTime time = LocalTime.parse(row.getValue(FIXING_TIME_FIELD), TIME_FORMAT); ZoneId zoneId = ZoneId.of(row.getValue(FIXING_ZONE_FIELD)); DayCount fixedLegDayCount = DayCount.of(row.getValue(FIXED_LEG_DAY_COUNT)); // interpret CSV DaysAdjustment fixingOffset = DaysAdjustment.ofBusinessDays(-offsetDays, offsetCal, BusinessDayAdjustment.of(PRECEDING, fixingCal)).normalized(); DaysAdjustment effectiveOffset = DaysAdjustment.ofBusinessDays(offsetDays, offsetCal, BusinessDayAdjustment.of(FOLLOWING, effectiveCal)).normalized(); // convention can be two different things PeriodAdditionConvention periodAdditionConvention = PeriodAdditionConvention.extendedEnum().find(row.getField(TENOR_CONVENTION_FIELD)).orElse(PeriodAdditionConventions.NONE); BusinessDayConvention tenorBusinessConvention = BusinessDayConvention.extendedEnum().find(row.getField(TENOR_CONVENTION_FIELD)).orElse(isEndOfMonth(periodAdditionConvention) ? MODIFIED_FOLLOWING : FOLLOWING); BusinessDayAdjustment adj = BusinessDayAdjustment.of(tenorBusinessConvention, effectiveCal); TenorAdjustment tenorAdjustment = TenorAdjustment.of(tenor, periodAdditionConvention, adj); // build result return(ImmutableIborIndex.builder().name(name).currency(currency).active(active).dayCount(dayCount).fixingCalendar(fixingCal).fixingDateOffset(fixingOffset).effectiveDateOffset(effectiveOffset).maturityDateOffset(tenorAdjustment).fixingTime(time).fixingZone(zoneId).defaultFixedLegDayCount(fixedLegDayCount).build()); }
public override Builder set(string propertyName, object newValue) { switch (propertyName.GetHashCode()) { case 102727412: // label this.label_Renamed = (string)newValue; break; case -518800962: // observableId this.observableId_Renamed = (ObservableId)newValue; break; case 110246592: // tenor this.tenor_Renamed = (Tenor)newValue; break; case 746995843: // spotDateOffset this.spotDateOffset_Renamed = (DaysAdjustment)newValue; break; case -1065319863: // businessDayAdjustment this.businessDayAdjustment_Renamed = (BusinessDayAdjustment)newValue; break; case 1905311443: // dayCount this.dayCount_Renamed = (DayCount)newValue; break; default: throw new NoSuchElementException("Unknown property: " + propertyName); } return(this); }
/// <summary> /// Restricted copy constructor. </summary> /// <param name="beanToCopy"> the bean to copy from, not null </param> internal Builder(ImmutableOvernightIborSwapConvention beanToCopy) { this.name_Renamed = beanToCopy.Name; this.overnightLeg_Renamed = beanToCopy.OvernightLeg; this.iborLeg_Renamed = beanToCopy.IborLeg; this.spotDateOffset_Renamed = beanToCopy.SpotDateOffset; }
private static DaysAdjustment expiryDateOffset(DaysAdjustment spotDateOffset) { ArgChecker.isTrue(spotDateOffset.Adjustment.Equals(BusinessDayAdjustment.NONE), "BusinessDayAdjustment in spotDateOffset must be NONE if expiryDateOffset is created from spotDateOffset"); DaysAdjustment adj = spotDateOffset.toBuilder().days(-spotDateOffset.Days).build(); return(adj); }
public virtual void test_volatilities() { BlackFxOptionInterpolatedNodalSurfaceVolatilitiesSpecification @base = BlackFxOptionInterpolatedNodalSurfaceVolatilitiesSpecification.builder().name(VOL_NAME).currencyPair(GBP_USD).dayCount(ACT_365F).nodes(NODES).timeInterpolator(PCHIP).strikeInterpolator(DOUBLE_QUADRATIC).build(); LocalDate date = LocalDate.of(2017, 9, 25); ZonedDateTime dateTime = date.atStartOfDay().atZone(ZoneId.of("Europe/London")); DoubleArray parameters = DoubleArray.of(0.19, 0.15, 0.13, 0.14, 0.14, 0.11, 0.09, 0.09, 0.11, 0.09, 0.07, 0.07); BlackFxOptionSurfaceVolatilities computed = @base.volatilities(dateTime, parameters, REF_DATA); DaysAdjustment expOffset = DaysAdjustment.ofBusinessDays(-2, NY_LO); double[] expiries = new double[STRIKES.Count * TENORS.Count]; double[] strikes = new double[STRIKES.Count * TENORS.Count]; ImmutableList.Builder <ParameterMetadata> paramMetadata = ImmutableList.builder(); for (int i = 0; i < TENORS.Count; ++i) { double expiry = ACT_365F.relativeYearFraction(date, expOffset.adjust(BDA.adjust(SPOT_OFFSET.adjust(date, REF_DATA).plus(TENORS[i]), REF_DATA), REF_DATA)); for (int j = 0; j < STRIKES.Count; ++j) { paramMetadata.add(FxVolatilitySurfaceYearFractionParameterMetadata.of(expiry, SimpleStrike.of(STRIKES[j]), GBP_USD)); expiries[STRIKES.Count * i + j] = expiry; strikes[STRIKES.Count * i + j] = STRIKES[j]; } } InterpolatedNodalSurface surface = InterpolatedNodalSurface.ofUnsorted(Surfaces.blackVolatilityByExpiryStrike(VOL_NAME.Name, ACT_365F).withParameterMetadata(paramMetadata.build()), DoubleArray.ofUnsafe(expiries), DoubleArray.ofUnsafe(strikes), parameters, GridSurfaceInterpolator.of(PCHIP, DOUBLE_QUADRATIC)); BlackFxOptionSurfaceVolatilities expected = BlackFxOptionSurfaceVolatilities.of(VOL_NAME, GBP_USD, dateTime, surface); assertEquals(computed, expected); }
//------------------------------------------------------------------------- /// <summary> /// Converts an FpML 'RelativeDateOffset' to a {@code DaysAdjustment}. /// </summary> /// <param name="baseEl"> the FpML adjustable date element </param> /// <returns> the days adjustment </returns> /// <exception cref="RuntimeException"> if unable to parse </exception> public DaysAdjustment parseRelativeDateOffsetDays(XmlElement baseEl) { // FpML content: ('periodMultiplier', 'period', 'dayType?', // 'businessDayConvention', 'BusinessCentersOrReference.model?' // 'dateRelativeTo', 'adjustedDate') // The 'dateRelativeTo' element is not used here // The 'adjustedDate' element is ignored Period period = parsePeriod(baseEl); if (period.toTotalMonths() != 0) { throw new FpmlParseException("Expected days-based period but found " + period); } Optional <XmlElement> dayTypeEl = baseEl.findChild("dayType"); bool calendarDays = period.Zero || (dayTypeEl.Present && dayTypeEl.get().Content.Equals("Calendar")); BusinessDayConvention fixingBdc = convertBusinessDayConvention(baseEl.getChild("businessDayConvention").Content); HolidayCalendarId calendar = parseBusinessCenters(baseEl); if (calendarDays) { return(DaysAdjustment.ofCalendarDays(period.Days, BusinessDayAdjustment.of(fixingBdc, calendar))); } else { return(DaysAdjustment.ofBusinessDays(period.Days, calendar)); } }
public override Builder set(string propertyName, object newValue) { switch (propertyName.GetHashCode()) { case 1574023291: // securityId this.securityId_Renamed = (SecurityId)newValue; break; case 1585636160: // notional this.notional_Renamed = (Payment)newValue; break; case 1905311443: // dayCount this.dayCount_Renamed = (DayCount)newValue; break; case -1895216418: // yieldConvention this.yieldConvention_Renamed = (BillYieldConvention)newValue; break; case 866287159: // legalEntityId this.legalEntityId_Renamed = (LegalEntityId)newValue; break; case 135924714: // settlementDateOffset this.settlementDateOffset_Renamed = (DaysAdjustment)newValue; break; default: throw new NoSuchElementException("Unknown property: " + propertyName); } return(this); }
/// <summary> /// Restricted copy constructor. </summary> /// <param name="beanToCopy"> the bean to copy from, not null </param> internal Builder(ImmutableFixedOvernightSwapConvention beanToCopy) { this.name_Renamed = beanToCopy.Name; this.fixedLeg_Renamed = beanToCopy.FixedLeg; this.floatingLeg_Renamed = beanToCopy.FloatingLeg; this.spotDateOffset_Renamed = beanToCopy.SpotDateOffset; }
/// <summary> /// Restricted copy constructor. </summary> /// <param name="beanToCopy"> the bean to copy from, not null </param> internal Builder(ImmutableFxSwapConvention beanToCopy) { this.currencyPair_Renamed = beanToCopy.CurrencyPair; this.name_Renamed = beanToCopy.name; this.spotDateOffset_Renamed = beanToCopy.SpotDateOffset; this.businessDayAdjustment_Renamed = beanToCopy.businessDayAdjustment; }
public override Builder set(string propertyName, object newValue) { switch (propertyName.GetHashCode()) { case 3373707: // name this.name_Renamed = (string)newValue; break; case -391537158: // fixedLeg this.fixedLeg_Renamed = (FixedRateSwapLegConvention)newValue; break; case -1177101272: // floatingLeg this.floatingLeg_Renamed = (OvernightRateSwapLegConvention)newValue; break; case 746995843: // spotDateOffset this.spotDateOffset_Renamed = (DaysAdjustment)newValue; break; default: throw new NoSuchElementException("Unknown property: " + propertyName); } return(this); }
public override Builder set(string propertyName, object newValue) { switch (propertyName.GetHashCode()) { case 3373707: // name this.name_Renamed = (string)newValue; break; case 1774606250: // overnightLeg this.overnightLeg_Renamed = (OvernightRateSwapLegConvention)newValue; break; case 1610246066: // iborLeg this.iborLeg_Renamed = (IborRateSwapLegConvention)newValue; break; case 746995843: // spotDateOffset this.spotDateOffset_Renamed = (DaysAdjustment)newValue; break; default: throw new NoSuchElementException("Unknown property: " + propertyName); } return(this); }
public override Builder set(string propertyName, object newValue) { switch (propertyName.GetHashCode()) { case 1005147787: // currencyPair this.currencyPair_Renamed = (CurrencyPair)newValue; break; case 3373707: // name this.name_Renamed = (string)newValue; break; case 746995843: // spotDateOffset this.spotDateOffset_Renamed = (DaysAdjustment)newValue; break; case -1065319863: // businessDayAdjustment this.businessDayAdjustment_Renamed = (BusinessDayAdjustment)newValue; break; default: throw new NoSuchElementException("Unknown property: " + propertyName); } return(this); }
public override Builder set(string propertyName, object newValue) { switch (propertyName.GetHashCode()) { case 100346066: // index this.index_Renamed = (FxIndex)newValue; break; case 727652476: // referenceCurrency this.referenceCurrency_Renamed = (Currency)newValue; break; case 232554996: // fixingRelativeTo this.fixingRelativeTo_Renamed = (FxResetFixingRelativeTo)newValue; break; case 873743726: // fixingDateOffset this.fixingDateOffset_Renamed = (DaysAdjustment)newValue; break; case -931164883: // initialNotionalValue this.initialNotionalValue_Renamed = (double?)newValue; break; default: throw new NoSuchElementException("Unknown property: " + propertyName); } return(this); }
/// <summary> /// Restricted copy constructor. </summary> /// <param name="beanToCopy"> the bean to copy from, not null </param> internal Builder(ImmutableFxIndex beanToCopy) { this.name_Renamed = beanToCopy.Name; this.currencyPair_Renamed = beanToCopy.CurrencyPair; this.fixingCalendar_Renamed = beanToCopy.FixingCalendar; this.fixingDateOffset_Renamed = beanToCopy.FixingDateOffset; this.maturityDateOffset_Renamed = beanToCopy.MaturityDateOffset; }
/// <summary> /// Restricted copy constructor. </summary> /// <param name="beanToCopy"> the bean to copy from, not null </param> internal Builder(ImmutableThreeLegBasisSwapConvention beanToCopy) { this.name_Renamed = beanToCopy.Name; this.spreadLeg_Renamed = beanToCopy.SpreadLeg; this.spreadFloatingLeg_Renamed = beanToCopy.SpreadFloatingLeg; this.flatFloatingLeg_Renamed = beanToCopy.FlatFloatingLeg; this.spotDateOffset_Renamed = beanToCopy.SpotDateOffset; }
/// <summary> /// Restricted copy constructor. </summary> /// <param name="beanToCopy"> the bean to copy from, not null </param> internal Builder(FxResetCalculation beanToCopy) { this.index_Renamed = beanToCopy.Index; this.referenceCurrency_Renamed = beanToCopy.ReferenceCurrency; this.fixingRelativeTo_Renamed = beanToCopy.FixingRelativeTo; this.fixingDateOffset_Renamed = beanToCopy.FixingDateOffset; this.initialNotionalValue_Renamed = beanToCopy.initialNotionalValue; }
/// <summary> /// Restricted copy constructor. </summary> /// <param name="beanToCopy"> the bean to copy from, not null </param> internal Builder(ImmutableTermDepositConvention beanToCopy) { this.currency_Renamed = beanToCopy.Currency; this.name_Renamed = beanToCopy.Name; this.businessDayAdjustment_Renamed = beanToCopy.BusinessDayAdjustment; this.dayCount_Renamed = beanToCopy.DayCount; this.spotDateOffset_Renamed = beanToCopy.SpotDateOffset; }
/// <summary> /// Restricted copy constructor. </summary> /// <param name="beanToCopy"> the bean to copy from, not null </param> internal Builder(InflationRateSwapLegConvention beanToCopy) { this.index_Renamed = beanToCopy.Index; this.lag_Renamed = beanToCopy.Lag; this.indexCalculationMethod_Renamed = beanToCopy.IndexCalculationMethod; this.notionalExchange_Renamed = beanToCopy.NotionalExchange; this.paymentDateOffset_Renamed = beanToCopy.paymentDateOffset; this.accrualBusinessDayAdjustment_Renamed = beanToCopy.accrualBusinessDayAdjustment; }
/// <summary> /// Restricted copy constructor. </summary> /// <param name="beanToCopy"> the bean to copy from, not null </param> internal Builder(DepositIsdaCreditCurveNode beanToCopy) { this.label_Renamed = beanToCopy.Label; this.observableId_Renamed = beanToCopy.ObservableId; this.tenor_Renamed = beanToCopy.Tenor; this.spotDateOffset_Renamed = beanToCopy.SpotDateOffset; this.businessDayAdjustment_Renamed = beanToCopy.BusinessDayAdjustment; this.dayCount_Renamed = beanToCopy.DayCount; }
/// <summary> /// Restricted copy constructor. </summary> /// <param name="beanToCopy"> the bean to copy from, not null </param> internal Builder(BillSecurity beanToCopy) { this.info_Renamed = beanToCopy.Info; this.notional_Renamed = beanToCopy.Notional; this.dayCount_Renamed = beanToCopy.DayCount; this.yieldConvention_Renamed = beanToCopy.YieldConvention; this.legalEntityId_Renamed = beanToCopy.LegalEntityId; this.settlementDateOffset_Renamed = beanToCopy.SettlementDateOffset; }
private ImmutableFxSwapConvention(CurrencyPair currencyPair, string name, DaysAdjustment spotDateOffset, BusinessDayAdjustment businessDayAdjustment) { JodaBeanUtils.notNull(currencyPair, "currencyPair"); JodaBeanUtils.notNull(spotDateOffset, "spotDateOffset"); this.currencyPair = currencyPair; this.name = name; this.spotDateOffset = spotDateOffset; this.businessDayAdjustment = businessDayAdjustment; }
/// <summary> /// Restricted copy constructor. </summary> /// <param name="beanToCopy"> the bean to copy from, not null </param> protected internal Builder(ResolvedBill beanToCopy) { this.securityId_Renamed = beanToCopy.SecurityId; this.notional_Renamed = beanToCopy.Notional; this.dayCount_Renamed = beanToCopy.DayCount; this.yieldConvention_Renamed = beanToCopy.YieldConvention; this.legalEntityId_Renamed = beanToCopy.LegalEntityId; this.settlementDateOffset_Renamed = beanToCopy.SettlementDateOffset; }
/// <summary> /// Restricted copy constructor. </summary> /// <param name="beanToCopy"> the bean to copy from, not null </param> internal Builder(ImmutableIborFixingDepositConvention beanToCopy) { this.index_Renamed = beanToCopy.Index; this.name_Renamed = beanToCopy.name; this.currency_Renamed = beanToCopy.currency; this.dayCount_Renamed = beanToCopy.dayCount; this.spotDateOffset_Renamed = beanToCopy.spotDateOffset; this.businessDayAdjustment_Renamed = beanToCopy.businessDayAdjustment; this.fixingDateOffset_Renamed = beanToCopy.fixingDateOffset; }
private ImmutableIborFixingDepositConvention(IborIndex index, string name, Currency currency, DayCount dayCount, DaysAdjustment spotDateOffset, BusinessDayAdjustment businessDayAdjustment, DaysAdjustment fixingDateOffset) { JodaBeanUtils.notNull(index, "index"); this.index = index; this.name = name; this.currency = currency; this.dayCount = dayCount; this.spotDateOffset = spotDateOffset; this.businessDayAdjustment = businessDayAdjustment; this.fixingDateOffset = fixingDateOffset; }
/// <summary> /// Restricted copy constructor. </summary> /// <param name="beanToCopy"> the bean to copy from, not null </param> internal Builder(IborCapFloorLeg beanToCopy) { this.payReceive_Renamed = beanToCopy.PayReceive; this.paymentSchedule_Renamed = beanToCopy.PaymentSchedule; this.paymentDateOffset_Renamed = beanToCopy.PaymentDateOffset; this.currency_Renamed = beanToCopy.Currency; this.notional_Renamed = beanToCopy.Notional; this.calculation_Renamed = beanToCopy.Calculation; this.capSchedule_Renamed = beanToCopy.capSchedule; this.floorSchedule_Renamed = beanToCopy.floorSchedule; }
private ImmutableIborIborSwapConvention(string name, IborRateSwapLegConvention spreadLeg, IborRateSwapLegConvention flatLeg, DaysAdjustment spotDateOffset) { JodaBeanUtils.notNull(name, "name"); JodaBeanUtils.notNull(spreadLeg, "spreadLeg"); JodaBeanUtils.notNull(flatLeg, "flatLeg"); JodaBeanUtils.notNull(spotDateOffset, "spotDateOffset"); this.name = name; this.spreadLeg = spreadLeg; this.flatLeg = flatLeg; this.spotDateOffset = spotDateOffset; validate(); }