本文整理匯總了C#中QLNet.IborIndex類的典型用法代碼示例。如果您正苦於以下問題:C# IborIndex類的具體用法?C# IborIndex怎麽用?C# IborIndex使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
IborIndex類屬於QLNet命名空間,在下文中一共展示了IborIndex類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: 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))
{
}
示例2: SwaptionHelper
SwaptionHelper( Date exerciseDate,
Period length,
Handle<Quote> volatility,
IborIndex index,
Period fixedLegTenor,
DayCounter fixedLegDayCounter,
DayCounter floatingLegDayCounter,
Handle<YieldTermStructure> termStructure,
CalibrationErrorType errorType = CalibrationErrorType.RelativePriceError,
double? strike = null,
double nominal = 1.0)
: base(volatility, termStructure, errorType)
{
exerciseDate_ = exerciseDate;
endDate_ = null;
maturity_ = new Period(0,TimeUnit.Days);
length_ = length;
fixedLegTenor_ = fixedLegTenor;
index_ = index;
fixedLegDayCounter_ = fixedLegDayCounter;
floatingLegDayCounter_ = floatingLegDayCounter;
strike_ = strike;
nominal_ = nominal;
index_.registerWith( update );
}
示例3: FloatingRateBond
public FloatingRateBond(int settlementDays, double faceAmount, Schedule schedule, IborIndex index,
DayCounter paymentDayCounter)
: this(settlementDays, faceAmount, schedule, index, paymentDayCounter, BusinessDayConvention.Following,
0, new List<double>() { 1 }, new List<double>() { 0 }, new List<double>(), new List<double>(),
false, 100, null)
{
}
示例4: 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)
{
}
示例5: 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);
}
示例6: 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);
}
示例7: 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();
}
示例8: DigitalIborLeg
public DigitalIborLeg(Schedule schedule, IborIndex index)
{
schedule_ = schedule;
index_ = index;
paymentAdjustment_ = BusinessDayConvention.Following;
inArrears_ = false;
longCallOption_ = Position.Type.Long;
callATM_ = false;
longPutOption_ = Position.Type.Long;
putATM_ = false;
}
示例9: FRARateHelper
public FRARateHelper(double rate, int monthsToStart, int monthsToEnd, int fixingDays, Calendar calendar,
BusinessDayConvention convention, bool endOfMonth, DayCounter dayCounter)
: base(rate)
{
periodToStart_ = new Period(monthsToStart, TimeUnit.Months);
if (!(monthsToEnd > monthsToStart)) throw new ArgumentException("monthsToEnd must be grater than monthsToStart");
iborIndex_ = new IborIndex("no-fix", new Period(monthsToEnd - monthsToStart, TimeUnit.Months), fixingDays,
new Currency(), calendar, convention, endOfMonth, dayCounter, termStructureHandle_);
initializeDates();
}
示例10: BasisSwap
public BasisSwap(Type type, double nominal,
Schedule float1Schedule, IborIndex iborIndex1, double spread1, DayCounter float1DayCount,
Schedule float2Schedule, IborIndex iborIndex2, double spread2, DayCounter float2DayCount,
BusinessDayConvention? paymentConvention) :
base(2)
{
type_ = type;
nominal_ = nominal;
floating1Schedule_ = float1Schedule;
spread1_ = spread1;
floating1DayCount_ = float1DayCount;
iborIndex1_ = iborIndex1;
floating2Schedule_ = float2Schedule;
spread2_ = spread2;
floating2DayCount_ = float2DayCount;
iborIndex2_ = iborIndex2;
if (paymentConvention.HasValue)
paymentConvention_ = paymentConvention.Value;
else
paymentConvention_ = floating1Schedule_.businessDayConvention();
List<CashFlow> floating1Leg = new IborLeg(float1Schedule, iborIndex1)
.withPaymentDayCounter(float1DayCount)
.withSpreads(spread1)
.withNotionals(nominal)
.withPaymentAdjustment(paymentConvention_);
List<CashFlow> floating2Leg = new IborLeg(float2Schedule, iborIndex2)
.withPaymentDayCounter(float2DayCount)
.withSpreads(spread2)
.withNotionals(nominal)
.withPaymentAdjustment(paymentConvention_);
foreach (var cf in floating1Leg)
cf.registerWith(update);
foreach (var cf in floating2Leg)
cf.registerWith(update);
legs_[0] = floating1Leg;
legs_[1] = floating2Leg;
if (type_ == Type.Payer)
{
payer_[0] = -1;
payer_[1] = +1;
}
else
{
payer_[0] = +1;
payer_[1] = -1;
}
}
示例11: FuturesRateHelper
public FuturesRateHelper(double price, Date immDate, IborIndex i, double convAdj)
: base(price)
{
convAdj_ = new Handle<Quote>(new SimpleQuote(convAdj));
if (!IMM.isIMMdate(immDate, false)) throw new ArgumentException(immDate + "is not a valid IMM date");
earliestDate_ = immDate;
Calendar cal = i.fixingCalendar();
latestDate_ = cal.advance(immDate, i.tenor(), i.businessDayConvention());
yearFraction_ = i.dayCounter().yearFraction(earliestDate_, latestDate_);
}
示例12: SwapIndex
public SwapIndex(string familyName, Period tenor, int settlementDays, Currency currency, Calendar calendar, Period fixedLegTenor, BusinessDayConvention fixedLegConvention, DayCounter fixedLegDayCounter, IborIndex iborIndex, Handle<YieldTermStructure> discountingTermStructure)
: base(familyName, tenor, settlementDays, currency, calendar, fixedLegDayCounter)
{
tenor_ = tenor;
iborIndex_ = iborIndex;
fixedLegTenor_ = fixedLegTenor;
fixedLegConvention_ = fixedLegConvention;
exogenousDiscount_ = true;
discount_ = discountingTermStructure ?? new Handle<YieldTermStructure>();
iborIndex_.registerWith(update);
}
示例13: VanillaSwap
// constructor
public VanillaSwap(Type type, double nominal,
Schedule fixedSchedule, double fixedRate, DayCounter fixedDayCount,
Schedule floatSchedule, IborIndex iborIndex, double spread, DayCounter floatingDayCount,
BusinessDayConvention? paymentConvention = null)
: base(2)
{
type_ = type;
nominal_ = nominal;
fixedSchedule_ = fixedSchedule;
fixedRate_ = fixedRate;
fixedDayCount_ = fixedDayCount;
floatingSchedule_ = floatSchedule;
iborIndex_ = iborIndex;
spread_ = spread;
floatingDayCount_ = floatingDayCount;
if (paymentConvention.HasValue)
paymentConvention_ = paymentConvention.Value;
else
paymentConvention_ = floatingSchedule_.businessDayConvention();
legs_[0] = new FixedRateLeg(fixedSchedule)
.withCouponRates(fixedRate, fixedDayCount)
.withPaymentAdjustment(paymentConvention_)
.withNotionals(nominal);
legs_[1] = new IborLeg(floatSchedule, iborIndex)
.withPaymentDayCounter(floatingDayCount)
//.withFixingDays(iborIndex.fixingDays())
.withSpreads(spread)
.withNotionals(nominal)
.withPaymentAdjustment(paymentConvention_);
foreach (var cf in legs_[1])
cf.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 vanilla-swap type");
}
}
示例14: FloatingLoan
public FloatingLoan(Type type, double nominal,
Schedule floatingSchedule, double floatingSpread, DayCounter floatingDayCount,
Schedule principalSchedule, BusinessDayConvention? paymentConvention, IborIndex index)
: base(2)
{
type_ = type;
nominal_ = nominal;
floatingSchedule_ = floatingSchedule;
floatingSpread_ = floatingSpread;
floatingDayCount_ = floatingDayCount;
principalSchedule_ = principalSchedule;
iborIndex_ = index;
if (paymentConvention.HasValue)
paymentConvention_ = paymentConvention.Value;
else
paymentConvention_ = floatingSchedule_.businessDayConvention();
List<CashFlow> principalLeg = new PricipalLeg(principalSchedule, floatingDayCount)
.withNotionals(nominal)
.withPaymentAdjustment(paymentConvention_)
.withSign(type == Type.Loan ? -1 : 1);
// temporary
for (int i = 0; i < principalLeg.Count - 1; i++)
{
Principal p = (Principal)principalLeg[i];
notionals_.Add(p.nominal());
}
List<CashFlow> floatingLeg = new IborLeg(floatingSchedule, iborIndex_)
.withPaymentDayCounter(floatingDayCount_)
.withSpreads(floatingSpread_)
.withPaymentAdjustment(paymentConvention_)
.withNotionals(notionals_);
legs_[0] = floatingLeg;
legs_[1] = principalLeg;
if (type_ == Type.Loan)
{
payer_[0] = -1;
payer_[1] = +1;
}
else
{
payer_[0] = +1;
payer_[1] = -1;
}
}
示例15: 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());
}