-
Notifications
You must be signed in to change notification settings - Fork 137
NTNB class in Brazilian government bonds structure #48
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
Conversation
rate: Optional[float] = None, | ||
price: Optional[float] = None, | ||
updated_nominal_value: Optional[float] = None, | ||
principal: float = 1e6, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Porque esse principal
é necessário? o VNA da NTNB já é o principal dela
@@ -162,3 +162,109 @@ def calculate_risk(self): | |||
convexity = (convexity / self.price) / (1. + self.rate) ** 2 | |||
|
|||
return mod_duration, convexity | |||
|
|||
|
|||
class NTNB(object): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Precisa incluir essa classe (e a dos outros bonds) no construtor da biblioteca finmath
. É o arquivo __init__.py
que fica dentro dela.
Testei a classe com os dados do dia 23 de abril de 2021. O preço fica só com 0.12% de diferença para o que a ANBIMA publicou. from finmath.brazilian_bonds.government_bonds import NTNB
ntn = NTNB(expiry='2050-08-15',
rate=0.044125,
updated_nominal_value=3517.844181,
ref_date='2021-04-23')
print('Preço calculado foi de', ntn.price)
print('PU na ANBIMA é de 4.460,278154') |
Oi Gustavo, boa noite, tudo bom? Obrigado pelos feedbacks! Muito obrigado! |
Added NTNB class in Brazilian government bonds