Assembla home | Assembla project page
 

Changeset 210

Show
Ignore:
Timestamp:
06/16/08 22:40:02 (3 months ago)
Author:
snovik
Message:

ops. Forgot something

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/QLNet/QLNet/Termstructures/Yield/PiecewiseYieldCurve.cs

    r209 r210  
    124124 
    125125        protected override double discountImpl(double t) { 
    126             // recheck 
    127             calculate(); 
    128  
    129             //    if (!turnOfYearEffect_.empty() && t > turnOfYear_) { 
    130             //        if (!turnOfYearEffect_.link.isValid()) 
    131             //            throw new ArgumentException("invalid turnOfYearEffect quote"); 
    132             //        double turnOfYearEffect = turnOfYearEffect_.link.value(); 
    133             //        if (!(turnOfYearEffect > 0.0 && turnOfYearEffect <= 1.0)) 
    134             //            throw new ArgumentException("invalid turnOfYearEffect value: " + turnOfYearEffect); 
    135             //        return turnOfYearEffect; 
    136             //    } 
    137             //} 
     126            calculate(); 
     127 
     128            if (jumps_.Count != 0) { 
     129                double jumpEffect = 1.0; 
     130                for (int i=0; i<nJumps_ && jumpTimes_[i]<t; ++i) { 
     131                    if (!(jumps_[i].link.isValid())) 
     132                        throw new ApplicationException("invalid " + (i+1) + " jump quote"); 
     133                    double thisJump = jumps_[i].link.value(); 
     134                    if (!(thisJump > 0.0 && thisJump <= 1.0)) 
     135                        throw new ApplicationException("invalid " + (i+1) + " jump value: " + thisJump); 
     136                    jumpEffect *= thisJump; 
     137                } 
     138                return jumpEffect * traits_.discountImpl(interpolation_, t); 
     139            } 
    138140            return traits_.discountImpl(interpolation_, t); 
    139141        } 
     142 
    140143        protected override double zeroYieldImpl(double t) { return traits_.zeroYieldImpl(interpolation_, t); } 
    141144        protected override double forwardImpl(double t) { return traits_.forwardImpl(interpolation_, t); }