Пример #1
0
    AssetSwapHelper::AssetSwapHelper(
                          const Handle<Quote>& spread,
                          const Period& tenor,
                          Natural settlementDays,
                          const Calendar& calendar,
                          const Period& fixedPeriod,
                          BusinessDayConvention fixedConvention,
                          const DayCounter& fixedDayCount,
                          const Period& floatPeriod,
                          BusinessDayConvention floatConvention,
                          const DayCounter& floatDayCount,
                          Real recoveryRate,
                          const RelinkableHandle<YieldTermStructure>& yieldTS,
                          const Period& integrationStepSize)
    : DefaultProbabilityHelper(spread),
      tenor_(tenor), settlementDays_(settlementDays), calendar_(calendar),
      fixedConvention_(fixedConvention),
      fixedPeriod_(fixedPeriod), fixedDayCount_(fixedDayCount),
      floatConvention_(floatConvention),
      floatPeriod_(floatPeriod), floatDayCount_(floatDayCount),
      recoveryRate_(recoveryRate), yieldTS_(yieldTS),
      integrationStepSize_(integrationStepSize) {

        initializeDates();

        registerWith(Settings::instance().evaluationDate());
        registerWith(yieldTS);
    }
Пример #2
0
    SwapRateHelper::SwapRateHelper(Rate rate,
                                   const shared_ptr<SwapIndex>& swapIndex,
                                   const Handle<Quote>& spread,
                                   const Period& fwdStart,
                                   const Handle<YieldTermStructure>& discount)
    : RelativeDateRateHelper(rate),
      settlementDays_(swapIndex->fixingDays()),
      tenor_(swapIndex->tenor()), calendar_(swapIndex->fixingCalendar()),
      fixedConvention_(swapIndex->fixedLegConvention()),
      fixedFrequency_(swapIndex->fixedLegTenor().frequency()),
      fixedDayCount_(swapIndex->dayCounter()),
      spread_(spread),
      fwdStart_(fwdStart), discountHandle_(discount) {
        // take fixing into account
        iborIndex_ = swapIndex->iborIndex()->clone(termStructureHandle_);
        // We want to be notified of changes of fixings, but we don't
        // want notifications from termStructureHandle_ (they would
        // interfere with bootstrapping.)
        iborIndex_->unregisterWith(termStructureHandle_);

        registerWith(iborIndex_);
        registerWith(spread_);
        registerWith(discountHandle_);
        initializeDates();
    }
Пример #3
0
 void ForwardSwapQuote::update() {
     if (evaluationDate_ != Settings::instance().evaluationDate()) {
         evaluationDate_ = Settings::instance().evaluationDate();
         initializeDates();
     }
     LazyObject::update();
 }
Пример #4
0
    SwapRateHelper::SwapRateHelper(Rate rate,
                                   const Period& tenor,
                                   const Calendar& calendar,
                                   Frequency fixedFrequency,
                                   BusinessDayConvention fixedConvention,
                                   const DayCounter& fixedDayCount,
                                   const shared_ptr<IborIndex>& iborIndex,
                                   const Handle<Quote>& spread,
                                   const Period& fwdStart,
                                   const Handle<YieldTermStructure>& discount,
                                   Natural settlementDays)
    : RelativeDateRateHelper(rate),
      settlementDays_(settlementDays),
      tenor_(tenor), calendar_(calendar),
      fixedConvention_(fixedConvention),
      fixedFrequency_(fixedFrequency),
      fixedDayCount_(fixedDayCount),
      spread_(spread),
      fwdStart_(fwdStart), discountHandle_(discount) {

        if (settlementDays_==Null<Natural>())
            settlementDays_ = iborIndex->fixingDays();

        // take fixing into account
        iborIndex_ = iborIndex->clone(termStructureHandle_);
        // We want to be notified of changes of fixings, but we don't
        // want notifications from termStructureHandle_ (they would
        // interfere with bootstrapping.)
        iborIndex_->unregisterWith(termStructureHandle_);

        registerWith(iborIndex_);
        registerWith(spread_);
        registerWith(discountHandle_);
        initializeDates();
    }
 UpfrontCdsHelper::UpfrontCdsHelper(
                           Rate upfrontSpread,
                           Rate runningSpread,
                           const Period& tenor,
                           Integer settlementDays,
                           const Calendar& calendar,
                           Frequency frequency,
                           BusinessDayConvention paymentConvention,
                           DateGeneration::Rule rule,
                           const DayCounter& dayCounter,
                           Real recoveryRate,
                           const Handle<YieldTermStructure>& discountCurve,
                           Natural upfrontSettlementDays,
                           bool settlesAccrual,
                           bool paysAtDefaultTime,
                           const Date& startDate,
                           const DayCounter& lastPeriodDayCounter,
                           const bool rebatesAccrual,
                           const CreditDefaultSwap::PricingModel model)
 : CdsHelper(upfrontSpread, tenor, settlementDays, calendar,
             frequency, paymentConvention, rule, dayCounter,
             recoveryRate, discountCurve, settlesAccrual, paysAtDefaultTime,
             startDate, lastPeriodDayCounter, rebatesAccrual, model),
   upfrontSettlementDays_(upfrontSettlementDays),
   runningSpread_(runningSpread) {
     initializeDates();
 }
Пример #6
0
 SwapRateHelper::SwapRateHelper(Rate rate,
                                const Period& tenor,
                                const Calendar& calendar,
                                Frequency fixedFrequency,
                                BusinessDayConvention fixedConvention,
                                const DayCounter& fixedDayCount,
                                const shared_ptr<IborIndex>& iborIndex,
                                const Handle<Quote>& spread,
                                const Period& fwdStart,
                                const Handle<YieldTermStructure>& discount)
 : RelativeDateRateHelper(rate),
   tenor_(tenor), calendar_(calendar),
   fixedConvention_(fixedConvention),
   fixedFrequency_(fixedFrequency),
   fixedDayCount_(fixedDayCount),
   spread_(spread),
   fwdStart_(fwdStart), discountHandle_(discount) {
     // take fixing into account
     iborIndex_ = iborIndex->clone(termStructureHandle_);
     // see above
     iborIndex_->unregisterWith(termStructureHandle_);
     registerWith(iborIndex_);
     registerWith(spread_);
     registerWith(discountHandle_);
     initializeDates();
 }
Пример #7
0
 //! \name Observer interface
 //@{
 void update() {
     if (evaluationDate_ != Settings::instance().evaluationDate()) {
         evaluationDate_ = Settings::instance().evaluationDate();
         initializeDates();
     }
     BootstrapHelper<TS>::update();
 }
    CdsHelper::CdsHelper(Rate quote, const Period &tenor,
                         Integer settlementDays, const Calendar &calendar,
                         Frequency frequency,
                         BusinessDayConvention paymentConvention,
                         DateGeneration::Rule rule,
                         const DayCounter &dayCounter, Real recoveryRate,
                         const Handle<YieldTermStructure> &discountCurve,
                         bool settlesAccrual, bool paysAtDefaultTime,
                         const Date& startDate,
                         const DayCounter &lastPeriodDayCounter,
                         const bool rebatesAccrual,
                         const CreditDefaultSwap::PricingModel model)
        : RelativeDateDefaultProbabilityHelper(quote), tenor_(tenor),
          settlementDays_(settlementDays), calendar_(calendar),
          frequency_(frequency), paymentConvention_(paymentConvention),
          rule_(rule), dayCounter_(dayCounter), recoveryRate_(recoveryRate),
          discountCurve_(discountCurve), settlesAccrual_(settlesAccrual),
          paysAtDefaultTime_(paysAtDefaultTime),
          lastPeriodDC_(lastPeriodDayCounter), rebatesAccrual_(rebatesAccrual),
          model_(model), startDate_(startDate){

        initializeDates();

        registerWith(discountCurve);
    }
Пример #9
0
static void initializeThreadingOnce()
{
    WTI::initializeThreading();
    initializeUString();
#if ENABLE(JSC_MULTIPLE_THREADS)
    s_dtoaP5Mutex = new Mutex;
    initializeDates();
#endif
}
Пример #10
0
    void AssetSwapHelper::setTermStructure(
                                        DefaultProbabilityTermStructure* ts) {
        DefaultProbabilityHelper::setTermStructure(ts);

        probability_.linkTo(
            boost::shared_ptr<DefaultProbabilityTermStructure>(ts, no_deletion),
            false);

        initializeDates();
    }
Пример #11
0
 FraRateHelper::FraRateHelper(Rate rate,
                              Period periodToStart,
                              const shared_ptr<IborIndex>& i)
 : RelativeDateRateHelper(rate), periodToStart_(periodToStart) {
     // take fixing into account
     iborIndex_ = i->clone(termStructureHandle_);
     // see above
     iborIndex_->unregisterWith(termStructureHandle_);
     registerWith(iborIndex_);
     initializeDates();
 }
Пример #12
0
 ForwardSwapQuote::ForwardSwapQuote(
                 const boost::shared_ptr<SwapIndex>& swapIndex,
                 const Handle<Quote>& spread,
                 const Period& fwdStart)
 : swapIndex_(swapIndex), spread_(spread), fwdStart_(fwdStart) {
     registerWith(swapIndex_);
     registerWith(spread_);
     registerWith(Settings::instance().evaluationDate());
     evaluationDate_ = Settings::instance().evaluationDate();
     initializeDates();
 }
Пример #13
0
 DepositRateHelper::DepositRateHelper(Rate rate,
                                      const shared_ptr<IborIndex>& i)
 : RelativeDateRateHelper(rate) {
     // do not use clone, as we do not want to take fixing into account
     iborIndex_ = shared_ptr<IborIndex>(new
         IborIndex("no-fix", // never take fixing into account
                   i->tenor(), i->fixingDays(), Currency(),
                   i->fixingCalendar(), i->businessDayConvention(),
                   i->endOfMonth(), i->dayCounter(), termStructureHandle_));
     initializeDates();
 }
Пример #14
0
static void initializeThreadingOnce()
{
    WTI::initializeThreading();
    wtfThreadData();
    initializeUString();
    TiGlobalData::storeVPtrs();
#if ENABLE(JSC_MULTIPLE_THREADS)
    s_dtoaP5Mutex = new Mutex;
    initializeDates();
#endif
}
Пример #15
0
 OISRateHelper::OISRateHelper(
                 Natural settlementDays,
                 const Period& tenor, // swap maturity
                 const Handle<Quote>& fixedRate,
                 const boost::shared_ptr<OvernightIndex>& overnightIndex)
 : RelativeDateRateHelper(fixedRate),
   settlementDays_(settlementDays), tenor_(tenor),
   overnightIndex_(overnightIndex) {
     registerWith(overnightIndex_);
     initializeDates();
 }
Пример #16
0
 FraRateHelper::FraRateHelper(const Handle<Quote>& rate,
                              Natural monthsToStart,
                              const shared_ptr<IborIndex>& i)
 : RelativeDateRateHelper(rate), periodToStart_(monthsToStart*Months) {
     // take fixing into account
     iborIndex_ = i->clone(termStructureHandle_);
     // We want to be notified of changes of fixings, but we don't
     // want notifications from termStructureHandle_ (they would
     // interfere with bootstrapping.)
     iborIndex_->unregisterWith(termStructureHandle_);
     registerWith(iborIndex_);
     initializeDates();
 }
Пример #17
0
void initializeThreading()
{
    // This should only be called once.
    ASSERT(!atomicallyInitializedStaticMutex);

    // StringImpl::empty() does not construct its static string in a threadsafe fashion,
    // so ensure it has been initialized from here.
    StringImpl::empty();
    atomicallyInitializedStaticMutex = new Mutex;
    threadMapMutex();
    wtfThreadData();
    s_dtoaP5Mutex = new Mutex;
    initializeDates();
}
static void initializeThreadingOnce()
{
    // StringImpl::empty() does not construct its static string in a threadsafe fashion,
    // so ensure it has been initialized from here.
    StringImpl::empty();

    WTF::initializeThreading();
    wtfThreadData();
    JSGlobalData::storeVPtrs();
#if ENABLE(JSC_MULTIPLE_THREADS)
    s_dtoaP5Mutex = new Mutex;
    initializeDates();
    RegisterFile::initializeThreading();
#endif
}
Пример #19
0
 DepositRateHelper::DepositRateHelper(Rate rate,
                                      const Period& tenor,
                                      Natural fixingDays,
                                      const Calendar& calendar,
                                      BusinessDayConvention convention,
                                      bool endOfMonth,
                                      const DayCounter& dayCounter)
 : RelativeDateRateHelper(rate) {
     iborIndex_ = shared_ptr<IborIndex>(new
         IborIndex("no-fix", // never take fixing into account
                   tenor, fixingDays,
                   Currency(), calendar, convention,
                   endOfMonth, dayCounter, termStructureHandle_));
     initializeDates();
 }
Пример #20
0
void initializeThreading() {
  // This should only be called once.
  DCHECK(!atomicallyInitializedStaticMutex);

  // StringImpl::empty() does not construct its static string in a threadsafe
  // fashion, so ensure it has been initialized from here.
  StringImpl::empty();
  StringImpl::empty16Bit();
  atomicallyInitializedStaticMutex = new Mutex;
  wtfThreadData();
  initializeDates();
  // Force initialization of static DoubleToStringConverter converter variable
  // inside EcmaScriptConverter function while we are in single thread mode.
  double_conversion::DoubleToStringConverter::EcmaScriptConverter();
}
Пример #21
0
void initializeThreading()
{
    if (atomicallyInitializedStaticMutex)
        return;

    WTF::double_conversion::initialize();
    // StringImpl::empty() does not construct its static string in a threadsafe fashion,
    // so ensure it has been initialized from here.
    StringImpl::empty();
    atomicallyInitializedStaticMutex = new Mutex;
    threadMapMutex();
    initializeRandomNumberGenerator();
    wtfThreadData();
    s_dtoaP5Mutex = new Mutex;
    initializeDates();
}
Пример #22
0
void initializeThreading()
{
    static bool isInitialized;
    
    if (isInitialized)
        return;

    isInitialized = true;

    WTF::double_conversion::initialize();
    // StringImpl::empty() does not construct its static string in a threadsafe fashion,
    // so ensure it has been initialized from here.
    StringImpl::empty();
    threadMapMutex();
    initializeRandomNumberGenerator();
    wtfThreadData();
    initializeDates();
}
Пример #23
0
void initializeThreading()
{
    if (atomicallyInitializedStaticMutex)
        return;

    // StringImpl::empty() does not construct its static string in a threadsafe fashion,
    // so ensure it has been initialized from here.
    StringImpl::empty();
    atomicallyInitializedStaticMutex = new Mutex;
    threadMapMutex();
    initializeRandomNumberGenerator();
    ThreadIdentifierData::initializeOnce();
    wtfThreadData();
#if ENABLE(WTF_MULTIPLE_THREADS)
    s_dtoaP5Mutex = new Mutex;
    initializeDates();
#endif
}
Пример #24
0
 FxSwapRateHelper::FxSwapRateHelper(const Handle<Quote>& fwdPoint,
                                    const Handle<Quote>& spotFx,
                                    const Period& tenor,
                                    Natural fixingDays,
                                    const Calendar& calendar,
                                    BusinessDayConvention convention,
                                    bool endOfMonth,
                                    bool isFxBaseCurrencyCollateralCurrency,
                                    const Handle<YieldTermStructure>& coll)
                                    : RelativeDateRateHelper(fwdPoint), spot_(spotFx), tenor_(tenor),
   fixingDays_(fixingDays), cal_(calendar), conv_(convention),
   eom_(endOfMonth),
   isFxBaseCurrencyCollateralCurrency_(isFxBaseCurrencyCollateralCurrency),
   collHandle_(coll) {
     registerWith(spot_);
     registerWith(collHandle_);
     initializeDates();
 }
Пример #25
0
 FraRateHelper::FraRateHelper(Rate rate,
                              Period periodToStart,
                              Natural lengthInMonths,
                              Natural fixingDays,
                              const Calendar& calendar,
                              BusinessDayConvention convention,
                              bool endOfMonth,
                              const DayCounter& dayCounter)
 : RelativeDateRateHelper(rate),periodToStart_(periodToStart) {
     // no way to take fixing into account,
     // even if we would like to for FRA over today
     iborIndex_ = shared_ptr<IborIndex>(new
         IborIndex("no-fix", // correct family name would be needed
                   lengthInMonths*Months,
                   fixingDays,
                   Currency(), calendar, convention,
                   endOfMonth, dayCounter, termStructureHandle_));
     initializeDates();
 }
Пример #26
0
 SwapRateHelper::SwapRateHelper(Rate rate,
                                const shared_ptr<SwapIndex>& swapIndex,
                                const Handle<Quote>& spread,
                                const Period& fwdStart,
                                const Handle<YieldTermStructure>& discount)
 : RelativeDateRateHelper(rate),
   tenor_(swapIndex->tenor()), calendar_(swapIndex->fixingCalendar()),
   fixedConvention_(swapIndex->fixedLegConvention()),
   fixedFrequency_(swapIndex->fixedLegTenor().frequency()),
   fixedDayCount_(swapIndex->dayCounter()),
   spread_(spread),
   fwdStart_(fwdStart), discountHandle_(discount) {
     // take fixing into account
     iborIndex_ = swapIndex->iborIndex()->clone(termStructureHandle_);
     // see above
     iborIndex_->unregisterWith(termStructureHandle_);
     registerWith(iborIndex_);
     registerWith(spread_);
     registerWith(discountHandle_);
     initializeDates();
 }
Пример #27
0
 FraRateHelper::FraRateHelper(Rate rate,
                              Natural monthsToStart,
                              Natural monthsToEnd,
                              Natural fixingDays,
                              const Calendar& calendar,
                              BusinessDayConvention convention,
                              bool endOfMonth,
                              const DayCounter& dayCounter)
 : RelativeDateRateHelper(rate),periodToStart_(monthsToStart*Months) {
     QL_REQUIRE(monthsToEnd>monthsToStart,
                "monthsToEnd (" << monthsToEnd <<
                ") must be grater than monthsToStart (" << monthsToStart <<
                ")");
     // no way to take fixing into account,
     // even if we would like to for FRA over today
     iborIndex_ = shared_ptr<IborIndex>(new
         IborIndex("no-fix", // correct family name would be needed
                   (monthsToEnd-monthsToStart)*Months,
                   fixingDays,
                   Currency(), calendar, convention,
                   endOfMonth, dayCounter, termStructureHandle_));
     initializeDates();
 }
 UpfrontCdsHelper::UpfrontCdsHelper(
                           const Handle<Quote>& upfront,
                           Rate runningSpread,
                           const Period& tenor,
                           Integer settlementDays,
                           const Calendar& calendar,
                           Frequency frequency,
                           BusinessDayConvention paymentConvention,
                           DateGeneration::Rule rule,
                           const DayCounter& dayCounter,
                           Real recoveryRate,
                           const Handle<YieldTermStructure>& discountCurve,
                           Natural upfrontSettlementDays,
                           bool settlesAccrual,
                           bool paysAtDefaultTime)
 : CdsHelper(upfront, tenor, settlementDays, calendar,
             frequency, paymentConvention, rule, dayCounter,
             recoveryRate, discountCurve, settlesAccrual,
             paysAtDefaultTime),
   upfrontSettlementDays_(upfrontSettlementDays),
   runningSpread_(runningSpread) {
     initializeDates();
 }
Пример #29
0
 BMASwapRateHelper::BMASwapRateHelper(
                       const Handle<Quote>& liborFraction,
                       const Period& tenor,
                       Natural settlementDays,
                       const Calendar& calendar,
                       // bma leg
                       const Period& bmaPeriod,
                       BusinessDayConvention bmaConvention,
                       const DayCounter& bmaDayCount,
                       const shared_ptr<BMAIndex>& bmaIndex,
                       // libor leg
                       const shared_ptr<IborIndex>& iborIndex)
 : RelativeDateRateHelper(liborFraction),
   tenor_(tenor), settlementDays_(settlementDays),
   calendar_(calendar),
   bmaPeriod_(bmaPeriod),
   bmaConvention_(bmaConvention),
   bmaDayCount_(bmaDayCount),
   bmaIndex_(bmaIndex),
   iborIndex_(iborIndex) {
     registerWith(iborIndex_);
     registerWith(bmaIndex_);
     initializeDates();
 }
Пример #30
0
 DepositRateHelper::DepositRateHelper(Rate rate,
                                      const shared_ptr<IborIndex>& i)
 : RelativeDateRateHelper(rate) {
     iborIndex_ = i->clone(termStructureHandle_);
     initializeDates();
 }