本文整理匯總了C#中QLNet.IborIndex.fixingDays方法的典型用法代碼示例。如果您正苦於以下問題:C# IborIndex.fixingDays方法的具體用法?C# IborIndex.fixingDays怎麽用?C# IborIndex.fixingDays使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類QLNet.IborIndex
的用法示例。
在下文中一共展示了IborIndex.fixingDays方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ForwardRateAgreement
// Handle<YieldTermStructure> discountCurve = Handle<YieldTermStructure>());
public ForwardRateAgreement(Date valueDate, Date maturityDate, Position.Type type, double strikeForwardRate,
double notionalAmount, IborIndex index, Handle<YieldTermStructure> discountCurve)
: base(index.dayCounter(), index.fixingCalendar(), index.businessDayConvention(), index.fixingDays(), new Payoff(),
valueDate, maturityDate, discountCurve) {
fraType_ = type;
notionalAmount_ = notionalAmount;
index_ = index;
if (notionalAmount <= 0.0)
throw new ApplicationException("notional Amount must be positive");
// do I adjust this ?
// valueDate_ = calendar_.adjust(valueDate_,businessDayConvention_);
Date fixingDate = calendar_.advance(valueDate_, -settlementDays_, TimeUnit.Days);
forwardRate_ = new InterestRate(index.fixing(fixingDate), index.dayCounter(), Compounding.Simple, Frequency.Once);
strikeForwardRate_ = new InterestRate(strikeForwardRate, index.dayCounter(), Compounding.Simple, Frequency.Once);
double strike = notionalAmount_ * strikeForwardRate_.compoundFactor(valueDate_, maturityDate_);
payoff_ = new ForwardTypePayoff(fraType_, strike);
// incomeDiscountCurve_ is irrelevant to an FRA
incomeDiscountCurve_ = discountCurve_;
// income is irrelevant to FRA - set it to zero
underlyingIncome_ = 0.0;
index_.registerWith(update);
}
示例2: DepositRateHelper
public DepositRateHelper(double rate, IborIndex i)
: base(rate)
{
iborIndex_ = new IborIndex("no-fix", // never take fixing into account
i.tenor(), i.fixingDays(), new Currency(),
i.fixingCalendar(), i.businessDayConvention(),
i.endOfMonth(), i.dayCounter(), termStructureHandle_);
initializeDates();
}
示例3: FRARateHelper
public FRARateHelper(double rate, int monthsToStart, IborIndex i)
: base(rate)
{
periodToStart_ = new Period(monthsToStart, TimeUnit.Months);
iborIndex_ = new IborIndex("no-fix", // never take fixing into account
i.tenor(), i.fixingDays(), new Currency(),
i.fixingCalendar(), i.businessDayConvention(),
i.endOfMonth(), i.dayCounter(), termStructureHandle_);
initializeDates();
}
示例4: SwaptionHelper
public SwaptionHelper(Period maturity,
Period length,
Handle<Quote> volatility,
IborIndex index,
Period fixedLegTenor,
DayCounter fixedLegDayCounter,
DayCounter floatingLegDayCounter,
Handle<YieldTermStructure> termStructure,
bool calibrateVolatility /*= false*/)
: base(volatility,termStructure, calibrateVolatility)
{
Calendar calendar = index.fixingCalendar();
Period indexTenor = index.tenor();
int fixingDays = index.fixingDays();
Date exerciseDate = calendar.advance(termStructure.link.referenceDate(),
maturity,
index.businessDayConvention());
Date startDate = calendar.advance(exerciseDate,
fixingDays, TimeUnit.Days,
index.businessDayConvention());
Date endDate = calendar.advance(startDate, length,
index.businessDayConvention());
Schedule fixedSchedule=new Schedule(startDate, endDate, fixedLegTenor, calendar,
index.businessDayConvention(),
index.businessDayConvention(),
DateGeneration.Rule.Forward, false);
Schedule floatSchedule=new Schedule(startDate, endDate, index.tenor(), calendar,
index.businessDayConvention(),
index.businessDayConvention(),
DateGeneration.Rule.Forward, false);
IPricingEngine swapEngine=new DiscountingSwapEngine(termStructure);
VanillaSwap temp=new VanillaSwap(VanillaSwap.Type.Receiver, 1.0,
fixedSchedule, 0.0, fixedLegDayCounter,
floatSchedule, index, 0.0, floatingLegDayCounter);
temp.setPricingEngine(swapEngine);
exerciseRate_ = temp.fairRate();
swap_ = new VanillaSwap(VanillaSwap.Type.Receiver, 1.0,
fixedSchedule, exerciseRate_, fixedLegDayCounter,
floatSchedule, index, 0.0, floatingLegDayCounter);
swap_.setPricingEngine(swapEngine);
Exercise exercise=new EuropeanExercise(exerciseDate);
swaption_ = new Swaption(swap_, exercise);
marketValue_ = blackPrice(volatility_.link.value());
}
示例5: BMASwap
public BMASwap(Type type, double nominal,
// Libor leg
Schedule liborSchedule, double liborFraction, double liborSpread, IborIndex liborIndex, DayCounter liborDayCount,
// BMA leg
Schedule bmaSchedule, BMAIndex bmaIndex, DayCounter bmaDayCount)
: base(2)
{
type_ = type;
nominal_ = nominal;
liborFraction_ = liborFraction;
liborSpread_ = liborSpread;
BusinessDayConvention convention = liborSchedule.businessDayConvention();
legs_[0] = new IborLeg(liborSchedule, liborIndex)
.withPaymentDayCounter(liborDayCount)
.withFixingDays(liborIndex.fixingDays())
.withGearings(liborFraction)
.withSpreads(liborSpread)
.withNotionals(nominal)
.withPaymentAdjustment(convention);
legs_[1] = new AverageBMALeg(bmaSchedule, bmaIndex)
.withPaymentDayCounter(bmaDayCount)
.withNotionals(nominal)
.withPaymentAdjustment(bmaSchedule.businessDayConvention());
for (int j=0; j<2; ++j) {
for (int i=0; i<legs_[j].Count; i++)
legs_[j][i].registerWith(update);
}
switch (type_) {
case Type.Payer:
payer_[0] = +1.0;
payer_[1] = -1.0;
break;
case Type.Receiver:
payer_[0] = -1.0;
payer_[1] = +1.0;
break;
default:
throw new ApplicationException("Unknown BMA-swap type");
}
}
示例6: CapHelper
public CapHelper(Period length,
Handle<Quote> volatility,
IborIndex index,
// data for ATM swap-rate calculation
Frequency fixedLegFrequency,
DayCounter fixedLegDayCounter,
bool includeFirstSwaplet,
Handle<YieldTermStructure> termStructure,
bool calibrateVolatility /*= false*/)
: base(volatility, termStructure, calibrateVolatility)
{
Period indexTenor = index.tenor();
double fixedRate = 0.04; // dummy value
Date startDate, maturity;
if (includeFirstSwaplet) {
startDate = termStructure.link.referenceDate();
maturity = termStructure.link.referenceDate() + length;
} else {
startDate = termStructure.link.referenceDate() + indexTenor;
maturity = termStructure.link.referenceDate() + length;
}
IborIndex dummyIndex=new
IborIndex("dummy",
indexTenor,
index.fixingDays(),
index.currency(),
index.fixingCalendar(),
index.businessDayConvention(),
index.endOfMonth(),
termStructure.link.dayCounter(),
termStructure);
List<double> nominals = new InitializedList<double>(1,1.0);
Schedule floatSchedule=new Schedule(startDate, maturity,
index.tenor(), index.fixingCalendar(),
index.businessDayConvention(),
index.businessDayConvention(),
DateGeneration.Rule.Forward, false);
List<CashFlow> floatingLeg;
IborLeg iborLeg = (IborLeg) new IborLeg(floatSchedule, index)
.withFixingDays(0)
.withNotionals(nominals)
.withPaymentAdjustment(index.businessDayConvention());
floatingLeg = iborLeg.value();
Schedule fixedSchedule=new Schedule(startDate, maturity, new Period(fixedLegFrequency),
index.fixingCalendar(),
BusinessDayConvention.Unadjusted, BusinessDayConvention.Unadjusted,
DateGeneration.Rule.Forward, false);
List<CashFlow> fixedLeg = new FixedRateLeg(fixedSchedule)
.withCouponRates(fixedRate, fixedLegDayCounter)
.withNotionals(nominals)
.withPaymentAdjustment(index.businessDayConvention());
Swap swap = new Swap(floatingLeg, fixedLeg);
swap.setPricingEngine(new DiscountingSwapEngine(termStructure));
double bp = 1.0e-4;
double fairRate = fixedRate - (double)(swap.NPV()/(swap.legBPS(1) / bp));
List<double> exerciceRate = new InitializedList<double>(1,fairRate);
cap_ = new Cap(floatingLeg, exerciceRate);
marketValue_ = blackPrice(volatility_.link.value());
}