Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update bond.py to allow to define the BusDayAdjustTypes and DateGenRu… #154

Closed
wants to merge 6 commits into from
Closed

Conversation

sagayev
Copy link
Contributor

@sagayev sagayev commented Feb 4, 2023

…leTypes

from financepy.utils import *
from financepy.products.bonds import *
from financepy.market.curves import *

accrual_type, frequencyType, settlementDays, exDiv, calendar = get_bond_market_conventions(BondMarkets.AZERBAIJAN) # Azerbaijan country will be in another PR

issueDt= Date(24,2,2021)
settleDt = Date(6,2,2023)
coupon = 7.5/100
maturityDt= Date(20,2,2024)

bond = Bond(issueDt, maturityDt, coupon, frequencyType, accrual_type, date_gen_rule_type=DateGenRuleTypes.FORWARD) bond.print_coupon_dates(issueDt)

#24-AUG-2021 3.75
#24-FEB-2022 3.75
#24-AUG-2022 3.75
#24-FEB-2023 3.75
#24-AUG-2023 3.75
#20-FEB-2024 103.75

#The last coupon amount is wrong, but it is another issue.

…leTypes

from financepy.utils import *
from financepy.products.bonds import *
from financepy.market.curves import *

accrual_type, frequencyType, settlementDays, exDiv, calendar = get_bond_market_conventions(BondMarkets.AZERBAIJAN) # Azerbaijan in will be in another PR

issueDt= Date(24,2,2021)
settleDt = Date(6,2,2023)
coupon = 7.5/100
maturityDt= Date(20,2,2024)

bond = Bond(issueDt, maturityDt, coupon, frequencyType, accrual_type, date_gen_rule_type=DateGenRuleTypes.FORWARD)
bond.print_coupon_dates(settleDt)

 #24-AUG-2021         3.75 
 #24-FEB-2022         3.75 
 #24-AUG-2022         3.75 
 #24-FEB-2023         3.75 
 #24-AUG-2023         3.75 
 #20-FEB-2024       103.75 

#The last coupon amount is wrong, but it is another issue.
@domokane
Copy link
Owner

domokane commented Feb 5, 2023

Hi - the unit tests fail. You need to initialise the busdayadjustyypes and dategenrules as members of the bond class.

@sagayev sagayev closed this Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants