public override Builder set(string propertyName, object newValue) { switch (propertyName.GetHashCode()) { case 575402001: // currency this.currency_Renamed = (Currency)newValue; break; case 3373707: // name this.name_Renamed = (string)newValue; break; case -1065319863: // businessDayAdjustment this.businessDayAdjustment_Renamed = (BusinessDayAdjustment)newValue; break; case 1905311443: // dayCount this.dayCount_Renamed = (DayCount)newValue; break; case 746995843: // spotDateOffset this.spotDateOffset_Renamed = (DaysAdjustment)newValue; break; default: throw new NoSuchElementException("Unknown property: " + propertyName); } return(this); }
public static double LinearRate_Curve_GetValue(string baseHandle, DateTime asOf, DateTime date, string dayCountStr, string interpolationStr) { InterpMethod interpolation = StrToEnum.InterpolationConvert(interpolationStr); DayCount dayCount = StrToEnum.DayCountConvert(dayCountStr); return(LinearRateFunctions.Curve_GetDiscFactor(baseHandle, asOf, date, dayCount, interpolation)); }
public override Builder set(string propertyName, object newValue) { switch (propertyName.GetHashCode()) { case 3237038: // info this.info_Renamed = (SecurityInfo)newValue; break; case 1585636160: // notional this.notional_Renamed = (AdjustablePayment)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); }
public override Builder set(string propertyName, object newValue) { switch (propertyName.GetHashCode()) { case 3373707: // name this.name = (IborCapletFloorletVolatilitiesName)newValue; break; case 100346066: // index this.index = (IborIndex)newValue; break; case 1905311443: // dayCount this.dayCount = (DayCount)newValue; break; case 2096253127: // interpolator this.interpolator = (GridSurfaceInterpolator)newValue; break; case 1908090253: // shiftCurve this.shiftCurve = (Curve)newValue; break; default: throw new NoSuchElementException("Unknown property: " + propertyName); } return(this); }
public DiscountPaper(uint principal, double discountRate, DayCount basis, DateTime settlement, DateTime maturity) { this.Principal = principal; this.Rate = discountRate; this.DayCountBasis = basis; this.Settlement = settlement; this.Maturity = maturity; }
/// <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; }
// Compute the accrued interest on a given period by approximation private static double approximatedInterest(OvernightIndexObservation observation, LocalDate endDate, OvernightIndexRates rates) { DayCount dayCount = observation.Index.DayCount; double remainingFixingAccrualFactor = dayCount.yearFraction(observation.EffectiveDate, endDate); double forwardRate = rates.periodRate(observation, endDate); return(Math.Log(1.0 + forwardRate * remainingFixingAccrualFactor)); }
/// <summary> /// /// </summary> /// <param name="index"></param> /// <param name="r"></param> /// <param name="cfreq">compounding frequency</param> public ACurve(string index, ISeriesValue <KDateTime, double> r, Frequency cfreq, DayCount dayCount) { Index = index; Rate = r; CompFreq = cfreq; DayCount = dayCount; }
/// <summary> /// Creates metadata for a curve providing a SABR parameter. /// <para> /// The x-values represent time to expiry year fractions as defined by the specified day count. /// /// </para> /// </summary> /// <param name="name"> the curve name </param> /// <param name="dayCount"> the day count </param> /// <param name="yType"> the y-value type, which must be one of the four SABR values </param> /// <returns> the curve metadata </returns> public static CurveMetadata sabrParameterByExpiry(CurveName name, DayCount dayCount, ValueType yType) { if (!yType.Equals(ValueType.SABR_ALPHA) && !yType.Equals(ValueType.SABR_BETA) && !yType.Equals(ValueType.SABR_RHO) && !yType.Equals(ValueType.SABR_NU)) { throw new System.ArgumentException("SABR y-value type must be SabrAlpha, SabrBeta, SabrRho or SabrNu"); } return(DefaultCurveMetadata.builder().curveName(name).xValueType(ValueType.YEAR_FRACTION).yValueType(yType).dayCount(dayCount).build()); }
public FixedDeposit(uint principal, double rate, DayCount basis, DateTime settlement, DateTime maturity) { this.Principal = principal; this.Settlement = settlement; this.Maturity = maturity; this.Rate = rate; this.DayCountBasis = basis; }
public virtual void test_yearFraction_badOrder() { DayCount test = DayCount.of("Bus/252 EUTA"); LocalDate date1 = date(2014, 12, 2); LocalDate date2 = date(2014, 12, 1); assertThrowsIllegalArg(() => test.yearFraction(date1, date2)); }
/// <summary> /// Creates metadata for a curve providing a SABR parameter. /// <para> /// The x-values represent time to expiry year fractions as defined by the specified day count. /// /// </para> /// </summary> /// <param name="name"> the curve name </param> /// <param name="dayCount"> the day count </param> /// <param name="yType"> the y-value type, which must be one of the four SABR values </param> /// <param name="parameterMetadata"> the parameter metadata </param> /// <returns> the curve metadata </returns> public static CurveMetadata sabrParameterByExpiry <T1>(CurveName name, DayCount dayCount, ValueType yType, IList <T1> parameterMetadata) where T1 : com.opengamma.strata.market.param.ParameterMetadata { if (!yType.Equals(ValueType.SABR_ALPHA) && !yType.Equals(ValueType.SABR_BETA) && !yType.Equals(ValueType.SABR_RHO) && !yType.Equals(ValueType.SABR_NU)) { throw new System.ArgumentException("SABR y-value type must be SabrAlpha, SabrBeta, SabrRho or SabrNu"); } return(DefaultCurveMetadata.builder().curveName(name).xValueType(ValueType.YEAR_FRACTION).yValueType(yType).dayCount(dayCount).parameterMetadata(parameterMetadata).build()); }
public SwapSchedule(DateTime asOf, string startTenor, string endTenor, DayCount dayCount, DayRule dayRule, CurveTenor frequency) : base(asOf, startTenor, endTenor, dayCount, dayRule) { // Constructer with tenors instead of dates. this.Frequency = frequency; GenerateSchedule(asOf, StartDate, EndDate, dayCount, dayRule, frequency); }
/// <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(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; }
private FixedRateCalculation(DayCount dayCount, ValueSchedule rate, FixedRateStubCalculation initialStub, FixedRateStubCalculation finalStub) { JodaBeanUtils.notNull(dayCount, "dayCount"); JodaBeanUtils.notNull(rate, "rate"); this.dayCount = dayCount; this.rate = rate; this.initialStub = initialStub; this.finalStub = finalStub; }
/// <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; }
public static double LinearRate_Curve_GetFwdRate(string curveHandle, DateTime asOf, DateTime startDate, string tenorStr, string dayCountStr, string dayRuleStr, string interpolationStr) { CurveTenor tenor = StrToEnum.CurveTenorFromSimpleTenor(tenorStr); InterpMethod interpolation = StrToEnum.InterpolationConvert(interpolationStr); DayCount dayCount = StrToEnum.DayCountConvert(dayCountStr); DayRule dayRule = StrToEnum.DayRuleConvert(dayRuleStr); return(LinearRateFunctions.Curve_GetFwdRate(curveHandle, asOf, startDate, tenor, dayCount, dayRule, interpolation)); }
//------------------------------------------------------------------------- /// <summary> /// Calculates the time to expiry for the valuation date time. /// </summary> /// <param name="valuationDateTime"> the valuation date time </param> /// <param name="dayCount"> the day count </param> /// <param name="refData"> the reference data </param> /// <returns> the time to expiry </returns> public double timeToExpiry(ZonedDateTime valuationDateTime, DayCount dayCount, ReferenceData refData) { LocalDate valuationDate = valuationDateTime.toLocalDate(); LocalDate spotDate = spotDateOffset.adjust(valuationDate, refData); LocalDate deliveryDate = businessDayAdjustment.adjust(spotDate.plus(tenor), refData); LocalDate expiryDate = expiryDateOffset_Renamed.adjust(deliveryDate, refData); return(dayCount.relativeYearFraction(valuationDate, expiryDate)); }
public static string LinearRate_FixedLeg_Make(string baseHandle, DateTime asOf, DateTime startDate, DateTime endDate, double fixedRate, string frequency, string dayCount, string dayRule, double notional) { CurveTenor tenorEnum = StrToEnum.CurveTenorConvert(frequency); DayCount dayCountEnum = StrToEnum.DayCountConvert(dayCount); DayRule dayRuleEnum = StrToEnum.DayRuleConvert(dayRule); LinearRateFunctions.FixedLeg_Make(baseHandle, asOf, startDate, endDate, fixedRate, tenorEnum, dayCountEnum, dayRuleEnum, notional); return(baseHandle); }
/// <summary> /// Restricted copy constructor. </summary> /// <param name="beanToCopy"> the bean to copy from, not null </param> internal Builder(DirectIborCapletFloorletVolatilityDefinition beanToCopy) { this.name_Renamed = beanToCopy.Name; this.index_Renamed = beanToCopy.Index; this.dayCount_Renamed = beanToCopy.DayCount; this.lambdaExpiry_Renamed = beanToCopy.LambdaExpiry; this.lambdaStrike_Renamed = beanToCopy.LambdaStrike; this.interpolator_Renamed = beanToCopy.Interpolator; this.shiftCurve_Renamed = beanToCopy.shiftCurve; }
/// <summary> /// Restricted copy constructor. </summary> /// <param name="beanToCopy"> the bean to copy from, not null </param> internal Builder(OvernightRateCalculation beanToCopy) { this.dayCount_Renamed = beanToCopy.DayCount; this.index_Renamed = beanToCopy.Index; this.accrualMethod_Renamed = beanToCopy.AccrualMethod; this.negativeRateMethod_Renamed = beanToCopy.NegativeRateMethod; this.rateCutOffDays_Renamed = beanToCopy.RateCutOffDays; this.gearing_Renamed = beanToCopy.gearing; this.spread_Renamed = beanToCopy.spread; }
public virtual void test_factory_nameUpper() { DayCount test = DayCount.of("BUS/252 EUTA"); assertEquals(test.Name, "Bus/252 EUTA"); assertEquals(test.ToString(), "Bus/252 EUTA"); assertSame(DayCount.of("Bus/252 EUTA"), test); assertSame(DayCount.ofBus252(EUTA), test); }
public virtual void test_factory_calendar() { DayCount test = DayCount.ofBus252(GBLO); assertEquals(test.Name, "Bus/252 GBLO"); assertEquals(test.ToString(), "Bus/252 GBLO"); assertSame(DayCount.of("Bus/252 GBLO"), test); assertSame(DayCount.ofBus252(GBLO), test); }
/// <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; }
/// <summary> /// Restricted copy constructor. </summary> /// <param name="beanToCopy"> the bean to copy from, not null </param> internal Builder(RatePaymentPeriod beanToCopy) { this.paymentDate_Renamed = beanToCopy.PaymentDate; this.accrualPeriods_Renamed = beanToCopy.AccrualPeriods; this.dayCount_Renamed = beanToCopy.DayCount; this.currency_Renamed = beanToCopy.Currency; this.fxReset_Renamed = beanToCopy.fxReset; this.notional_Renamed = beanToCopy.Notional; this.compoundingMethod_Renamed = beanToCopy.CompoundingMethod; }
public static string LinearRate_OisSwap_Make(string baseHandle, DateTime asOf, string startTenor, string endTenor, string settlementLag, string dayCountFixedStr, string dayCountFloatStr, string dayRuleStr, double notional, double fixedRate, int tradeSign) { DayCount dayCountFloat = StrToEnum.DayCountConvert(dayCountFloatStr); DayCount dayCountFixed = StrToEnum.DayCountConvert(dayCountFixedStr); DayRule dayRule = StrToEnum.DayRuleConvert(dayRuleStr); LinearRateFunctions.OisSwap_Make(baseHandle, asOf, startTenor, endTenor, settlementLag, dayCountFixed, dayCountFloat, dayRule, notional, fixedRate, tradeSign); return(baseHandle); }
public Balancement(IDataFeedProvider dataFeedProvider, IOption option, DateTime dateTmpDebut, int plageEstimation, int periodeRebalancement) { var dateDebut = new DateTime(dateTmpDebut.Year, dateTmpDebut.Month, dateTmpDebut.Day); var priceList = dataFeedProvider.GetDataFeed(option, dateDebut); payoff = payOffaMaturite(option, priceList); pricer = new Pricer(); hedge = new List <decimal>(); priceOption = new List <double>(); dates = new List <DateTime>(); Dictionary <string, double> compo = new Dictionary <string, double> { }; volatilite = Estimateur.Volatilite(priceList, plageEstimation, dateDebut.AddDays(plageEstimation), option, dataFeedProvider); matrixCorrelation = Estimateur.getCorrMatrix(priceList, plageEstimation, dateDebut.AddDays(plageEstimation)); Estimateur.dispMatrix(matrixCorrelation); PricingResults priceDelta = PriceResults(option, priceList[0].PriceList, dateDebut, dataFeedProvider); int i = 0; foreach (string id in option.UnderlyingShareIds) { compo[id] = priceDelta.Deltas[i]; i += 1; } DateTime oldBalancement = dateDebut; portfolio = new Portfolio(Convert.ToDecimal(priceDelta.Price), compo, priceList[0].PriceList); priceOption.Add(priceDelta.Price); hedge.Add(portfolio.portfolioValue); dates.Add(priceList[0].Date); foreach (DataFeed priceAsset_t in priceList.Skip(1)) { if (DayCount.CountBusinessDays(oldBalancement, priceAsset_t.Date) >= periodeRebalancement || priceAsset_t == priceList.Last()) { priceDelta = PriceResults(option, priceAsset_t.PriceList, dateDebut, dataFeedProvider); priceOption.Add(priceDelta.Price); portfolio.UpdatePortfolioValue(priceAsset_t, dataFeedProvider.NumberOfDaysPerYear, oldBalancement); i = 0; foreach (string id in option.UnderlyingShareIds) { compo[id] = priceDelta.Deltas[i]; i += 1; } hedge.Add(portfolio.portfolioValue); dates.Add(priceAsset_t.Date); portfolio.UpdateLiquidity(priceAsset_t); portfolio.UpdateCompo(compo); oldBalancement = priceAsset_t.Date; } } }
// Compute the accrued interest sensitivity on a given period by approximation private static PointSensitivityBuilder approximatedInterestSensitivity(OvernightIndexObservation observation, LocalDate endDate, OvernightIndexRates rates) { DayCount dayCount = observation.Index.DayCount; double remainingFixingAccrualFactor = dayCount.yearFraction(observation.EffectiveDate, endDate); double forwardRate = rates.periodRate(observation, endDate); PointSensitivityBuilder forwardRateSensitivity = rates.periodRatePointSensitivity(observation, endDate); double rateExp = 1.0 + forwardRate * remainingFixingAccrualFactor; forwardRateSensitivity = forwardRateSensitivity.multipliedBy(remainingFixingAccrualFactor / rateExp); return(forwardRateSensitivity); }
protected SwapLeg(DateTime asOf, DateTime startDate, DateTime endDate, CurveTenor referenceTenor, DayCount dayCount, DayRule dayRule, double notional) { Schedule = new MasterThesis.SwapSchedule(asOf, startDate, endDate, dayCount, dayRule, referenceTenor); this.Tenor = referenceTenor; this.DayRule = dayRule; this.DayCount = dayCount; this.Notional = notional; this.AsOf = asOf; this.StartDate = startDate; this.EndDate = endDate; }