Esempio n. 1
0
 /// <summary>
 /// Creates metadata for a surface providing a SABR expiry-tenor parameter.
 /// <para>
 /// The x-values represent time to expiry year fractions as defined by the specified day count.
 /// The y-values represent tenor year fractions.
 ///
 /// </para>
 /// </summary>
 /// <param name="name">  the surface name </param>
 /// <param name="dayCount">  the day count </param>
 /// <param name="zType">  the z-value type, which must be one of the four SABR values </param>
 /// <returns> the surface metadata </returns>
 public static SurfaceMetadata sabrParameterByExpiryTenor(SurfaceName name, DayCount dayCount, ValueType zType)
 {
     if (!zType.Equals(ValueType.SABR_ALPHA) && !zType.Equals(ValueType.SABR_BETA) && !zType.Equals(ValueType.SABR_RHO) && !zType.Equals(ValueType.SABR_NU))
     {
         throw new System.ArgumentException("SABR z-value type must be SabrAlpha, SabrBeta, SabrRho or SabrNu");
     }
     return(DefaultSurfaceMetadata.builder().surfaceName(name).xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.YEAR_FRACTION).zValueType(zType).dayCount(dayCount).build());
 }
Esempio n. 2
0
 private HullWhiteOneFactorPiecewiseConstantParametersProvider(HullWhiteOneFactorPiecewiseConstantParameters parameters, DayCount dayCount, ZonedDateTime valuationDateTime)
 {
     JodaBeanUtils.notNull(parameters, "parameters");
     JodaBeanUtils.notNull(dayCount, "dayCount");
     JodaBeanUtils.notNull(valuationDateTime, "valuationDateTime");
     this.parameters = parameters;
     this.dayCount = dayCount;
     this.valuationDateTime = valuationDateTime;
 }
Esempio n. 3
0
        public virtual void test_brlCdi()
        {
            OvernightIndex test = OvernightIndex.of("BRL-CDI");

            assertEquals(test.Name, "BRL-CDI");
            assertEquals(test.Currency, BRL);
            assertEquals(test.Active, true);
            assertEquals(test.FixingCalendar, BRBD);
            assertEquals(test.PublicationDateOffset, 1);
            assertEquals(test.EffectiveDateOffset, 0);
            assertEquals(test.DayCount, DayCount.ofBus252(BRBD));
            assertEquals(test.ToString(), "BRL-CDI");
        }
Esempio n. 4
0
 public override Builder set(string propertyName, object newValue)
 {
     switch (propertyName.GetHashCode())
       {
     case 458736106: // parameters
       this.parameters = (HullWhiteOneFactorPiecewiseConstantParameters) newValue;
       break;
     case 1905311443: // dayCount
       this.dayCount = (DayCount) newValue;
       break;
     case -949589828: // valuationDateTime
       this.valuationDateTime = (ZonedDateTime) newValue;
       break;
     default:
       throw new NoSuchElementException("Unknown property: " + propertyName);
       }
       return this;
 }
Esempio n. 5
0
        // explain PV for an accrual period, ignoring compounding
        private void explainPresentValue(RateAccrualPeriod accrualPeriod, DayCount dayCount, Currency currency, double notional, RatesProvider provider, ExplainMapBuilder builder)
        {
            double rawRate    = rateComputationFn.explainRate(accrualPeriod.RateComputation, accrualPeriod.StartDate, accrualPeriod.EndDate, provider, builder);
            double payOffRate = rawRate * accrualPeriod.Gearing + accrualPeriod.Spread;
            double ua         = unitNotionalAccrual(accrualPeriod, accrualPeriod.Spread, provider);

            // Note that the forecast value is not published since this is potentially misleading when
            // compounding is being applied, and when it isn't then it's the same as the forecast
            // value of the payment period.

            builder.put(ExplainKey.ENTRY_TYPE, "AccrualPeriod");
            builder.put(ExplainKey.START_DATE, accrualPeriod.StartDate);
            builder.put(ExplainKey.UNADJUSTED_START_DATE, accrualPeriod.UnadjustedStartDate);
            builder.put(ExplainKey.END_DATE, accrualPeriod.EndDate);
            builder.put(ExplainKey.UNADJUSTED_END_DATE, accrualPeriod.UnadjustedEndDate);
            builder.put(ExplainKey.ACCRUAL_YEAR_FRACTION, accrualPeriod.YearFraction);
            builder.put(ExplainKey.ACCRUAL_DAYS, dayCount.days(accrualPeriod.StartDate, accrualPeriod.EndDate));
            builder.put(ExplainKey.DAYS, (int)DAYS.between(accrualPeriod.StartDate, accrualPeriod.EndDate));
            builder.put(ExplainKey.GEARING, accrualPeriod.Gearing);
            builder.put(ExplainKey.SPREAD, accrualPeriod.Spread);
            builder.put(ExplainKey.PAY_OFF_RATE, accrualPeriod.NegativeRateMethod.adjust(payOffRate));
            builder.put(ExplainKey.UNIT_AMOUNT, ua);
        }
Esempio n. 6
0
 //-------------------------------------------------------------------------
 /// <summary>
 /// Creates metadata for a surface providing a SABR expiry-tenor parameter.
 /// <para>
 /// The x-values represent time to expiry year fractions as defined by the specified day count.
 /// The y-values represent tenor year fractions.
 ///
 /// </para>
 /// </summary>
 /// <param name="name">  the surface name </param>
 /// <param name="dayCount">  the day count </param>
 /// <param name="zType">  the z-value type, which must be one of the four SABR values </param>
 /// <returns> the surface metadata </returns>
 public static SurfaceMetadata sabrParameterByExpiryTenor(string name, DayCount dayCount, ValueType zType)
 {
     return(sabrParameterByExpiryTenor(SurfaceName.of(name), dayCount, zType));
 }
Esempio n. 7
0
 /// <summary>
 /// Creates metadata for a surface providing Normal expiry-simple moneyness volatility.
 /// <para>
 /// The x-values represent time to expiry year fractions as defined by the specified day count.
 /// The y-values represent simple moneyness.
 /// The z-values represent Normal volatility.
 ///
 /// </para>
 /// </summary>
 /// <param name="name">  the surface name </param>
 /// <param name="dayCount">  the day count </param>
 /// <param name="moneynessType">  the moneyness type, prices or rates </param>
 /// <returns> the surface metadata </returns>
 public static SurfaceMetadata normalVolatilityByExpirySimpleMoneyness(SurfaceName name, DayCount dayCount, MoneynessType moneynessType)
 {
     return(DefaultSurfaceMetadata.builder().surfaceName(name).xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.SIMPLE_MONEYNESS).zValueType(ValueType.NORMAL_VOLATILITY).dayCount(dayCount).addInfo(SurfaceInfoType.MONEYNESS_TYPE, moneynessType).build());
 }
Esempio n. 8
0
 //-------------------------------------------------------------------------
 /// <summary>
 /// Creates metadata for a surface providing Normal expiry-simple moneyness volatility.
 /// <para>
 /// The x-values represent time to expiry year fractions as defined by the specified day count.
 /// The y-values represent simple moneyness.
 /// The z-values represent Normal volatility.
 ///
 /// </para>
 /// </summary>
 /// <param name="name">  the surface name </param>
 /// <param name="dayCount">  the day count </param>
 /// <param name="moneynessType">  the moneyness type, prices or rates </param>
 /// <returns> the surface metadata </returns>
 public static SurfaceMetadata normalVolatilityByExpirySimpleMoneyness(string name, DayCount dayCount, MoneynessType moneynessType)
 {
     return(normalVolatilityByExpirySimpleMoneyness(SurfaceName.of(name), dayCount, moneynessType));
 }
Esempio n. 9
0
 /// <summary>
 /// Creates metadata for a surface providing Normal expiry-tenor volatility.
 /// <para>
 /// The x-values represent time to expiry year fractions as defined by the specified day count.
 /// The y-values represent tenor year fractions.
 /// The z-values represent Normal volatility.
 ///
 /// </para>
 /// </summary>
 /// <param name="name">  the surface name </param>
 /// <param name="dayCount">  the day count </param>
 /// <returns> the surface metadata </returns>
 public static SurfaceMetadata normalVolatilityByExpiryTenor(SurfaceName name, DayCount dayCount)
 {
     return(DefaultSurfaceMetadata.builder().surfaceName(name).xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.YEAR_FRACTION).zValueType(ValueType.NORMAL_VOLATILITY).dayCount(dayCount).build());
 }
Esempio n. 10
0
 //-------------------------------------------------------------------------
 /// <summary>
 /// Creates metadata for a surface providing Normal expiry-tenor volatility.
 /// <para>
 /// The x-values represent time to expiry year fractions as defined by the specified day count.
 /// The y-values represent tenor year fractions.
 /// The z-values represent Normal volatility.
 ///
 /// </para>
 /// </summary>
 /// <param name="name">  the surface name </param>
 /// <param name="dayCount">  the day count </param>
 /// <returns> the surface metadata </returns>
 public static SurfaceMetadata normalVolatilityByExpiryTenor(string name, DayCount dayCount)
 {
     return(normalVolatilityByExpiryTenor(SurfaceName.of(name), dayCount));
 }
Esempio n. 11
0
 /// <summary>
 /// Creates metadata for a surface providing Black expiry-log moneyness volatility.
 /// <para>
 /// The x-values represent time to expiry year fractions as defined by the specified day count.
 /// The y-values represent log-moneyness
 /// The z-values represent Black volatility.
 ///
 /// </para>
 /// </summary>
 /// <param name="name">  the surface name </param>
 /// <param name="dayCount">  the day count </param>
 /// <returns> the surface metadata </returns>
 public static SurfaceMetadata blackVolatilityByExpiryLogMoneyness(SurfaceName name, DayCount dayCount)
 {
     return(DefaultSurfaceMetadata.builder().surfaceName(name).xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.LOG_MONEYNESS).zValueType(ValueType.BLACK_VOLATILITY).dayCount(dayCount).build());
 }
        // parses the CDS
        internal Trade parseCds(FpmlDocument document, XmlElement tradeEl, TradeInfoBuilder tradeInfoBuilder)
        {
            XmlElement cdsEl          = tradeEl.getChild("creditDefaultSwap");
            XmlElement generalTermsEl = cdsEl.getChild("generalTerms");
            XmlElement feeLegEl       = cdsEl.getChild("feeLeg");

            document.validateNotPresent(generalTermsEl, "basketReferenceInformation");
            document.validateNotPresent(feeLegEl, "singlePayment");
            BuySell buySell = document.parseBuyerSeller(generalTermsEl, tradeInfoBuilder);

            // effective and termination date are optional in FpML but mandatory for Strata
            AdjustableDate        effectiveDate   = document.parseAdjustableDate(generalTermsEl.getChild("effectiveDate"));
            AdjustableDate        terminationDate = document.parseAdjustableDate(generalTermsEl.getChild("scheduledTerminationDate"));
            BusinessDayAdjustment bda             = generalTermsEl.findChild("dateAdjustments").map(el => document.parseBusinessDayAdjustments(el)).orElse(BusinessDayAdjustment.NONE);

            PeriodicSchedule.Builder scheduleBuilder = PeriodicSchedule.builder().startDate(effectiveDate.Unadjusted).startDateBusinessDayAdjustment(effectiveDate.Adjustment).endDate(terminationDate.Unadjusted).endDateBusinessDayAdjustment(terminationDate.Adjustment).businessDayAdjustment(bda);

            // an upfront fee
            Optional <XmlElement> initialPaymentOptEl = feeLegEl.findChild("initialPayment");
            AdjustablePayment     upfrontFee          = null;

            if (initialPaymentOptEl.Present)
            {
                XmlElement     initialPaymentEl = initialPaymentOptEl.get();
                PayReceive     payRec           = document.parsePayerReceiver(initialPaymentEl, tradeInfoBuilder);
                CurrencyAmount amount           = document.parseCurrencyAmount(initialPaymentEl.getChild("paymentAmount"));
                LocalDate      date             = initialPaymentEl.findChild("adjustablePaymentDate").map(el => document.parseDate(el)).orElse(effectiveDate.Unadjusted);
                AdjustableDate adjDate          = AdjustableDate.of(date, bda);
                upfrontFee = payRec.Pay ? AdjustablePayment.ofPay(amount, adjDate) : AdjustablePayment.ofReceive(amount, adjDate);
            }

            // we require a periodicPayment and fixedAmountCalculation
            XmlElement periodicPaymentEl = feeLegEl.getChild("periodicPayment");

            scheduleBuilder.frequency(periodicPaymentEl.findChild("paymentFrequency").map(el => document.parseFrequency(el)).orElse(Frequency.P3M));
            periodicPaymentEl.findChild("firstPaymentDate").ifPresent(el => scheduleBuilder.firstRegularStartDate(document.parseDate(el)));
            periodicPaymentEl.findChild("firstPeriodStartDate").ifPresent(el => scheduleBuilder.overrideStartDate(AdjustableDate.of(document.parseDate(el))));
            periodicPaymentEl.findChild("lastRegularPaymentDate").ifPresent(el => scheduleBuilder.lastRegularEndDate(document.parseDate(el)));
            scheduleBuilder.rollConvention(periodicPaymentEl.findChild("rollConvention").map(el => document.convertRollConvention(el.Content)).orElse(null));
            XmlElement fixedAmountCalcEl = periodicPaymentEl.getChild("fixedAmountCalculation");
            double     fixedRate         = document.parseDecimal(fixedAmountCalcEl.getChild("fixedRate"));
            DayCount   dayCount          = fixedAmountCalcEl.findChild("dayCountFraction").map(el => document.parseDayCountFraction(el)).orElse(DayCounts.ACT_360);

            // handle a single protectionTerms element
            XmlElement     protectionTermEl = cdsEl.getChild("protectionTerms");
            CurrencyAmount notional         = document.parseCurrencyAmount(protectionTermEl.getChild("calculationAmount"));

            // single name CDS
            Optional <XmlElement> singleOptEl = generalTermsEl.findChild("referenceInformation");

            if (singleOptEl.Present)
            {
                // we require a single entityId
                XmlElement referenceEntityEl = singleOptEl.get().getChild("referenceEntity");
                XmlElement entityIdEl        = referenceEntityEl.getChild("entityId");
                string     scheme            = entityIdEl.findAttribute("entityIdScheme").orElse("http://www.fpml.org/coding-scheme/external/entity-id-RED-1-0");
                string     value             = entityIdEl.Content;
                StandardId entityId          = StandardId.of(scheme, value);
                Cds        cds = Cds.builder().buySell(buySell).legalEntityId(entityId).currency(notional.Currency).notional(notional.Amount).paymentSchedule(scheduleBuilder.build()).fixedRate(fixedRate).dayCount(dayCount).build();
                return(CdsTrade.builder().info(tradeInfoBuilder.build()).product(cds).upfrontFee(upfrontFee).build());
            }

            // CDS index
            Optional <XmlElement> indexOptEl = generalTermsEl.findChild("indexReferenceInformation");

            if (indexOptEl.Present)
            {
                string   indexName = indexOptEl.get().getChild("indexName").Content;
                CdsIndex cdsIndex  = CdsIndex.builder().buySell(buySell).cdsIndexId(StandardId.of("CDX-Name", indexName)).currency(notional.Currency).notional(notional.Amount).paymentSchedule(scheduleBuilder.build()).fixedRate(fixedRate).dayCount(dayCount).build();
                return(CdsIndexTrade.builder().info(tradeInfoBuilder.build()).product(cdsIndex).upfrontFee(upfrontFee).build());
            }

            // unknown type
            throw new FpmlParseException("FpML CDS must be single name or index");
        }
Esempio n. 13
0
 /// <summary>
 /// Creates metadata for a surface providing Black expiry-strike volatility.
 /// <para>
 /// The x-values represent time to expiry year fractions as defined by the specified day count.
 /// The y-values represent strike
 /// The z-values represent Black volatility.
 ///
 /// </para>
 /// </summary>
 /// <param name="name">  the surface name </param>
 /// <param name="dayCount">  the day count </param>
 /// <returns> the surface metadata </returns>
 public static SurfaceMetadata blackVolatilityByExpiryStrike(SurfaceName name, DayCount dayCount)
 {
     return(DefaultSurfaceMetadata.builder().surfaceName(name).xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.STRIKE).zValueType(ValueType.BLACK_VOLATILITY).dayCount(dayCount).build());
 }
        // parse the row to a trade
        private static TermDepositTrade parseRow(CsvRow row, TradeInfo info, TradeCsvInfoResolver resolver)
        {
            BuySell buySell   = LoaderUtils.parseBuySell(row.getValue(BUY_SELL_FIELD));
            double  notional  = LoaderUtils.parseDouble(row.getValue(NOTIONAL_FIELD));
            double  fixedRate = LoaderUtils.parseDoublePercent(row.getValue(FIXED_RATE_FIELD));
            Optional <TermDepositConvention> conventionOpt = row.findValue(CONVENTION_FIELD).map(s => TermDepositConvention.of(s));
            Optional <Period>            tenorOpt          = row.findValue(TENOR_FIELD).map(s => LoaderUtils.parseTenor(s).Period);
            Optional <LocalDate>         startDateOpt      = row.findValue(START_DATE_FIELD).map(s => LoaderUtils.parseDate(s));
            Optional <LocalDate>         endDateOpt        = row.findValue(END_DATE_FIELD).map(s => LoaderUtils.parseDate(s));
            Optional <Currency>          currencyOpt       = row.findValue(CURRENCY_FIELD).map(s => Currency.parse(s));
            Optional <DayCount>          dayCountOpt       = row.findValue(DAY_COUNT_FIELD).map(s => LoaderUtils.parseDayCount(s));
            BusinessDayConvention        dateCnv           = row.findValue(DATE_ADJ_CNV_FIELD).map(s => LoaderUtils.parseBusinessDayConvention(s)).orElse(BusinessDayConventions.MODIFIED_FOLLOWING);
            Optional <HolidayCalendarId> dateCalOpt        = row.findValue(DATE_ADJ_CAL_FIELD).map(s => HolidayCalendarId.of(s));

            // use convention if available
            if (conventionOpt.Present)
            {
                if (currencyOpt.Present || dayCountOpt.Present)
                {
                    throw new System.ArgumentException("TermDeposit trade had invalid combination of fields. When '" + CONVENTION_FIELD + "' is present these fields must not be present: " + ImmutableList.of(CURRENCY_FIELD, DAY_COUNT_FIELD));
                }
                TermDepositConvention convention = conventionOpt.get();
                // explicit dates take precedence over relative ones
                if (startDateOpt.Present && endDateOpt.Present)
                {
                    if (tenorOpt.Present)
                    {
                        throw new System.ArgumentException("TermDeposit trade had invalid combination of fields. When these fields are found " + ImmutableList.of(CONVENTION_FIELD, START_DATE_FIELD, END_DATE_FIELD) + " then these fields must not be present " + ImmutableList.of(TENOR_FIELD));
                    }
                    LocalDate        startDate = startDateOpt.get();
                    LocalDate        endDate   = endDateOpt.get();
                    TermDepositTrade trade     = convention.toTrade(info, startDate, endDate, buySell, notional, fixedRate);
                    return(adjustTrade(trade, dateCnv, dateCalOpt));
                }
                // relative dates
                if (tenorOpt.Present && info.TradeDate.Present)
                {
                    if (startDateOpt.Present || endDateOpt.Present)
                    {
                        throw new System.ArgumentException("TermDeposit trade had invalid combination of fields. When these fields are found " + ImmutableList.of(CONVENTION_FIELD, TENOR_FIELD, TRADE_DATE_FIELD) + " then these fields must not be present " + ImmutableList.of(START_DATE_FIELD, END_DATE_FIELD));
                    }
                    LocalDate        tradeDate     = info.TradeDate.get();
                    Period           periodToStart = tenorOpt.get();
                    TermDepositTrade trade         = convention.createTrade(tradeDate, periodToStart, buySell, notional, fixedRate, resolver.ReferenceData);
                    trade = trade.toBuilder().info(info).build();
                    return(adjustTrade(trade, dateCnv, dateCalOpt));
                }
            }
            else if (startDateOpt.Present && endDateOpt.Present && currencyOpt.Present && dayCountOpt.Present)
            {
                LocalDate           startDate = startDateOpt.get();
                LocalDate           endDate   = endDateOpt.get();
                Currency            currency  = currencyOpt.get();
                DayCount            dayCount  = dayCountOpt.get();
                TermDeposit.Builder builder   = TermDeposit.builder().buySell(buySell).currency(currency).notional(notional).startDate(startDate).endDate(endDate).dayCount(dayCount).rate(fixedRate);
                TermDepositTrade    trade     = TermDepositTrade.of(info, builder.build());
                return(adjustTrade(trade, dateCnv, dateCalOpt));
            }
            // no match
            throw new System.ArgumentException("TermDeposit trade had invalid combination of fields. These fields are mandatory:" + ImmutableList.of(BUY_SELL_FIELD, NOTIONAL_FIELD, FIXED_RATE_FIELD) + " and one of these combinations is mandatory: " + ImmutableList.of(CONVENTION_FIELD, TRADE_DATE_FIELD, TENOR_FIELD) + " or " + ImmutableList.of(CONVENTION_FIELD, START_DATE_FIELD, END_DATE_FIELD) + " or " + ImmutableList.of(START_DATE_FIELD, END_DATE_FIELD, CURRENCY_FIELD, DAY_COUNT_FIELD));
        }
Esempio n. 15
0
 /// <summary>
 /// Obtains an instance from Hull-White model parameters and the date, time and zone for which it is valid.
 /// </summary>
 /// <param name="parameters">  the Hull-White model parameters </param>
 /// <param name="dayCount">  the day count applicable to the model </param>
 /// <param name="valuationDate">  the valuation date </param>
 /// <param name="valuationTime">  the valuation time </param>
 /// <param name="valuationZone">  the valuation time zone </param>
 /// <returns> the provider </returns>
 public static HullWhiteOneFactorPiecewiseConstantParametersProvider of(HullWhiteOneFactorPiecewiseConstantParameters parameters, DayCount dayCount, LocalDate valuationDate, LocalTime valuationTime, ZoneId valuationZone)
 {
     return of(parameters, dayCount, valuationDate.atTime(valuationTime).atZone(valuationZone));
 }
Esempio n. 16
0
 //-------------------------------------------------------------------------
 /// <summary>
 /// Obtains an instance from Hull-White model parameters and the date-time for which it is valid.
 /// </summary>
 /// <param name="parameters">  the Hull-White model parameters </param>
 /// <param name="dayCount">  the day count applicable to the model </param>
 /// <param name="valuationDateTime">  the valuation date-time </param>
 /// <returns> the provider </returns>
 public static HullWhiteOneFactorPiecewiseConstantParametersProvider of(HullWhiteOneFactorPiecewiseConstantParameters parameters, DayCount dayCount, ZonedDateTime valuationDateTime)
 {
     return new HullWhiteOneFactorPiecewiseConstantParametersProvider(parameters, dayCount, valuationDateTime);
 }
Esempio n. 17
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(dataProvider = "dayCount") public void test_day_count(FixedIborSwapConvention convention, com.opengamma.strata.basics.date.DayCount dayCount)
        public virtual void test_day_count(FixedIborSwapConvention convention, DayCount dayCount)
        {
            assertEquals(convention.FixedLeg.DayCount, dayCount);
        }
Esempio n. 18
0
 //-------------------------------------------------------------------------
 /// <summary>
 /// Creates metadata for a surface providing Black expiry-strike volatility.
 /// <para>
 /// The x-values represent time to expiry year fractions as defined by the specified day count.
 /// The y-values represent strike
 /// The z-values represent Black volatility.
 ///
 /// </para>
 /// </summary>
 /// <param name="name">  the surface name </param>
 /// <param name="dayCount">  the day count </param>
 /// <returns> the surface metadata </returns>
 public static SurfaceMetadata blackVolatilityByExpiryStrike(string name, DayCount dayCount)
 {
     return(blackVolatilityByExpiryStrike(SurfaceName.of(name), dayCount));
 }
Esempio n. 19
0
        //-------------------------------------------------------------------------
        // build conventions
        private static OvernightIborSwapConvention makeConvention(string name, OvernightIndex onIndex, IborIndex iborIndex, DayCount dayCount, Frequency frequency, int paymentLag, int cutOffDays, OvernightAccrualMethod accrual)
        {
            HolidayCalendarId calendarOn        = onIndex.FixingCalendar;
            DaysAdjustment    paymentDateOffset = DaysAdjustment.ofBusinessDays(paymentLag, calendarOn);

            return(ImmutableOvernightIborSwapConvention.of(name, OvernightRateSwapLegConvention.builder().index(onIndex).accrualMethod(accrual).accrualFrequency(frequency).paymentFrequency(frequency).paymentDateOffset(paymentDateOffset).stubConvention(StubConvention.SMART_INITIAL).rateCutOffDays(cutOffDays).build(), IborRateSwapLegConvention.of(iborIndex)));
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(dataProvider = "dayCount") public void test_day_count(OvernightIborSwapConvention convention, com.opengamma.strata.basics.date.DayCount dayCount)
        public virtual void test_day_count(OvernightIborSwapConvention convention, DayCount dayCount)
        {
            assertEquals(convention.OvernightLeg.DayCount, dayCount);
            assertEquals(convention.IborLeg.DayCount, dayCount);
        }
Esempio n. 21
0
        //-------------------------------------------------------------------------
        // build conventions
        private static FixedOvernightSwapConvention makeConvention(string name, OvernightIndex index, DayCount dayCount, Frequency frequency, int paymentLag, int spotLag)
        {
            HolidayCalendarId calendar          = index.FixingCalendar;
            DaysAdjustment    paymentDateOffset = DaysAdjustment.ofBusinessDays(paymentLag, calendar);
            DaysAdjustment    spotDateOffset    = DaysAdjustment.ofBusinessDays(spotLag, calendar);

            return(ImmutableFixedOvernightSwapConvention.of(name, FixedRateSwapLegConvention.builder().currency(index.Currency).dayCount(dayCount).accrualFrequency(frequency).accrualBusinessDayAdjustment(BusinessDayAdjustment.of(MODIFIED_FOLLOWING, calendar)).paymentFrequency(frequency).paymentDateOffset(paymentDateOffset).stubConvention(StubConvention.SMART_INITIAL).build(), OvernightRateSwapLegConvention.builder().index(index).accrualMethod(COMPOUNDED).accrualFrequency(frequency).paymentFrequency(frequency).paymentDateOffset(paymentDateOffset).stubConvention(StubConvention.SMART_INITIAL).build(), spotDateOffset));
        }