James Talvy
asked on
Price and Yield calculations in QuantLib vs Bloomberg
I am trying to use QuantLib library in order to calculate prices given the yield for US Treasury Notes and Bonds.
When calculating the present values in Bloomberg, it discounts future cash flows in compound method except when the settlement is in the last coupon period where Bloomberg discounts the cash flows using simple method instead of compounding.
However in QuantLib, I am unable to find a compounding method to support the above discounting. QuantLib has the following compounding methods.
If I use 'Compounded', QuantLib price matches with Bloomberg only when the settlement is before the final coupon period. On the other hand, if I use 'SimpleThenCompounded', QuantLib price matches Bloomberg only when the settlement is in the final coupon period.
I appreciate if someone can help me to resolve this.
Thanks
-James
When calculating the present values in Bloomberg, it discounts future cash flows in compound method except when the settlement is in the last coupon period where Bloomberg discounts the cash flows using simple method instead of compounding.
However in QuantLib, I am unable to find a compounding method to support the above discounting. QuantLib has the following compounding methods.
Simple
Compounded
Continuous
SimpleThenCompounded
If I use 'Compounded', QuantLib price matches with Bloomberg only when the settlement is before the final coupon period. On the other hand, if I use 'SimpleThenCompounded', QuantLib price matches Bloomberg only when the settlement is in the final coupon period.
I appreciate if someone can help me to resolve this.
Thanks
-James
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
self resolved
I added a pull request to support the Street convention. https://github.com/lballabio/QuantLib/pull/143 . Still need to handle single period with special case though.
http://quantlib.org/docs.shtml
Thanks