Ejemplo n.º 1
0
Archivo: BTP.cs Proyecto: igitur/qlnet
        public RendistatoCalculator(RendistatoBasket basket, Euribor euriborIndex, Handle <YieldTermStructure> discountCurve)
        {
            basket_            = basket;
            euriborIndex_      = euriborIndex;
            discountCurve_     = discountCurve;
            yields_            = new InitializedList <double>(basket_.size(), 0.05);
            durations_         = new List <double>(basket_.size());
            nSwaps_            = 15; // TODO: generalize number of swaps and their lenghts
            swaps_             = new List <VanillaSwap>(nSwaps_);
            swapLenghts_       = new List <double>(nSwaps_);
            swapBondDurations_ = new InitializedList <double?>(nSwaps_, null);
            swapBondYields_    = new InitializedList <double?>(nSwaps_, 0.05);
            swapRates_         = new InitializedList <double?>(nSwaps_, null);

            basket_.registerWith(update);
            euriborIndex_.registerWith(update);
            discountCurve_.registerWith(update);

            double dummyRate = 0.05;

            for (int i = 0; i < nSwaps_; ++i)
            {
                swapLenghts_[i] = (i + 1);
                swaps_[i]       = new MakeVanillaSwap(new Period((int)swapLenghts_[i], TimeUnit.Years),
                                                      euriborIndex_, dummyRate, new Period(1, TimeUnit.Days))
                                  .withDiscountingTermStructure(discountCurve_);
            }
        }
Ejemplo n.º 2
0
Archivo: BTP.cs Proyecto: minikie/test
      public RendistatoCalculator(RendistatoBasket basket, Euribor euriborIndex, Handle<YieldTermStructure> discountCurve)
      {
         basket_ = basket;
         euriborIndex_ = euriborIndex;
         discountCurve_ = discountCurve;
         yields_ = new InitializedList<double>(basket_.size(), 0.05); 
         durations_ = new List<double>(basket_.size());
         nSwaps_ = 15;  // TODO: generalize number of swaps and their lenghts
         swaps_ = new List<VanillaSwap>(nSwaps_);
         swapLenghts_ = new List<double>(nSwaps_);
         swapBondDurations_ = new InitializedList<double?>(nSwaps_, null);
         swapBondYields_ = new InitializedList<double?>(nSwaps_, 0.05);
         swapRates_ = new InitializedList<double?>(nSwaps_, null);

         basket_.registerWith(update);
         euriborIndex_.registerWith(update);
         discountCurve_.registerWith(update);

         double dummyRate = 0.05;
         for (int i=0; i<nSwaps_; ++i) 
         {
            swapLenghts_[i] = (i+1);
            swaps_[i] = new MakeVanillaSwap( new Period((int)swapLenghts_[i],TimeUnit.Years), 
                                             euriborIndex_, dummyRate, new Period(1,TimeUnit.Days))
                                             .withDiscountingTermStructure(discountCurve_);
         }
      }