本文整理汇总了C#中QLNet.Calendar类的典型用法代码示例。如果您正苦于以下问题:C# Calendar类的具体用法?C# Calendar怎么用?C# Calendar使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Calendar类属于QLNet命名空间,在下文中一共展示了Calendar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BlackConstantVol
public BlackConstantVol(int settlementDays, Calendar cal, Handle<Quote> volatility, DayCounter dc)
: base(settlementDays, cal, BusinessDayConvention.Following, dc)
{
volatility_ = volatility;
volatility_.registerWith(update);
}
示例2: CallableBondConstantVolatility
public CallableBondConstantVolatility(int settlementDays, Calendar calendar, double volatility, DayCounter dayCounter)
:base(settlementDays, calendar)
{
volatility_ = new Handle<Quote>(new SimpleQuote(volatility));
dayCounter_ = dayCounter;
maxBondTenor_ = new Period(100,TimeUnit.Years);
}
示例3: FixedRateBond
//! fixed-rate bond
/*! \ingroup instruments
\test calculations are tested by checking results against
cached values.
*/
//! simple annual compounding coupon rates
public FixedRateBond(int settlementDays, double faceAmount, Schedule schedule,List<double> coupons,
DayCounter accrualDayCounter, BusinessDayConvention paymentConvention = BusinessDayConvention.Following,
double redemption = 100, Date issueDate = null,Calendar paymentCalendar = null,
Period exCouponPeriod = null,
Calendar exCouponCalendar = null,
BusinessDayConvention exCouponConvention = BusinessDayConvention.Unadjusted,
bool exCouponEndOfMonth = false)
: base(settlementDays, paymentCalendar == null ? schedule.calendar() : paymentCalendar,
issueDate)
{
frequency_ = schedule.tenor().frequency();
dayCounter_ = accrualDayCounter;
maturityDate_ = schedule.endDate();
cashflows_ = new FixedRateLeg(schedule)
.withCouponRates(coupons, accrualDayCounter)
.withExCouponPeriod(exCouponPeriod,
exCouponCalendar,
exCouponConvention,
exCouponEndOfMonth)
.withPaymentCalendar(calendar_)
.withNotionals(faceAmount)
.withPaymentAdjustment(paymentConvention);
addRedemptionsToCashflows(new List<double>() { redemption });
if (cashflows().Count == 0)
throw new ApplicationException("bond with no cashflows!");
if (redemptions_.Count != 1)
throw new ApplicationException("multiple redemptions created");
}
示例4: SwaptionVolatilityDiscrete
public SwaptionVolatilityDiscrete(List<Period> optionTenors,
List<Period> swapTenors,
int settlementDays,
Calendar cal,
BusinessDayConvention bdc,
DayCounter dc)
: base(settlementDays, cal, bdc, dc)
{
nOptionTenors_ = optionTenors.Count;
optionTenors_ = optionTenors;
optionDates_ = new InitializedList<Date>(nOptionTenors_);
optionTimes_ = new InitializedList<double>(nOptionTenors_);
optionDatesAsReal_ = new InitializedList<double>(nOptionTenors_);
nSwapTenors_ = swapTenors.Count;
swapTenors_ = swapTenors;
swapLengths_ = new InitializedList<double>(nSwapTenors_);
checkOptionTenors();
initializeOptionDatesAndTimes();
checkSwapTenors();
initializeSwapLengths();
optionInterpolator_ = new LinearInterpolation(optionTimes_,
optionTimes_.Count,
optionDatesAsReal_);
optionInterpolator_.update();
optionInterpolator_.enableExtrapolation();
evaluationDate_ = Settings.evaluationDate();
Settings.registerWith(update);
}
示例5: AmortizingFixedRateBond
public AmortizingFixedRateBond(
int settlementDays,
Calendar calendar,
double faceAmount,
Date startDate,
Period bondTenor,
Frequency sinkingFrequency,
double coupon,
DayCounter accrualDayCounter,
BusinessDayConvention paymentConvention = BusinessDayConvention.Following,
Date issueDate = null)
:base(settlementDays, calendar, issueDate)
{
frequency_ = sinkingFrequency;
dayCounter_ = accrualDayCounter;
Utils.QL_REQUIRE( bondTenor.length() > 0,() =>
"bond tenor must be positive. "
+ bondTenor + " is not allowed." );
maturityDate_ = startDate + bondTenor;
maturityDate_ = startDate + bondTenor;
schedule_ = sinkingSchedule(startDate, bondTenor, sinkingFrequency, calendar);
cashflows_ = new FixedRateLeg(schedule_)
.withCouponRates(coupon, accrualDayCounter)
.withNotionals(sinkingNotionals(bondTenor, sinkingFrequency, coupon, faceAmount))
.withPaymentAdjustment(paymentConvention).value();
addRedemptionsToCashflows();
}
示例6: SwapRateHelper
public SwapRateHelper(double rate, Period tenor, Calendar calendar,
Frequency fixedFrequency, BusinessDayConvention fixedConvention, DayCounter fixedDayCount,
IborIndex iborIndex)
: this(rate, tenor, calendar, fixedFrequency, fixedConvention, fixedDayCount, iborIndex,
new Handle<Quote>(), new Period(0, TimeUnit.Days))
{
}
示例7: CheckHolidayList
public static void CheckHolidayList(IEnumerable<Date> expected, Calendar calendar, int year)
{
IEnumerable<Date> calculated = Calendar.holidayList(calendar, new Date(1, Month.January, year), new Date(31, Month.December, year), false);
int error = 0;
StringBuilder sb = new StringBuilder();
sb.Append("Holidays do not match\n");
foreach (Date date in expected)
{
if (!calculated.Contains(date))
{
sb.Append(" >> Holiday expected but not calculated: ")
.Append(date.DayOfWeek)
.Append(", ")
.Append(date)
.Append('\n');
error++;
}
}
foreach (Date date in calculated)
{
if (!expected.Contains(date))
{
sb.Append(" >> Holiday calculated but not expected: ").Append(date.DayOfWeek).Append(", ").Append(date).Append('\n');
error++;
}
}
Assert.IsFalse(error > 0, sb.ToString());
}
示例8: IborIndex
public IborIndex(string familyName, Period tenor, int settlementDays, Currency currency,
Calendar fixingCalendar, BusinessDayConvention convention, bool endOfMonth,
DayCounter dayCounter)
: this(familyName, tenor, settlementDays, currency,
fixingCalendar, convention, endOfMonth,
dayCounter, new Handle<YieldTermStructure>())
{
}
示例9: ZeroCouponBond
//public ZeroCouponBond(int settlementDays, Calendar calendar, double faceAmount, Date maturityDate,
// BusinessDayConvention paymentConvention = Following,
// double redemption = 100.0,
// Date issueDate = Date());
public ZeroCouponBond(int settlementDays, Calendar calendar, double faceAmount, Date maturityDate,
BusinessDayConvention paymentConvention, double redemption, Date issueDate)
: base(settlementDays, calendar, issueDate)
{
maturityDate_ = maturityDate;
Date redemptionDate = calendar_.adjust(maturityDate, paymentConvention);
setSingleRedemption(faceAmount, redemption, redemptionDate);
}
示例10: DailyTenorLibor
public DailyTenorLibor(string familyName, int settlementDays, Currency currency, Calendar financialCenterCalendar, DayCounter dayCounter, Handle<YieldTermStructure> h)
: base(familyName, new Period(1, TimeUnit.Days), settlementDays, currency, new JointCalendar(new UnitedKingdom(UnitedKingdom.Market.Exchange), financialCenterCalendar, JointCalendar.JointCalendarRule.JoinHolidays), Utils.liborConvention(new Period(1, TimeUnit.Days)), Utils.liborEOM(new Period(1, TimeUnit.Days)), dayCounter, h)
{
if (!(currency != new EURCurrency()))
{
throw new ApplicationException("for EUR Libor dedicated EurLibor constructor must be used");
}
}
示例11: ConstantOptionletVolatility
//! fixed reference date, floating market data
public ConstantOptionletVolatility(Date referenceDate, Calendar cal, BusinessDayConvention bdc,
Handle<Quote> vol, DayCounter dc)
: base(referenceDate, cal, bdc, dc)
{
volatility_ = vol;
volatility_.registerWith(update);
}
示例12: LocalConstantVol
public LocalConstantVol(int settlementDays, Calendar calendar, Handle<Quote> volatility, DayCounter dayCounter)
: base(settlementDays,calendar)
{
volatility_ = volatility;
dayCounter_ = dayCounter;
volatility_.registerWith(update);
}
示例13: EURLibor
public EURLibor(Period tenor, Handle<YieldTermStructure> h)
: base("EURLibor", tenor, 2, new EURCurrency(), new JointCalendar(new UnitedKingdom(UnitedKingdom.Market.Exchange), new TARGET(),
JointCalendar.JointCalendarRule.JoinHolidays),
Utils.eurliborConvention(tenor), Utils.eurliborEOM(tenor), new Actual360(), h) {
target_ = new TARGET();
if (!(this.tenor().units() != TimeUnit.Days))
throw new ApplicationException("for daily tenors (" + this.tenor() + ") dedicated DailyTenor constructor must be used");
}
示例14: DepositRateHelper
public DepositRateHelper(double rate, Period tenor, int fixingDays, Calendar calendar,
BusinessDayConvention convention, bool endOfMonth, DayCounter dayCounter)
: base(rate)
{
iborIndex_ = new IborIndex("no-fix", tenor, fixingDays, new Currency(), calendar, convention,
endOfMonth, dayCounter, termStructureHandle_);
initializeDates();
}
示例15: withExCouponPeriod
public CPILegBase withExCouponPeriod(Period period, Calendar cal, BusinessDayConvention convention, bool endOfMonth = false)
{
exCouponPeriod_ = period;
exCouponCalendar_ = cal;
exCouponAdjustment_ = convention;
exCouponEndOfMonth_ = endOfMonth;
return this;
}