@ Override public double getDiscountFactor ( AnalyticModelInterface model , double maturity ) { // Change time scale maturity *= timeScaling ; double beta1 = parameter [ 0 ] ; double beta2 = parameter [ 1 ] ; double beta3 = parameter [ 2 ] ; double beta4 = parameter [ 3 ] ; double tau1 = parameter [ 4 ] ; double tau2 = parameter [ 5 ] ; double x1 = tau1 > 0 ? FastMath . exp ( - maturity / tau1 ) : 0.0 ; double x2 = tau2 > 0 ? FastMath . exp ( - maturity / tau2 ) : 0.0 ; double y1 = tau1 > 0 ? ( maturity > 0.0 ? ( 1.0 - x1 ) / maturity * tau1 : 1.0 ) : 0.0 ; double y2 = tau2 > 0 ? ( maturity > 0.0 ? ( 1.0 - x2 ) / maturity * tau2 : 1.0 ) : 0.0 ; double zeroRate = beta1 + beta2 * y1 + beta3 * ( y1 - x1 ) + beta4 * ( y2 - x2 ) ; return Math . exp ( - zeroRate * maturity ) ; }
Return the discount factor within a given model context for a given maturity .