public override Builder set(string propertyName, object newValue) { switch (propertyName.GetHashCode()) { case 3575610: // type this.type_Renamed = (SwapLegType)newValue; break; case -885469925: // payReceive this.payReceive_Renamed = (PayReceive)newValue; break; case -2129778896: // startDate this.startDate_Renamed = (AdjustableDate)newValue; break; case -1607727319: // endDate this.endDate_Renamed = (AdjustableDate)newValue; break; case 575402001: // currency this.currency_Renamed = (Currency)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(SwapLegAmount beanToCopy) { this.amount_Renamed = beanToCopy.Amount; this.payReceive_Renamed = beanToCopy.PayReceive; this.type_Renamed = beanToCopy.Type; this.currency_Renamed = beanToCopy.Currency; }
public override Builder set(string propertyName, object newValue) { switch (propertyName.GetHashCode()) { case -1413853096: // amount this.amount_Renamed = (CurrencyAmount)newValue; break; case -885469925: // payReceive this.payReceive_Renamed = (PayReceive)newValue; break; case 3575610: // type this.type_Renamed = (SwapLegType)newValue; break; case 575402001: // currency this.currency_Renamed = (Currency)newValue; break; default: throw new NoSuchElementException("Unknown property: " + propertyName); } return(this); }
public override Builder set(string propertyName, object newValue) { switch (propertyName.GetHashCode()) { case -885469925: // payReceive this.payReceive_Renamed = (PayReceive)newValue; break; case 304659814: // accrualSchedule this.accrualSchedule_Renamed = (PeriodicSchedule)newValue; break; case -1499086147: // paymentSchedule this.paymentSchedule_Renamed = (PaymentSchedule)newValue; break; case 1447860727: // notionalSchedule this.notionalSchedule_Renamed = (NotionalSchedule)newValue; break; case -934682935: // calculation this.calculation_Renamed = (RateCalculation)newValue; break; default: throw new NoSuchElementException("Unknown property: " + propertyName); } return(this); }
public override Builder set(string propertyName, object newValue) { switch (propertyName.GetHashCode()) { case -885469925: // payReceive this.payReceive_Renamed = (PayReceive)newValue; break; case 304659814: // accrualSchedule this.accrualSchedule_Renamed = (PeriodicSchedule)newValue; break; case -1499086147: // paymentSchedule this.paymentSchedule_Renamed = (PaymentSchedule)newValue; break; case -1413853096: // amount this.amount_Renamed = (ValueSchedule)newValue; break; case 575402001: // currency this.currency_Renamed = (Currency)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(MockSwapLeg beanToCopy) { this.type_Renamed = beanToCopy.Type; this.payReceive_Renamed = beanToCopy.PayReceive; this.startDate_Renamed = beanToCopy.StartDate; this.endDate_Renamed = beanToCopy.EndDate; this.currency_Renamed = beanToCopy.Currency; }
private MockSwapLeg(SwapLegType type, PayReceive payReceive, AdjustableDate startDate, AdjustableDate endDate, Currency currency) { this.type = type; this.payReceive = payReceive; this.startDate = startDate; this.endDate = endDate; this.currency = currency; }
/// <summary> /// Restricted copy constructor. </summary> /// <param name="beanToCopy"> the bean to copy from, not null </param> internal Builder(RateCalculationSwapLeg beanToCopy) { this.payReceive_Renamed = beanToCopy.PayReceive; this.accrualSchedule_Renamed = beanToCopy.AccrualSchedule; this.paymentSchedule_Renamed = beanToCopy.PaymentSchedule; this.notionalSchedule_Renamed = beanToCopy.NotionalSchedule; this.calculation_Renamed = beanToCopy.Calculation; }
/// <summary> /// Restricted copy constructor. </summary> /// <param name="beanToCopy"> the bean to copy from, not null </param> internal Builder(KnownAmountSwapLeg beanToCopy) { this.payReceive_Renamed = beanToCopy.PayReceive; this.accrualSchedule_Renamed = beanToCopy.AccrualSchedule; this.paymentSchedule_Renamed = beanToCopy.PaymentSchedule; this.amount_Renamed = beanToCopy.Amount; this.currency_Renamed = beanToCopy.Currency; }
// parse a single leg private static RateCalculationSwapLeg parseLeg(CsvRow row, string leg, FloatingRateIndex index, DayCount defaultFixedLegDayCount) { PayReceive payReceive = LoaderUtils.parsePayReceive(getValue(row, leg, DIRECTION_FIELD)); PeriodicSchedule accrualSch = parseAccrualSchedule(row, leg); PaymentSchedule paymentSch = parsePaymentSchedule(row, leg, accrualSch.Frequency); NotionalSchedule notionalSch = parseNotionalSchedule(row, leg); RateCalculation calc = parseRateCalculation(row, leg, index, defaultFixedLegDayCount, accrualSch.BusinessDayAdjustment, notionalSch.Currency); return(RateCalculationSwapLeg.builder().payReceive(payReceive).accrualSchedule(accrualSch).paymentSchedule(paymentSch).notionalSchedule(notionalSch).calculation(calc).build()); }
private BulletPayment(PayReceive payReceive, CurrencyAmount value, AdjustableDate date) { JodaBeanUtils.notNull(payReceive, "payReceive"); JodaBeanUtils.notNull(value, "value"); JodaBeanUtils.notNull(date, "date"); this.payReceive = payReceive; this.value = value; this.date = date; validate(); }
/// <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 SwapLegAmount(CurrencyAmount amount, PayReceive payReceive, SwapLegType type, Currency currency) { JodaBeanUtils.notNull(amount, "amount"); JodaBeanUtils.notNull(payReceive, "payReceive"); JodaBeanUtils.notNull(type, "type"); JodaBeanUtils.notNull(currency, "currency"); this.amount = amount; this.payReceive = payReceive; this.type = type; this.currency = currency; }
private RateCalculationSwapLeg(PayReceive payReceive, PeriodicSchedule accrualSchedule, PaymentSchedule paymentSchedule, NotionalSchedule notionalSchedule, RateCalculation calculation) { JodaBeanUtils.notNull(payReceive, "payReceive"); JodaBeanUtils.notNull(accrualSchedule, "accrualSchedule"); JodaBeanUtils.notNull(paymentSchedule, "paymentSchedule"); JodaBeanUtils.notNull(notionalSchedule, "notionalSchedule"); JodaBeanUtils.notNull(calculation, "calculation"); this.payReceive = payReceive; this.accrualSchedule = accrualSchedule; this.paymentSchedule = paymentSchedule; this.notionalSchedule = notionalSchedule; this.calculation = calculation; }
private KnownAmountSwapLeg(PayReceive payReceive, PeriodicSchedule accrualSchedule, PaymentSchedule paymentSchedule, ValueSchedule amount, Currency currency) { JodaBeanUtils.notNull(payReceive, "payReceive"); JodaBeanUtils.notNull(accrualSchedule, "accrualSchedule"); JodaBeanUtils.notNull(paymentSchedule, "paymentSchedule"); JodaBeanUtils.notNull(amount, "amount"); JodaBeanUtils.notNull(currency, "currency"); this.payReceive = payReceive; this.accrualSchedule = accrualSchedule; this.paymentSchedule = paymentSchedule; this.amount = amount; this.currency = currency; }
//------------------------------------------------------------------------- public SwapTrade toTrade(TradeInfo tradeInfo, LocalDate startDate, LocalDate endDate, BuySell buySell, double notional, double spread) { Optional <LocalDate> tradeDate = tradeInfo.TradeDate; if (tradeDate.Present) { ArgChecker.inOrderOrEqual(tradeDate.get(), startDate, "tradeDate", "startDate"); } SwapLeg leg1 = spreadLeg.toLeg(startDate, endDate, PayReceive.ofPay(buySell.Buy), notional, spread); SwapLeg leg2 = flatLeg.toLeg(startDate, endDate, PayReceive.ofPay(buySell.Sell), notional); return(SwapTrade.builder().info(tradeInfo).product(Swap.of(leg1, leg2)).build()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @ImmutableConstructor private IborCapFloorLeg(com.opengamma.strata.product.common.PayReceive payReceive, com.opengamma.strata.basics.schedule.PeriodicSchedule paymentSchedule, com.opengamma.strata.basics.date.DaysAdjustment paymentDateOffset, com.opengamma.strata.basics.currency.Currency currency, com.opengamma.strata.basics.value.ValueSchedule notional, com.opengamma.strata.product.swap.IborRateCalculation calculation, com.opengamma.strata.basics.value.ValueSchedule capSchedule, com.opengamma.strata.basics.value.ValueSchedule floorSchedule) private IborCapFloorLeg(PayReceive payReceive, PeriodicSchedule paymentSchedule, DaysAdjustment paymentDateOffset, Currency currency, ValueSchedule notional, IborRateCalculation calculation, ValueSchedule capSchedule, ValueSchedule floorSchedule) { this.payReceive = ArgChecker.notNull(payReceive, "payReceive"); this.paymentSchedule = ArgChecker.notNull(paymentSchedule, "paymentSchedule"); this.paymentDateOffset = ArgChecker.notNull(paymentDateOffset, "paymentDateOffset"); this.currency = currency != null ? currency : calculation.Index.Currency; this.notional = notional; this.calculation = ArgChecker.notNull(calculation, "calculation"); this.capSchedule = capSchedule; this.floorSchedule = floorSchedule; ArgChecker.isTrue(!this.PaymentSchedule.StubConvention.Present || this.PaymentSchedule.StubConvention.get().Equals(StubConvention.NONE), "Stub period is not allowed"); ArgChecker.isFalse(this.CapSchedule.Present == this.FloorSchedule.Present, "One of cap schedule and floor schedule should be empty"); ArgChecker.isTrue(this.Calculation.Index.Tenor.Period.Equals(this.PaymentSchedule.Frequency.Period), "Payment frequency period should be the same as index tenor period"); }
//------------------------------------------------------------------------- //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @ImmutableConstructor private ResolvedCmsLeg(com.opengamma.strata.product.common.PayReceive payReceive, java.util.List<CmsPeriod> cmsPeriods) private ResolvedCmsLeg(PayReceive payReceive, IList <CmsPeriod> cmsPeriods) { this.payReceive = ArgChecker.notNull(payReceive, "payReceive"); this.cmsPeriods = ImmutableList.copyOf(cmsPeriods); //JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter: //JAVA TO C# CONVERTER TODO TASK: Most Java stream collectors are not converted by Java to C# Converter: ISet <Currency> currencies = this.cmsPeriods.Select(CmsPeriod::getCurrency).collect(Collectors.toSet()); ArgChecker.isTrue(currencies.Count == 1, "Leg must have a single currency, found: " + currencies); //JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter: //JAVA TO C# CONVERTER TODO TASK: Most Java stream collectors are not converted by Java to C# Converter: ISet <SwapIndex> swapIndices = this.cmsPeriods.Select(CmsPeriod::getIndex).collect(Collectors.toSet()); ArgChecker.isTrue(swapIndices.Count == 1, "Leg must have a single swap index: " + swapIndices); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") @Override public Builder set(String propertyName, Object newValue) public override Builder set(string propertyName, object newValue) { switch (propertyName.GetHashCode()) { case -885469925: // payReceive this.payReceive_Renamed = (PayReceive)newValue; break; case 2121598281: // cmsPeriods this.cmsPeriods_Renamed = (IList <CmsPeriod>)newValue; break; default: throw new NoSuchElementException("Unknown property: " + propertyName); } return(this); }
public override Builder set(string propertyName, object newValue) { switch (propertyName.GetHashCode()) { case -885469925: // payReceive this.payReceive_Renamed = (PayReceive)newValue; break; case -1499086147: // paymentSchedule this.paymentSchedule_Renamed = (PeriodicSchedule)newValue; break; case -716438393: // paymentDateOffset this.paymentDateOffset_Renamed = (DaysAdjustment)newValue; break; case 575402001: // currency this.currency_Renamed = (Currency)newValue; break; case 1585636160: // notional this.notional_Renamed = (ValueSchedule)newValue; break; case -934682935: // calculation this.calculation_Renamed = (IborRateCalculation)newValue; break; case -596212599: // capSchedule this.capSchedule_Renamed = (ValueSchedule)newValue; break; case -1562227005: // floorSchedule this.floorSchedule_Renamed = (ValueSchedule)newValue; break; default: throw new NoSuchElementException("Unknown property: " + propertyName); } return(this); }
public override Builder set(string propertyName, object newValue) { switch (propertyName.GetHashCode()) { case -885469925: // payReceive this.payReceive_Renamed = (PayReceive)newValue; break; case 111972721: // value this.value_Renamed = (CurrencyAmount)newValue; break; case 3076014: // date this.date_Renamed = (AdjustableDate)newValue; break; default: throw new NoSuchElementException("Unknown property: " + propertyName); } return(this); }
// parses the swap internal Swap parseSwap(FpmlDocument document, XmlElement tradeEl, TradeInfoBuilder tradeInfoBuilder) { XmlElement swapEl = tradeEl.getChild("swap"); ImmutableList <XmlElement> legEls = swapEl.getChildren("swapStream"); ImmutableList.Builder <SwapLeg> legsBuilder = ImmutableList.builder(); foreach (XmlElement legEl in legEls) { // calculation XmlElement calcPeriodAmountEl = legEl.getChild("calculationPeriodAmount"); XmlElement calcEl = calcPeriodAmountEl.findChild("calculation").orElse(XmlElement.ofChildren("calculation", ImmutableList.of())); PeriodicSchedule accrualSchedule = parseSwapAccrualSchedule(legEl, document); PaymentSchedule paymentSchedule = parseSwapPaymentSchedule(legEl, calcEl, document); // known amount or rate calculation Optional <XmlElement> knownAmountOptEl = calcPeriodAmountEl.findChild("knownAmountSchedule"); if (knownAmountOptEl.Present) { XmlElement knownAmountEl = knownAmountOptEl.get(); document.validateNotPresent(legEl, "stubCalculationPeriodAmount"); document.validateNotPresent(legEl, "resetDates"); // pay/receive and counterparty PayReceive payReceive = document.parsePayerReceiver(legEl, tradeInfoBuilder); ValueSchedule amountSchedule = parseSchedule(knownAmountEl, document); // build legsBuilder.add(KnownAmountSwapLeg.builder().payReceive(payReceive).accrualSchedule(accrualSchedule).paymentSchedule(paymentSchedule).amount(amountSchedule).currency(document.parseCurrency(knownAmountEl.getChild("currency"))).build()); } else { document.validateNotPresent(calcEl, "fxLinkedNotionalSchedule"); document.validateNotPresent(calcEl, "futureValueNotional"); // pay/receive and counterparty PayReceive payReceive = document.parsePayerReceiver(legEl, tradeInfoBuilder); NotionalSchedule notionalSchedule = parseSwapNotionalSchedule(legEl, calcEl, document); RateCalculation calculation = parseSwapCalculation(legEl, calcEl, accrualSchedule, document); // build legsBuilder.add(RateCalculationSwapLeg.builder().payReceive(payReceive).accrualSchedule(accrualSchedule).paymentSchedule(paymentSchedule).notionalSchedule(notionalSchedule).calculation(calculation).build()); } } return(Swap.of(legsBuilder.build())); }
public static MockSwapLeg of(SwapLegType type, PayReceive payReceive, LocalDate startDate, LocalDate endDate, Currency currency) { return(new MockSwapLeg(type, payReceive, AdjustableDate.of(startDate), AdjustableDate.of(endDate), currency)); }
// ibor rate leg private static SwapLeg iborLeg(LocalDate start, LocalDate end, IborIndex index, PayReceive payReceive, NotionalSchedule notional, StubConvention stubConvention) { Frequency freq = Frequency.of(index.Tenor.Period); return(RateCalculationSwapLeg.builder().payReceive(payReceive).accrualSchedule(PeriodicSchedule.builder().startDate(start).endDate(end).frequency(freq).businessDayAdjustment(BDA_MF).stubConvention(stubConvention).build()).paymentSchedule(PaymentSchedule.builder().paymentFrequency(freq).paymentDateOffset(DaysAdjustment.NONE).build()).notionalSchedule(notional).calculation(IborRateCalculation.builder().index(index).fixingDateOffset(DaysAdjustment.ofBusinessDays(-2, index.FixingCalendar, BDA_P)).build()).build()); }
//----------------------------------------------------------------------- /// <summary> /// Sets whether the leg is pay or receive. /// <para> /// A value of 'Pay' implies that the resulting amount is paid to the counterparty. /// A value of 'Receive' implies that the resulting amount is received from the counterparty. /// </para> /// </summary> /// <param name="payReceive"> the new value, not null </param> /// <returns> this, for chaining, not null </returns> public Builder payReceive(PayReceive payReceive) { JodaBeanUtils.notNull(payReceive, "payReceive"); this.payReceive_Renamed = payReceive; return(this); }
//------------------------------------------------------------------------- /// <summary> /// Creates a leg based on this convention. /// <para> /// This returns a leg based on the specified date. /// The notional is unsigned, with pay/receive determining the direction of the leg. /// If the leg is 'Pay', the fixed rate is paid to the counterparty. /// If the leg is 'Receive', the fixed rate is received from the counterparty. /// /// </para> /// </summary> /// <param name="startDate"> the start date </param> /// <param name="endDate"> the end date </param> /// <param name="payReceive"> determines if the leg is to be paid or received </param> /// <param name="notional"> the business day adjustment to apply to accrual schedule dates </param> /// <returns> the leg </returns> public RateCalculationSwapLeg toLeg(LocalDate startDate, LocalDate endDate, PayReceive payReceive, double notional) { return(RateCalculationSwapLeg.builder().payReceive(payReceive).accrualSchedule(PeriodicSchedule.builder().startDate(startDate).endDate(endDate).frequency(Frequency.TERM).businessDayAdjustment(accrualBusinessDayAdjustment).build()).paymentSchedule(PaymentSchedule.builder().paymentFrequency(Frequency.TERM).paymentDateOffset(paymentDateOffset).build()).calculation(InflationRateCalculation.builder().index(index).indexCalculationMethod(indexCalculationMethod).lag(lag).build()).notionalSchedule(NotionalSchedule.of(Currency, notional)).build()); }
//------------------------------------------------------------------------- /// <summary> /// Gets the first pay or receive leg of the swap. /// <para> /// This returns the first pay or receive leg of the swap, empty if no matching leg. /// /// </para> /// </summary> /// <param name="payReceive"> the pay or receive flag </param> /// <returns> the first matching leg of the swap </returns> public Optional <SwapLeg> getLeg(PayReceive payReceive) { return(legs.Where(leg => leg.PayReceive == payReceive).First()); }
/// <summary> /// Sets the payReceive. </summary> /// <param name="payReceive"> the new value </param> /// <returns> this, for chaining, not null </returns> public Builder payReceive(PayReceive payReceive) { this.payReceive_Renamed = payReceive; return(this); }
/// <summary> /// Restricted copy constructor. </summary> /// <param name="beanToCopy"> the bean to copy from, not null </param> internal Builder(ResolvedCmsLeg beanToCopy) { this.payReceive_Renamed = beanToCopy.PayReceive; this.cmsPeriods_Renamed = beanToCopy.CmsPeriods; }
private static SwapLeg fixedLeg(LocalDate start, LocalDate end, Frequency frequency, PayReceive payReceive, NotionalSchedule notional, double fixedRate, StubConvention stubConvention) { return(RateCalculationSwapLeg.builder().payReceive(payReceive).accrualSchedule(PeriodicSchedule.builder().startDate(start).endDate(end).frequency(frequency).businessDayAdjustment(BDA_MF).stubConvention(stubConvention).build()).paymentSchedule(PaymentSchedule.builder().paymentFrequency(frequency).paymentDateOffset(DaysAdjustment.NONE).build()).notionalSchedule(notional).calculation(FixedRateCalculation.of(fixedRate, THIRTY_U_360)).build()); }