Hi Theo.
Notice that the result you get is close to your benchmark. First, check you use the right curve library: http://quantlib.org/reference/class_quant_lib_1_1_yield_term_structure.html as suggested by another person. Then, watch your evaluation date. You don't show your complete snippet but this might be tricky (and firm-specific): // http://quantcorner.wordpress.com/2011/01/31/us-treasury-notes-and-quantlib/ // Evaluation date Integer fixingDays = 1; Natural settlementDays = 1; Date todaysDate = calendar.advance(settlementDate, -fixingDays, Days); Settings::instance().evaluationDate() = todaysDate;Last but not least, pay attention to the business day convention: adjusted/unajusted, modified, modified-following ? I hope this helps a bit, Best, Édouard -- http://quantcorner.wordpress.com twitter: @tallent_e linkedin: fr.linkedin.com/pub/édouard-tallent/8/145/7a/ 4. ??: FW: Building Yield Curve of Zero Rates (Cheng Li) Hi All, I have Sample of USD Zero Yield Curve Data as follows: Observation Date 03/08/2012 Maturity Days 0,3,4,11,35,67,96,137,227,320,411,501,591,734,1099,1466,1830,2195,2560,2 926,3293,3657,4387,5484,7311,9135,10961, Yield 0,1.57151762841849E-03,1.5841928756397E-03,1.80193133074194E-03,2.374223 75119134E-03,3.30406684491067E-03,4.35679286119092E-03,3.56334288917869E -03,3.69745160830227E-03,3.77125648757358E-03,3.84515157443031E-03,3.928 32387415253E-03,4.03993077763243E-03,4.35625780531457E-03,5.080685648854 12E-03,6.4706614338575E-03,8.38591062422842E-03,0.010332793648027,1.2171 0204339663E-02,1.38041853050158E-02,1.52910208160213E-02,1.6727919706485 3E-02,1.89718781527944E-02,2.12626395949329E-02,2.31753447176866E-02,2.4 1372894297357E-02,2.47383920090547E-02 InterpolationType Linear Extrapolation Type near DayCount Convention ACT365FIXED Compunding Frequency CONTINUOUS, So I build a vector<QuantLib::Date> yieldMaturities, vector<Rate> yields from the information above. In the case of vector<QuantLib::Date> yieldMaturities, I just add the Maturity Days to observation date. I now build the yieldCurve as Handle<YieldTermStructure> yieldCurve( boost::shared_ptr<YieldTermStructure>( new ForwardCurve(yieldMaturities,yields, dayCountConv))); Then pass to boost::shared_ptr<BlackProcess> blackProcess( new BlackProcess(underlyingH, yieldCurve, flatVolTS)); as I am cant determine what the zero rate will be for the exercise date of the option. Now given this option is on a commodity forward, I want to discount from payment date. Hence have DiscountFactor expiryDiscount = blackProcess->riskFreeRate()->discount(europeanExercise->lastDate()); DiscountFactor paymentDiscount = blackProcess->riskFreeRate()->discount(paymentDate); Real forwardValue = europeanOption.NPV()/expiryDiscount; Real presentValue = forwardValue * paymentDiscount; My PV is slightly off the PV from another system. The market data is the same in both systems, except for the difference in discount factors. The paymentDiscount factor in Quantlib is 0.9990450902703203, whilst that from the other system is 0.9987391782033116, hence diff in PV. I am wondering whether my yieldCurve of Zeros has been constructed properly. Also its seems YieldTermStructure takes in market quotes and boostraps zero rates from it. So Given I already have Zero rates, have I contstructed the Zero Yield Curve propely? Looks like I have not done something right. Regards Theo Regards Theo ------------------------------------------------------------------------------ Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery and much more. Keep your Java skills current with LearnJavaNow - 200+ hours of step-by-step video tutorials by Java experts. SALE $49.99 this month only -- learn more at: http://p.sf.net/sfu/learnmore_122612 _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Free forum by Nabble | Edit this page |