Exemplo n.º 1
0
        ////////////////////////////////////////////////////
        //! RateHelper interface
        public override double impliedQuote()
        {
            if (termStructure_ == null)
            {
                throw new ArgumentException("term structure not set");
            }
            // we didn't register as observers - force calculation
            swap_.recalculate();                // it is from lazy objects
            // weak implementation... to be improved
            const double basisPoint     = 1.0e-4;
            double       floatingLegNPV = swap_.floatingLegNPV();
            double       spread         = this.spread();
            double       spreadNPV      = swap_.floatingLegBPS() / basisPoint * spread;
            double       totNPV         = -(floatingLegNPV + spreadNPV);
            double       result         = totNPV / (swap_.fixedLegBPS() / basisPoint);

            return(result);
        }