// Specification for this class public override void LoadSpecifications() { // Basis swap 6m vs 3m this.buildingBlockType = BuildingBlockType.EURSWAP3M; // Fixed leg details on swapLeg1 Rule FloatSwapRule1 = Rule.Backward; string FloatSwapPayFreqString1 = "6m"; BusinessDayAdjustment FloatSwapBusDayAdjRolls1 = BusinessDayAdjustment.ModifiedFollowing; string FloatSwapLegPaymentString1 = "0d"; BusinessDayAdjustment FloatSwapBusDayAdjPay1 = BusinessDayAdjustment.ModifiedFollowing; Dc FloatDayCount1 = Dc._Act_360; // day count of Floating leg FixFloat FloatFixOrFloat1 = FixFloat.Floating; string FloatUnderlyingRateTenor1 = "6m"; // Floating details on Leg2 Rule FloatSwapRule2 = Rule.Backward; string FloatSwapPayFreqString2 = "3m"; BusinessDayAdjustment FloatSwapBusDayAdjRolls2 = BusinessDayAdjustment.ModifiedFollowing; string FloatSwapLegPaymentString2 = "0d"; BusinessDayAdjustment FloatSwapBusDayAdjPay2 = BusinessDayAdjustment.ModifiedFollowing; Dc FloatDayCount2 = Dc._Act_360; // day count of Floating leg FixFloat FloatFixOrFloat2 = FixFloat.Floating; string FloatUnderlyingRateTenor2 = "3m"; // Creating swap legs // create swapLeg1 this.swapLeg1 = new SwapLeg(FloatSwapRule1, FloatSwapPayFreqString1, FloatSwapBusDayAdjRolls1, FloatSwapLegPaymentString1, FloatSwapBusDayAdjPay1, FloatDayCount1, FloatFixOrFloat1, FloatUnderlyingRateTenor1); // create swapLeg2 this.swapLeg2 = new SwapLeg(FloatSwapRule2, FloatSwapPayFreqString2, FloatSwapBusDayAdjRolls2, FloatSwapLegPaymentString2, FloatSwapBusDayAdjPay2, FloatDayCount2, FloatFixOrFloat2, FloatUnderlyingRateTenor2); }
// Specification for this class public override void LoadSpecifications() { // standard EoniaSwap Data may be stored on xml this.buildingBlockType = BuildingBlockType.EONIASWAP; // Fixed leg details on swapLeg1 Rule FixSwapRule = Rule.Backward; string FixSwapPayFreqString = "1y"; BusinessDayAdjustment FixSwapBusDayAdjRolls = BusinessDayAdjustment.ModifiedFollowing; string FixSwapLegPaymentString = "1d"; BusinessDayAdjustment FixSwapBusDayAdjPay = BusinessDayAdjustment.ModifiedFollowing; Dc FixDayCount = Dc._Act_360; // day count of fixed leg FixFloat FixFixOrFloat = FixFloat.Fixed; string FixUnderlyingRateTenor = ""; // Floating details on Leg2 Rule FloatSwapRule = Rule.Backward; string FloatSwapPayFreqString = "1y"; BusinessDayAdjustment FloatSwapBusDayAdjRolls = BusinessDayAdjustment.ModifiedFollowing; string FloatSwapLegPaymentString = "1d"; BusinessDayAdjustment FloatSwapBusDayAdjPay = BusinessDayAdjustment.ModifiedFollowing; Dc FloatDayCount = Dc._Act_360; // day count of Floating leg FixFloat FloatFixOrFloat = FixFloat.Floating; string FloatUnderlyingRateTenor = "1d"; // Creating swap legs // create swapLeg1 this.swapLeg1 = new SwapLeg(FixSwapRule, FixSwapPayFreqString, FixSwapBusDayAdjRolls, FixSwapLegPaymentString, FixSwapBusDayAdjPay, FixDayCount, FixFixOrFloat, FixUnderlyingRateTenor); // create swapLeg2 this.swapLeg2 = new SwapLeg(FloatSwapRule, FloatSwapPayFreqString, FloatSwapBusDayAdjRolls, FloatSwapLegPaymentString, FloatSwapBusDayAdjPay, FloatDayCount, FloatFixOrFloat, FloatUnderlyingRateTenor); }
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); }
// will return yield on BondFixedCoupon double ICalculator.BondFixedCouponYield(double Today, double StartDateBond, double EndDateBond, double Coupon, string CouponTenor, string RuleGenerator, int SettlementDaysLag, string RollAdj, string PayAdj, string DayCount, string LagPayFromRecordDate, double FaceValue, double CleanPrice, int Freq, string DayCountYield, string Compounding) { // for details of input refer to comments on BondFixedCoupon class // make it volatile if (m_xlApp != null) { m_xlApp.Volatile(true); } // Parse enum Type Rule ruleGenerator = (Rule)Enum.Parse(typeof(Rule), RuleGenerator); BusinessDayAdjustment rollAdj = (BusinessDayAdjustment)Enum.Parse(typeof(BusinessDayAdjustment), RollAdj); BusinessDayAdjustment payAdj = (BusinessDayAdjustment)Enum.Parse(typeof(BusinessDayAdjustment), PayAdj); Dc dc = (Dc)Enum.Parse(typeof(Dc), DayCount); Dc dcy = (Dc)Enum.Parse(typeof(Dc), DayCountYield); Compounding comp = (Compounding)Enum.Parse(typeof(Compounding), Compounding); // initialise bond BondFixedCoupon bfc = new BondFixedCoupon(new Date(Today), new Date(StartDateBond), new Date(EndDateBond) , Coupon, CouponTenor, ruleGenerator, SettlementDaysLag, rollAdj, payAdj, dc, LagPayFromRecordDate, FaceValue); // return the yield return((double)bfc.Yield(CleanPrice, Freq, dcy, comp)); }
// will return a column vector of coupon payment date double[,] ICalculator.GetCouponDates(double StartDateBond, double EndDateBond, string CouponTenor, string RuleGenerator, string RollAdj, string LagPayFromRecordDate, string PayAdj) { // for details of inputs refer to comments on BondBase class // make it volatile if (m_xlApp != null) { m_xlApp.Volatile(true); } // Parse enum Type Rule ruleGenerator = (Rule)Enum.Parse(typeof(Rule), RuleGenerator); BusinessDayAdjustment rollAdj = (BusinessDayAdjustment)Enum.Parse(typeof(BusinessDayAdjustment), RollAdj); BusinessDayAdjustment payAdj = (BusinessDayAdjustment)Enum.Parse(typeof(BusinessDayAdjustment), PayAdj); // Create a schedule Schedule sch = new Schedule(new Date(StartDateBond), new Date(EndDateBond), CouponTenor, ruleGenerator, rollAdj, LagPayFromRecordDate, payAdj); int n = sch.toDates.GetLength(0); // number of payment dates double[] serialDate = Date.GetSerialValue(sch.toDates); // get dates and cast to double double[,] outPut = new double[n, 1]; // fill a matrix to return in excel for (int i = 0; i < n; i++) { outPut[i, 0] = serialDate[i]; } return(outPut); // my serial coupon dates }
static SwaptionCubeData() { EXPIRIES.Add(Period.ofMonths(1)); EXPIRIES.Add(Period.ofMonths(3)); EXPIRIES.Add(Period.ofMonths(6)); EXPIRIES.Add(Period.ofYears(1)); EXPIRIES.Add(Period.ofYears(2)); EXPIRIES.Add(Period.ofYears(5)); TENORS.Add(Tenor.TENOR_1Y); TENORS.Add(Tenor.TENOR_2Y); TENORS.Add(Tenor.TENOR_5Y); EXPIRIES_SIMPLE.Add(Period.ofMonths(1)); EXPIRIES_SIMPLE.Add(Period.ofMonths(6)); EXPIRIES_SIMPLE.Add(Period.ofYears(1)); TENORS_SIMPLE.Add(Tenor.TENOR_1Y); TENORS_SIMPLE.Add(Tenor.TENOR_2Y); EXPIRIES_SIMPLE_2.Add(Period.ofMonths(1)); EXPIRIES_SIMPLE_2.Add(Period.ofMonths(3)); EXPIRIES_SIMPLE_2.Add(Period.ofMonths(6)); EXPIRIES_SIMPLE_2.Add(Period.ofYears(1)); for (int i = 0; i < EXPIRIES_SIMPLE_2.Count; i++) { BusinessDayAdjustment bda = EUR_FIXED_1Y_EURIBOR_6M.FloatingLeg.StartDateBusinessDayAdjustment; EXPIRIES_SIMPLE_2_TIME[2 * i] = DAY_COUNT.relativeYearFraction(DATA_DATE, bda.adjust(DATA_DATE.plus(EXPIRIES_SIMPLE_2[i]), REF_DATA)); EXPIRIES_SIMPLE_2_TIME[2 * i + 1] = EXPIRIES_SIMPLE_2_TIME[2 * i]; } }
/// <summary> /// Restricted copy constructor. </summary> /// <param name="beanToCopy"> the bean to copy from, not null </param> internal Builder(ImmutableIborFutureConvention beanToCopy) { this.index_Renamed = beanToCopy.Index; this.name_Renamed = beanToCopy.Name; this.dateSequence_Renamed = beanToCopy.DateSequence; this.businessDayAdjustment_Renamed = beanToCopy.BusinessDayAdjustment; }
public override Builder set(string propertyName, object newValue) { switch (propertyName.GetHashCode()) { case 100346066: // index this.index_Renamed = (IborIndex)newValue; break; case 3373707: // name this.name_Renamed = (string)newValue; break; case -258065009: // dateSequence this.dateSequence_Renamed = (DateSequence)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 = (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); }
public virtual void test_resolve() { BusinessDayAdjustment bussAdj = BusinessDayAdjustment.of(FOLLOWING, SAT_SUN); ResolvedCds test = PRODUCT_STD.resolve(REF_DATA); int nDates = 44; LocalDate[] dates = new LocalDate[nDates]; for (int i = 0; i < nDates; ++i) { dates[i] = START_DATE.plusMonths(3 * i); } IList <CreditCouponPaymentPeriod> payments = new List <CreditCouponPaymentPeriod>(nDates - 1); for (int i = 0; i < nDates - 2; ++i) { LocalDate start = i == 0 ? dates[i] : bussAdj.adjust(dates[i], REF_DATA); LocalDate end = bussAdj.adjust(dates[i + 1], REF_DATA); payments.Add(CreditCouponPaymentPeriod.builder().startDate(start).endDate(end).unadjustedStartDate(dates[i]).unadjustedEndDate(dates[i + 1]).effectiveStartDate(start.minusDays(1)).effectiveEndDate(end.minusDays(1)).paymentDate(end).currency(USD).notional(NOTIONAL).fixedRate(COUPON).yearFraction(ACT_360.relativeYearFraction(start, end)).build()); } LocalDate start = bussAdj.adjust(dates[nDates - 2], REF_DATA); LocalDate end = dates[nDates - 1]; payments.Add(CreditCouponPaymentPeriod.builder().startDate(start).endDate(end.plusDays(1)).unadjustedStartDate(dates[nDates - 2]).unadjustedEndDate(end).effectiveStartDate(start.minusDays(1)).effectiveEndDate(end).paymentDate(bussAdj.adjust(end, REF_DATA)).currency(USD).notional(NOTIONAL).fixedRate(COUPON).yearFraction(ACT_360.relativeYearFraction(start, end.plusDays(1))).build()); ResolvedCds expected = ResolvedCds.builder().buySell(BUY).legalEntityId(LEGAL_ENTITY).dayCount(ACT_360).paymentOnDefault(ACCRUED_PREMIUM).paymentPeriods(payments).protectionStart(BEGINNING).protectionEndDate(END_DATE).settlementDateOffset(SETTLE_DAY_ADJ).stepinDateOffset(STEPIN_DAY_ADJ).build(); assertEquals(test, expected); }
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()); }
//------------------------------------------------------------------------- // accrual schedule private static PeriodicSchedule parseAccrualSchedule(CsvRow row, string leg) { PeriodicSchedule.Builder builder = PeriodicSchedule.builder(); // basics builder.startDate(LoaderUtils.parseDate(getValueWithFallback(row, leg, START_DATE_FIELD))); builder.endDate(LoaderUtils.parseDate(getValueWithFallback(row, leg, END_DATE_FIELD))); builder.frequency(Frequency.parse(getValue(row, leg, FREQUENCY_FIELD))); // adjustments BusinessDayAdjustment dateAdj = parseBusinessDayAdjustment(row, leg, DATE_ADJ_CNV_FIELD, DATE_ADJ_CAL_FIELD).orElse(BusinessDayAdjustment.NONE); Optional <BusinessDayAdjustment> startDateAdj = parseBusinessDayAdjustment(row, leg, START_DATE_CNV_FIELD, START_DATE_CAL_FIELD); Optional <BusinessDayAdjustment> endDateAdj = parseBusinessDayAdjustment(row, leg, END_DATE_CNV_FIELD, END_DATE_CAL_FIELD); builder.businessDayAdjustment(dateAdj); if (startDateAdj.Present && !startDateAdj.get().Equals(dateAdj)) { builder.startDateBusinessDayAdjustment(startDateAdj.get()); } if (endDateAdj.Present && !endDateAdj.get().Equals(dateAdj)) { builder.endDateBusinessDayAdjustment(endDateAdj.get()); } // optionals builder.stubConvention(findValueWithFallback(row, leg, STUB_CONVENTION_FIELD).map(s => StubConvention.of(s)).orElse(StubConvention.SMART_INITIAL)); findValue(row, leg, ROLL_CONVENTION_FIELD).map(s => LoaderUtils.parseRollConvention(s)).ifPresent(v => builder.rollConvention(v)); findValue(row, leg, FIRST_REGULAR_START_DATE_FIELD).map(s => LoaderUtils.parseDate(s)).ifPresent(v => builder.firstRegularStartDate(v)); findValue(row, leg, LAST_REGULAR_END_DATE_FIELD).map(s => LoaderUtils.parseDate(s)).ifPresent(v => builder.lastRegularEndDate(v)); parseAdjustableDate(row, leg, OVERRIDE_START_DATE_FIELD, OVERRIDE_START_DATE_CNV_FIELD, OVERRIDE_START_DATE_CAL_FIELD).ifPresent(d => builder.overrideStartDate(d)); return(builder.build()); }
//------------------------------------------------------------------------- // ibor rate calculation private static RateCalculation parseIborRateCalculation(CsvRow row, string leg, IborIndex iborIndex, BusinessDayAdjustment bda, Currency currency) { IborRateCalculation.Builder builder = IborRateCalculation.builder(); // basics builder.index(iborIndex); // reset Optional <Frequency> resetFrequencyOpt = findValue(row, leg, RESET_FREQUENCY_FIELD).map(v => Frequency.parse(v)); IborRateResetMethod resetMethod = findValue(row, leg, RESET_METHOD_FIELD).map(v => IborRateResetMethod.of(v)).orElse(IborRateResetMethod.WEIGHTED); BusinessDayAdjustment resetDateAdj = parseBusinessDayAdjustment(row, leg, RESET_DATE_CNV_FIELD, RESET_DATE_CAL_FIELD).orElse(bda); resetFrequencyOpt.ifPresent(freq => builder.resetPeriods(ResetSchedule.builder().resetFrequency(freq).resetMethod(resetMethod).businessDayAdjustment(resetDateAdj).build())); // optionals, no ability to set firstFixingDateOffset findValue(row, leg, DAY_COUNT_FIELD).map(s => LoaderUtils.parseDayCount(s)).ifPresent(v => builder.dayCount(v)); findValue(row, leg, FIXING_RELATIVE_TO_FIELD).map(s => FixingRelativeTo.of(s)).ifPresent(v => builder.fixingRelativeTo(v)); Optional <DaysAdjustment> fixingAdjOpt = parseDaysAdjustment(row, leg, FIXING_OFFSET_DAYS_FIELD, FIXING_OFFSET_CAL_FIELD, FIXING_OFFSET_ADJ_CNV_FIELD, FIXING_OFFSET_ADJ_CAL_FIELD); fixingAdjOpt.ifPresent(v => builder.fixingDateOffset(v)); findValue(row, leg, NEGATIVE_RATE_METHOD_FIELD).map(s => NegativeRateMethod.of(s)).ifPresent(v => builder.negativeRateMethod(v)); findValue(row, leg, FIRST_RATE_FIELD).map(s => LoaderUtils.parseDoublePercent(s)).ifPresent(v => builder.firstRate(v)); findValue(row, leg, GEARING_FIELD).map(s => LoaderUtils.parseDouble(s)).ifPresent(v => builder.gearing(ValueSchedule.of(v))); findValue(row, leg, SPREAD_FIELD).map(s => LoaderUtils.parseDoublePercent(s)).ifPresent(v => builder.spread(ValueSchedule.of(v))); // initial stub Optional <IborRateStubCalculation> initialStub = parseIborStub(row, leg, currency, builder, INITIAL_STUB_RATE_FIELD, INITIAL_STUB_AMOUNT_FIELD, INITIAL_STUB_INDEX_FIELD, INITIAL_STUB_INTERPOLATED_INDEX_FIELD); initialStub.ifPresent(stub => builder.initialStub(stub)); // final stub Optional <IborRateStubCalculation> finalStub = parseIborStub(row, leg, currency, builder, FINAL_STUB_RATE_FIELD, FINAL_STUB_AMOUNT_FIELD, FINAL_STUB_INDEX_FIELD, FINAL_STUB_INTERPOLATED_INDEX_FIELD); finalStub.ifPresent(stub => builder.finalStub(stub)); return(builder.build()); }
/// <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; }
//------------------------------------------------------------------------- /// <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 Date GetBusinessDayAdjustment(BusinessDayAdjustment conv) { Date result = new Date(this); switch (conv) { case BusinessDayAdjustment.Following: result = GetFollowing(); break; case BusinessDayAdjustment.ModifiedFollowing: result = GetModifiedFollowing(); break; case BusinessDayAdjustment.Preceding: result = GetPreceding(); break; case BusinessDayAdjustment.Unadjusted: result = GetUnadjusted(); break; default: break; } return(result); }
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(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; }
public bool arrears; // true if I calculate leg from endDate, false if I calculate the leg from start date // constructors public FloatingSchedule(Date StartDate, Date EndDate, string PayFreqString, Rule GeneratorRule, BusinessDayAdjustment BusDayAdjRolls, string LegPaymentString, BusinessDayAdjustment BusDayAdjPayment, bool ArrearFixing, int NumOfBussDays) : base(StartDate, EndDate, PayFreqString, GeneratorRule, BusDayAdjRolls, LegPaymentString, BusDayAdjPayment) { this.arrears = ArrearFixing; // date in which we will observe the fixing this.numOfBussDays = NumOfBussDays; // leg of days to observe as numbers of business days BuildFloatingSchedule(); // method to build schedule }
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> 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; }
private FxSingle(Payment baseCurrencyPayment, Payment counterCurrencyPayment, BusinessDayAdjustment paymentDateAdjustment) { JodaBeanUtils.notNull(baseCurrencyPayment, "baseCurrencyPayment"); JodaBeanUtils.notNull(counterCurrencyPayment, "counterCurrencyPayment"); this.baseCurrencyPayment = baseCurrencyPayment; this.counterCurrencyPayment = counterCurrencyPayment; this.paymentDateAdjustment = paymentDateAdjustment; validate(); }
private ResetSchedule(Frequency resetFrequency, BusinessDayAdjustment businessDayAdjustment, IborRateResetMethod resetMethod) { JodaBeanUtils.notNull(resetFrequency, "resetFrequency"); JodaBeanUtils.notNull(businessDayAdjustment, "businessDayAdjustment"); JodaBeanUtils.notNull(resetMethod, "resetMethod"); this.resetFrequency = resetFrequency; this.businessDayAdjustment = businessDayAdjustment; this.resetMethod = resetMethod; }
//------------------------------------------------------------------------- public ResolvedTermDeposit resolve(ReferenceData refData) { DateAdjuster bda = BusinessDayAdjustment.orElse(BusinessDayAdjustment.NONE).resolve(refData); LocalDate start = bda.adjust(startDate); LocalDate end = bda.adjust(endDate); double yearFraction = dayCount.yearFraction(start, end); return(ResolvedTermDeposit.builder().startDate(start).endDate(end).yearFraction(yearFraction).currency(Currency).notional(buySell.normalize(notional)).rate(rate).build()); }
/// <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> /// Converts an FpML 'BusinessDayAdjustments' to a {@code BusinessDayAdjustment}. /// </summary> /// <param name="baseEl"> the FpML business centers or reference element to parse </param> /// <returns> the business day adjustment </returns> /// <exception cref="RuntimeException"> if unable to parse </exception> public BusinessDayAdjustment parseBusinessDayAdjustments(XmlElement baseEl) { // FpML content: ('businessDayConvention', 'BusinessCentersOrReference.model?') BusinessDayConvention bdc = convertBusinessDayConvention(baseEl.getChild("businessDayConvention").Content); Optional <XmlElement> centersEl = baseEl.findChild("businessCenters"); Optional <XmlElement> centersRefEl = baseEl.findChild("businessCentersReference"); HolidayCalendarId calendar = (centersEl.Present || centersRefEl.Present ? parseBusinessCenters(baseEl) : HolidayCalendarIds.NO_HOLIDAYS); return(BusinessDayAdjustment.of(bdc, calendar)); }
/// <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; }
public static Date[] GetBusDayAdjust(Date[] d, BusinessDayAdjustment Conv) { int n = d.GetLength(0); Date[] outPut = new Date[n]; for (int i = 0; i < n; i++) { outPut[i] = d[i].GetBusDayAdjust(Conv); } return(outPut); }
/// <summary> /// Restricted copy constructor. </summary> /// <param name="beanToCopy"> the bean to copy from, not null </param> internal Builder(TermDeposit beanToCopy) { this.buySell_Renamed = beanToCopy.BuySell; this.currency_Renamed = beanToCopy.Currency; this.notional_Renamed = beanToCopy.Notional; this.startDate_Renamed = beanToCopy.StartDate; this.endDate_Renamed = beanToCopy.EndDate; this.businessDayAdjustment_Renamed = beanToCopy.businessDayAdjustment; this.dayCount_Renamed = beanToCopy.DayCount; this.rate_Renamed = beanToCopy.Rate; }
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; }