NTN-C
cash_flows(settlement, maturity)
Generate the cash flows for NTN-C bonds between the settlement and maturity dates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
settlement
|
DateScalar
|
The settlement date (exclusive) to start generating the cash flows. |
required |
maturity
|
DateScalar
|
The maturity date of the bond. |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
pl.DataFrame: DataFrame with columns "PaymentDate" and "CashFlow". |
Returned columns
- PaymentDate: The payment date of the cash flow
- CashFlow: Cash flow value for the bond
Examples:
>>> from pyield import ntnc
>>> ntnc.cash_flows("21-03-2025", "01-01-2031")
shape: (12, 2)
┌─────────────┬────────────┐
│ PaymentDate ┆ CashFlow │
│ --- ┆ --- │
│ date ┆ f64 │
╞═════════════╪════════════╡
│ 2025-07-01 ┆ 5.830052 │
│ 2026-01-01 ┆ 5.830052 │
│ 2026-07-01 ┆ 5.830052 │
│ 2027-01-01 ┆ 5.830052 │
│ 2027-07-01 ┆ 5.830052 │
│ … ┆ … │
│ 2029-01-01 ┆ 5.830052 │
│ 2029-07-01 ┆ 5.830052 │
│ 2030-01-01 ┆ 5.830052 │
│ 2030-07-01 ┆ 5.830052 │
│ 2031-01-01 ┆ 105.830052 │
└─────────────┴────────────┘
Source code in pyield/tn/ntnc.py
data(date)
Fetch the LTN Anbima indicative rates for the given reference date.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
date
|
DateScalar
|
The reference date for fetching the data. |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
pl.DataFrame: DataFrame with columns "MaturityDate" and "IndicativeRate". |
Examples:
>>> from pyield import ntnc
>>> ntnc.data("23-08-2024")
shape: (1, 14)
┌───────────────┬──────────┬───────────┬───────────────┬───┬──────────┬──────────┬────────────────┬─────────┐
│ ReferenceDate ┆ BondType ┆ SelicCode ┆ IssueBaseDate ┆ … ┆ BidRate ┆ AskRate ┆ IndicativeRate ┆ DIRate │
│ --- ┆ --- ┆ --- ┆ --- ┆ ┆ --- ┆ --- ┆ --- ┆ --- │
│ date ┆ str ┆ i64 ┆ date ┆ ┆ f64 ┆ f64 ┆ f64 ┆ f64 │
╞═══════════════╪══════════╪═══════════╪═══════════════╪═══╪══════════╪══════════╪════════════════╪═════════╡
│ 2024-08-23 ┆ NTN-C ┆ 770100 ┆ 2000-07-01 ┆ … ┆ 0.061591 ┆ 0.057587 ┆ 0.059617 ┆ 0.11575 │
└───────────────┴──────────┴───────────┴───────────────┴───┴──────────┴──────────┴────────────────┴─────────┘
Source code in pyield/tn/ntnc.py
duration(settlement, maturity, rate)
Calculate the Macaulay duration of the NTN-C bond in business years.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
settlement
|
DateScalar
|
The settlement date of the operation. |
required |
maturity
|
DateScalar
|
The maturity date of the NTN-C bond. |
required |
rate
|
float
|
The discount rate used to calculate the duration. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The Macaulay duration of the NTN-C bond in business years. |
Examples:
>>> from pyield import ntnc
>>> ntnc.duration("21-03-2025", "01-01-2031", 0.067626)
4.405363320448003
Source code in pyield/tn/ntnc.py
payment_dates(settlement, maturity)
Generate all remaining coupon dates between a given date and the maturity date. The dates are inclusive. The NTN-C bond is determined by its maturity date.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
settlement
|
DateScalar
|
The settlement date (exlusive) to start generating the coupon dates. |
required |
maturity
|
DateScalar
|
The maturity date. |
required |
Returns:
| Type | Description |
|---|---|
Series
|
pl.Series: Series of coupon dates within the specified range. |
Examples:
>>> from pyield import ntnc
>>> ntnc.payment_dates("21-03-2025", "01-01-2031")
shape: (12,)
Series: '' [date]
[
2025-07-01
2026-01-01
2026-07-01
2027-01-01
2027-07-01
…
2029-01-01
2029-07-01
2030-01-01
2030-07-01
2031-01-01
]
Source code in pyield/tn/ntnc.py
price(vna, quotation)
Calculate the NTN-C price using Anbima rules.
price = VNA * quotation / 100
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vna
|
float
|
The nominal value of the NTN-C bond. |
required |
quotation
|
float
|
The NTN-C quotation in base 100. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The NTN-C price truncated to 6 decimal places. |
References
- https://www.anbima.com.br/data/files/A0/02/CC/70/8FEFC8104606BDC8B82BA2A8/Metodologias%20ANBIMA%20de%20Precificacao%20Titulos%20Publicos.pdf
Examples:
Source code in pyield/tn/ntnc.py
quotation(settlement, maturity, rate)
Calculate the NTN-C quotation in base 100 using Anbima rules.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
settlement
|
DateScalar
|
The settlement date of the operation. |
required |
maturity
|
DateScalar
|
The maturity date of the NTN-C bond. |
required |
rate
|
float
|
The discount rate used to calculate the present value of the cash flows, which is the yield to maturity (YTM) of the NTN-C. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The NTN-C quotation truncated to 4 decimal places. |
References
- https://www.anbima.com.br/data/files/A0/02/CC/70/8FEFC8104606BDC8B82BA2A8/Metodologias%20ANBIMA%20de%20Precificacao%20Titulos%20Publicos.pdf
- The semi-annual coupon is set to 2.956301, which represents a 6% annual coupon rate compounded semi-annually and rounded to 6 decimal places as per Anbima rules.
Examples: