|
From: Jan M. <jan...@gm...> - 2021-08-30 08:53:06
|
Hey all,
I am trying to price a number of bonds but am struggling with some day
count conventions. Please find them listed below:
day_counts = np.array(['ACT/365', 'ACT/ACT', '30E/360', '30/360 ISMA',
'30/360',
'ACT/360', '30/360 SIA', '30/360 ISDA', 'ACT/365 ISDA'], dtype=object)
I created a function (seen below) which takes in a dictionary of bond
pricing information and determines the day count convention of the bond
from a string using Quantlib. Unfortunately, I do not fully understand how
to use the quantlib package properly to determine these conventions.
I require the day count conventions to price both Callable and Fixed Rate
bonds using the "ql.CallableFixedRateBond" and "ql.FixedRateBond" objects.
import QuantLib as ql
def get_daycount(contract):
day_count = contract["DaycountCode"]
if day_count == "ACT/365":
day_count = ql.ActualActual.Actual365
if day_count == "ACT/ACT":
day_count = ?
if day_count == "30E/360":
day_count = ql.Thirty360.EurobondBasis
if day_count == "30/360 ISMA":
day_count = ql.ActualActual.ISMA
if day_count == "30/360":
day_count = ql.Thirty360
if day_count == 'ACT/360':
day_count = ql.Actual360
if day_count == '30/360 SIA':
day_count = ?
if day_count == '30/360 ISDA':
day_count = ?
if day_count == 'ACT/365 ISDA':
day_count = ql.ActualActual.ISDA
return day_count
Any help would be greatly appreciated!
Best Regards,
Jan Muller
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
Virus-free.
www.avg.com
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
|