8000 NTNB class in Brazilian government bonds structure by lucaslsanches · Pull Request #48 · Finance-Hub/FinanceHub · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Closed
wants to merge 4 commits into from

Conversation

lucaslsanches
Copy link

Added NTNB class in Brazilian government bonds

rate: Optional[float] = None,
price: Optional[float] = None,
updated_nominal_value: Optional[float] = None,
principal: float = 1e6,
Copy link
Member

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):
Copy link
Member

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.

@gusamarante
Copy link
Member

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')

This was referenced Apr 24, 2021
@lucaslsanches
Copy link
Author

Oi Gustavo, boa noite, tudo bom?

Obrigado pelos feedbacks!
Olhando os outros pull requests, acho que o do Pedro está mais adiantado para fazer o merge.
Dado que ele também resolveu algumas convenções numéricas da Anbima, acho que seria um acréscimo melhor para o FinanceHub.
Podemos seguir com a solução dele, mesmo.

Muito obrigado!
Abraços!

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
0