本文整理汇总了C#中DayCounter类的典型用法代码示例。如果您正苦于以下问题:C# DayCounter类的具体用法?C# DayCounter怎么用?C# DayCounter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DayCounter类属于命名空间,在下文中一共展示了DayCounter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TermStructure
public TermStructure(DayCounter dc)
{
moving_ = false;
updated_ = true;
settlementDays_ = default(int);
dayCounter_ = dc;
}
示例2: FixedRateBond
public FixedRateBond(int settlementDays, double faceAmount, Schedule schedule,
List<double> coupons, DayCounter accrualDayCounter,
BusinessDayConvention paymentConvention, double redemption, Date issueDate)
: this(settlementDays, faceAmount, schedule, coupons, accrualDayCounter,
paymentConvention, redemption, issueDate, new Calendar())
{
}
示例3: FloatingRateCoupon
// constructors
public FloatingRateCoupon(double nominal,
Date paymentDate,
Date startDate,
Date endDate,
int fixingDays,
InterestRateIndex index,
double gearing = 1.0,
double spread = 0.0,
Date refPeriodStart = null,
Date refPeriodEnd = null,
DayCounter dayCounter = null,
bool isInArrears = false)
: base(nominal, paymentDate, startDate, endDate, refPeriodStart, refPeriodEnd)
{
index_ = index;
dayCounter_ = dayCounter ?? index_.dayCounter() ?? new DayCounter();
fixingDays_ = fixingDays == default(int) ? index.fixingDays() : fixingDays;
gearing_ = gearing;
spread_ = spread;
isInArrears_ = isInArrears;
if (gearing_ == 0) throw new ArgumentException("Null gearing not allowed");
// add as observer
index_.registerWith(update);
Settings.registerWith(update);
}
示例4: FlatForward
public FlatForward(Date referenceDate, double forward, DayCounter dayCounter, Compounding compounding, Frequency frequency)
: base(referenceDate, new Calendar(), dayCounter)
{
forward_ = new SimpleQuote(forward);
compounding_ = compounding;
frequency_ = frequency;
}
示例5: BasisSwap
// constructor
public BasisSwap(Type type, double nominal,
Schedule float1Schedule, IborIndex iborIndex1, double spread1, DayCounter float1DayCount,
Schedule float2Schedule, IborIndex iborIndex2, double spread2, DayCounter float2DayCount)
: this(type, nominal, float1Schedule, iborIndex1, spread1, float1DayCount,
float2Schedule, iborIndex2, spread2, float2DayCount, null)
{
}
示例6: FloatingRateBond
public FloatingRateBond(int settlementDays, double faceAmount, Schedule schedule, IborIndex index, DayCounter paymentDayCounter,
BusinessDayConvention paymentConvention, int fixingDays, List<double> gearings, List<double> spreads,
List<double> caps, List<double> floors, bool inArrears, double redemption, Date issueDate)
: base(settlementDays, schedule.calendar(), issueDate)
{
maturityDate_ = schedule.endDate();
cashflows_ = new IborLeg(schedule, index)
.withPaymentDayCounter(paymentDayCounter)
.withFixingDays(fixingDays)
.withGearings(gearings)
.withSpreads(spreads)
.withCaps(caps)
.withFloors(floors)
.inArrears(inArrears)
.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");
index.registerWith(update);
}
示例7: factory
// Factory - for Leg generators
public override CashFlow factory(double nominal, Date paymentDate, Date startDate, Date endDate, int fixingDays,
InterestRateIndex index, double gearing, double spread,
Date refPeriodStart, Date refPeriodEnd, DayCounter dayCounter, bool isInArrears)
{
return new IborCoupon(nominal, paymentDate, startDate, endDate, fixingDays,
(IborIndex)index, gearing, spread, refPeriodStart, refPeriodEnd, dayCounter, isInArrears);
}
示例8: BlackConstantVol
public BlackConstantVol(Date referenceDate, Calendar cal, Handle<Quote> volatility, DayCounter dc)
: base(referenceDate, cal, BusinessDayConvention.Following, dc)
{
volatility_ = volatility;
volatility_.registerWith(update);
}
示例9: 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);
}
示例10: 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))
{
}
示例11: YoYInflationCoupon
public YoYInflationCoupon(Date paymentDate, double nominal, Date startDate, Date endDate, int fixingDays, YoYInflationIndex yoyIndex, Period observationLag, DayCounter dayCounter, double gearing, double spread, Date refPeriodStart, Date refPeriodEnd)
: base(paymentDate, nominal, startDate, endDate, fixingDays, yoyIndex, observationLag, dayCounter, refPeriodStart, refPeriodEnd)
{
yoyIndex_ = yoyIndex;
gearing_ = gearing;
spread_ = spread;
}
示例12: 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");
}
}
示例13: 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);
}
示例14: LocalConstantVol
public LocalConstantVol(int settlementDays, Calendar calendar, Handle<Quote> volatility, DayCounter dayCounter)
: base(settlementDays,calendar)
{
volatility_ = volatility;
dayCounter_ = dayCounter;
volatility_.registerWith(update);
}
示例15: 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();
}