Re: Problem setting the evaluation date on AIX for 64 bit application

Posted by Geetika on
URL: http://quantlib.414.s1.nabble.com/Problem-setting-the-evaluation-date-on-AIX-for-64-bit-application-tp18p23.html

Hi..

Even i am also facing the same Issue. The evalaution Date setting even doesn;t work for me.
And the NPV for the Instrument arrives to be zero on AIX machine for 64 bit build. I havn't checked for 32 bit.

Really looking for the solution..
I am using Quantlib 0.9.7 and even tried with the latest code.

Anyone ..who can clarify what this issue is??

Regards
Geetika








Rohit Rai wrote
Hi

I am using Quantlib 0.9.7 for my Application.

And i set the evaluation date to 31 December 2008 for Fixed Rate Bond.
When i print the settlement date , for Window the Settlement Date is fine
..which is January 1st, 2009
But for AIX 64 bit application, the Settlement Date is bit weird...which comes
out to be January 24th, 2011.
I guess , its pointing to the current date rather than taking the date which i
have set to i.e. 31-December-2008.

Attaching the log file for both the Platforms.

Please guide me regarding this issue. Its having a huge impact on my
application.




The code is given below:

cout<<" Fic Mis Date in Initialize Method: "<<this->mMisdate<<endl;
Settings::instance().evaluationDate() = this->mMisdate;
try
{
 Handle<YieldTermStructure> discountCurve(boost::shared_ptr<YieldTermStructure>(
  new
ZeroCurve(instrumentInfoObj.vTermstructureDates,instrumentInfoObj.vTermstructureRates,instrumentInfoObj.dayCounter)));

 boost::shared_ptr<PricingEngine> bondEngine(new
DiscountingBondEngine(discountCurve));
 Date effectiveDate =
instrumentInfoObj.issueDate+instrumentInfoObj.settlementDays;
 cout<<" Effective Date "<<effectiveDate<<endl;
   cout<<" Issue Date "<<instrumentInfoObj.issueDate<<endl;
   cout<<" Settlement Days "<<instrumentInfoObj.settlementDays<<endl;
 cout<<" Maturity Date "<<instrumentInfoObj.maturityDate<<endl;
 Schedule schedule(effectiveDate,
  instrumentInfoObj.maturityDate,
  (QuantLib::Period)instrumentInfoObj.couponFrequency,
  instrumentInfoObj.calendar,
  QuantLib::Following,
  QuantLib::Following,
  DateGeneration::Forward,
  false);
  cout<<"Account Skey -------> "<<instrumentInfoObj.acctSkey<<"    COUPON
RATE-------->"<<instrumentInfoObj.couponRate<<endl;

 this->mptrFixedRateBond = new FixedRateBond (instrumentInfoObj.settlementDays,
  100,
  schedule,
  vector<double> (1,instrumentInfoObj.couponRate),
  instrumentInfoObj.dayCounter,
  QuantLib::Following,
  100,
  instrumentInfoObj.issueDate);
 this->mptrFixedRateBond->setPricingEngine(bondEngine);
 cout.precision(10);
   cout<<"NPV "<<this->mptrFixedRateBond->NPV()<<endl;
   cout<<"Settlement Date:"<<this->mptrFixedRateBond->settlementDate()<<endl;
   cout<<"Issue Date:"<<this->mptrFixedRateBond->issueDate()<<endl;
 cout<<"Maturity Date:"<<this->mptrFixedRateBond->maturityDate()<<endl;
 return ClsUConstants::TASK_SUCCESS;



Regards
Rohit


------------------------------------Log File For MDurationExec-------------------------------------
----------------------------------------------------------------------------------------------------
                       Generation of MDurationExec Log started on : Tue Jan 18 23:42:21 2011
----------------------------------------------------------------------------------------------------

SMSDetails:
        Config File Path     :
        Log File Path        :
        Date Format          :
        Config User ID       : confrevdemo4
        Config Database Name : ORCL85
        User ID              : revuser4
        Database Name        : ORCL85
        Database Type        : ORACLE
        Database Locale      :

MIS Date: 20081231
Run Skey: 283

Started Config XML Parsing
Config XML Parsing Completed

End of Cursor
OCI_NO_DATA
Error Msg :-> 
No of Rows Selected :22

[ClsUNPVMD]-> Info: Instrument Details Population Successful

End of Cursor
OCI_NO_DATA
Error Msg :->
No of Rows Selected :180

[ClsUNPVMD]-> Info: Term Structure Details Population Successful

 Fic Mis Date in Initialize Method: December 31st, 2008
NPV 103.7561416
Settlement Date:January 1st, 2009
Issue Date:December 1st, 2006
Maturity Date:January 28th, 2010

[ClsUNPVMD]-> Info: NPV Calculation And Modified Duration Calculation Successful


[ClsUNPVMD]-> Info: Update Table Successful


----------------------------------------------------------------------------------------------------
                     End of MDurationExec Operations : Tue Jan 18 23:42:22 2011
----------------------------------------------------------------------------------------------------

------------------------------------Log File For MDurationExec-------------------------------------
----------------------------------------------------------------------------------------------------
                       Generation of MDurationExec Log started on : Tue Jan 18 23:53:21 2011
----------------------------------------------------------------------------------------------------

SMSDetails:
        Config File Path     : /home/revdemo4/ftpshare/ERMPROD/erwin/model/
        Log File Path        : /home/revdemo4/ftpshare/ERMPROD/logs
        Date Format          : mm-dd-yyyy
        Config User ID       : confrevdemo4
        Config Database Name : orcl
        User ID              : revuser4
        Database Name        : revuser4
        Database Type        : ORACLE
        Database Locale      : AMERICAN_AMERICA.US7ASCII

MIS Date: 20081231
Run Skey: 283

Started Config XML Parsing
Config XML Parsing Completed

End of Cursor
OCI_NO_DATA
Error Msg :->
No of Rows Selected :22

[ClsUNPVMD]-> Info: Instrument Details Population Successful

End of Cursor
OCI_NO_DATA
Error Msg :->
No of Rows Selected :180

[ClsUNPVMD]-> Info: Term Structure Details Population Successful

 Fic Mis Date in Initialize Method: December 31st, 2008
NPV 0
Settlement Date:January 20th, 2011
Issue Date:December 1st, 2006
Maturity Date:January 28th, 2010

[ClsUFixedRateBond]-> Error: Modified Duration Calculation Failed
Account Skey : 14354

../../ql/math/solver1d.hpp:199: In function `QuantLib::Solver1D<QuantLib::Brent>::solve<QuantLib::<unnamed>::YieldFinder>(const YieldFinder &, Real, Real, Real, Real) const':
root not bracketed: f[0,1] -> [NaNQ,NaNQ]

[ClsUNPVMD]-> Error: NPV Calculation OR Modified Duration Calculation Failed


[Main]-> Error: Terminating MDurationExec

----------------------------------------------------------------------------------------------------
                     End of MDurationExec Operations : Tue Jan 18 23:53:21 2011
----------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
QuantLib-users mailing list
QuantLib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/quantlib-users