pyield 0.52.0__tar.gz → 0.52.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyield-0.52.0 → pyield-0.52.1}/PKG-INFO +6 -2
- {pyield-0.52.0 → pyield-0.52.1}/README.md +5 -1
- {pyield-0.52.0 → pyield-0.52.1}/pyield/interpolador.py +7 -5
- {pyield-0.52.0 → pyield-0.52.1}/pyield/tpf/_titulos/lft.py +23 -4
- {pyield-0.52.0 → pyield-0.52.1}/pyproject.toml +1 -1
- {pyield-0.52.0 → pyield-0.52.1}/LICENSE +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/__init__.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/_internal/__init__.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/_internal/br_numbers.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/_internal/cache.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/_internal/converters.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/_internal/data_cache.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/_internal/retry.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/_internal/types.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/anbima/__init__.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/anbima/imaq.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/anbima/mercado_secundario.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/b3/__init__.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/b3/_contratos.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/b3/_validar_pregao.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/b3/boletim.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/b3/derivativos_intradia.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/b3/di_over.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/bc/__init__.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/bc/_olinda.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/bc/leiloes.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/bc/lft.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/bc/sgs.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/bc/tpf_intradia.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/bc/tpf_mensal.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/du/__init__.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/du/core.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/du/feriados/__init__.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/du/feriados/feriados_antigos_br.txt +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/du/feriados/feriados_br.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/du/feriados/feriados_novos_br.txt +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/futuro/__init__.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/futuro/contratos.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/futuro/di1.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/futuro/historico.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/futuro/intradia.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/fwd.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/ipca/__init__.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/ipca/historico.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/ipca/projetado.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/py.typed +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/relogio.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/selic/__init__.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/selic/compromissada.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/selic/copom.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/selic/cpm.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/selic/probabilities.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/tpf/__init__.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/tpf/_titulos/__init__.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/tpf/_titulos/ltn.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/tpf/_titulos/ntnb.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/tpf/_titulos/ntnb1.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/tpf/_titulos/ntnbprinc.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/tpf/_titulos/ntnc.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/tpf/_titulos/ntnf.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/tpf/benchmark.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/tpf/leiloes.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/tpf/pre.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/tpf/rmd/__init__.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/tpf/rmd/_aba_1_3.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/tpf/rmd/_aba_2_1.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/tpf/rmd/_common.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/tpf/rmd/_download.py +0 -0
- {pyield-0.52.0 → pyield-0.52.1}/pyield/tpf/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: pyield
|
|
3
|
-
Version: 0.52.
|
|
3
|
+
Version: 0.52.1
|
|
4
4
|
Summary: Polars-powered toolkit for Brazilian fixed income analysis
|
|
5
5
|
Keywords: fixed-income,brazil,finance,analysis,bonds
|
|
6
6
|
Author: Carlos Carvalho
|
|
@@ -114,7 +114,7 @@ documentação.
|
|
|
114
114
|
| `yd.futuro` | módulo | Contratos futuros da B3 | `di1`, `historico`, `intradia`, `datas_disponiveis`, `vencimento`, `enriquecer`, `vencimento_expr` |
|
|
115
115
|
| `yd.di1` | módulo | Curva DI1 e interpolação | `dados`, `interpolar_taxas`, `interpolar_taxa`, `datas_disponiveis` |
|
|
116
116
|
| `yd.tpf` | módulo | Títulos públicos federais | `taxas`, `vencimentos`, `estoque`, `leiloes`, `benchmarks`, `curva_pre`, `premio_pre`, `rmd`, `secundario_mensal`, `secundario_intradia` |
|
|
117
|
-
| `yd.lft` | módulo | LFT | `dados`, `vencimentos`, `cotacao`, `taxa`, `vna` |
|
|
117
|
+
| `yd.lft` | módulo | LFT | `dados`, `vencimentos`, `cotacao`, `pu`, `taxa`, `vna`, `rentabilidade`, `rentabilidade_expr` |
|
|
118
118
|
| `yd.ltn` | módulo | LTN | `dados`, `vencimentos`, `pu`, `taxa`, `duration_expr`, `dv01`, `dv01_expr`, `rentabilidade`, `rentabilidade_expr`, `taxas_forward` |
|
|
119
119
|
| `yd.ntnb` | módulo | NTN-B | `dados`, `vencimentos`, `datas_pagamento`, `fluxos_caixa`, `cotacao`, `pu`, `taxa`, `taxas_zero`, `duration`, `duration_expr`, `dv01`, `dv01_expr`, `implicitas`, `curva` |
|
|
120
120
|
| `yd.ntnb1` | módulo | NTN-B1 | `datas_pagamento`, `fluxos_caixa`, `cotacao`, `pu`, `duration`, `dv01` |
|
|
@@ -322,6 +322,10 @@ Resumo das quebras desta versão:
|
|
|
322
322
|
antes suportadas via sobrecarga vetorial, agora levantam `TypeError`.
|
|
323
323
|
Substitua por `Interpolador.interpolar_expr` em pipelines Polars ou pela
|
|
324
324
|
função top-level `yd.interpolar(...)` (curva única ou multi-curva).
|
|
325
|
+
- `yd.interpolar(...)` passou a usar `extrapolar=False` como padrão, alinhado
|
|
326
|
+
com `Interpolador`. Antes era `True`. Chamadas que dependiam da
|
|
327
|
+
extrapolação implícita na ponta longa precisam passar `extrapolar=True`
|
|
328
|
+
explicitamente.
|
|
325
329
|
- As funções `dv01(...)` dos títulos públicos agora recebem `pu` como argumento
|
|
326
330
|
explícito. Chamadas antigas que passavam apenas data, vencimento e taxa, ou
|
|
327
331
|
que passavam VNA no caso da NTN-B, precisam ser atualizadas.
|
|
@@ -70,7 +70,7 @@ documentação.
|
|
|
70
70
|
| `yd.futuro` | módulo | Contratos futuros da B3 | `di1`, `historico`, `intradia`, `datas_disponiveis`, `vencimento`, `enriquecer`, `vencimento_expr` |
|
|
71
71
|
| `yd.di1` | módulo | Curva DI1 e interpolação | `dados`, `interpolar_taxas`, `interpolar_taxa`, `datas_disponiveis` |
|
|
72
72
|
| `yd.tpf` | módulo | Títulos públicos federais | `taxas`, `vencimentos`, `estoque`, `leiloes`, `benchmarks`, `curva_pre`, `premio_pre`, `rmd`, `secundario_mensal`, `secundario_intradia` |
|
|
73
|
-
| `yd.lft` | módulo | LFT | `dados`, `vencimentos`, `cotacao`, `taxa`, `vna` |
|
|
73
|
+
| `yd.lft` | módulo | LFT | `dados`, `vencimentos`, `cotacao`, `pu`, `taxa`, `vna`, `rentabilidade`, `rentabilidade_expr` |
|
|
74
74
|
| `yd.ltn` | módulo | LTN | `dados`, `vencimentos`, `pu`, `taxa`, `duration_expr`, `dv01`, `dv01_expr`, `rentabilidade`, `rentabilidade_expr`, `taxas_forward` |
|
|
75
75
|
| `yd.ntnb` | módulo | NTN-B | `dados`, `vencimentos`, `datas_pagamento`, `fluxos_caixa`, `cotacao`, `pu`, `taxa`, `taxas_zero`, `duration`, `duration_expr`, `dv01`, `dv01_expr`, `implicitas`, `curva` |
|
|
76
76
|
| `yd.ntnb1` | módulo | NTN-B1 | `datas_pagamento`, `fluxos_caixa`, `cotacao`, `pu`, `duration`, `dv01` |
|
|
@@ -278,6 +278,10 @@ Resumo das quebras desta versão:
|
|
|
278
278
|
antes suportadas via sobrecarga vetorial, agora levantam `TypeError`.
|
|
279
279
|
Substitua por `Interpolador.interpolar_expr` em pipelines Polars ou pela
|
|
280
280
|
função top-level `yd.interpolar(...)` (curva única ou multi-curva).
|
|
281
|
+
- `yd.interpolar(...)` passou a usar `extrapolar=False` como padrão, alinhado
|
|
282
|
+
com `Interpolador`. Antes era `True`. Chamadas que dependiam da
|
|
283
|
+
extrapolação implícita na ponta longa precisam passar `extrapolar=True`
|
|
284
|
+
explicitamente.
|
|
281
285
|
- As funções `dv01(...)` dos títulos públicos agora recebem `pu` como argumento
|
|
282
286
|
explícito. Chamadas antigas que passavam apenas data, vencimento e taxa, ou
|
|
283
287
|
que passavam VNA no caso da NTN-B, precisam ser atualizadas.
|
|
@@ -310,7 +310,7 @@ def interpolar( # noqa: PLR0913
|
|
|
310
310
|
*,
|
|
311
311
|
datas_alvo: pl.Series | None = None,
|
|
312
312
|
datas_curva: pl.Series | None = None,
|
|
313
|
-
extrapolar: bool =
|
|
313
|
+
extrapolar: bool = False,
|
|
314
314
|
) -> pl.Series:
|
|
315
315
|
r"""Interpola taxas flat-forward para uma série de pontos alvo.
|
|
316
316
|
|
|
@@ -332,10 +332,12 @@ def interpolar( # noqa: PLR0913
|
|
|
332
332
|
Padrão: ``None`` (curva única).
|
|
333
333
|
datas_curva: Series Date com a data de referência de cada
|
|
334
334
|
vértice da curva. Padrão: ``None`` (curva única).
|
|
335
|
-
extrapolar:
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
primeira taxa do
|
|
335
|
+
extrapolar: Controla apenas o comportamento na ponta longa (DU acima
|
|
336
|
+
do maior vértice de cada grupo). Se True, retorna a última taxa
|
|
337
|
+
conhecida; se False (padrão), retorna ``null``. A ponta curta
|
|
338
|
+
(DU abaixo do menor vértice) sempre retorna a primeira taxa do
|
|
339
|
+
grupo, independentemente desta flag. O default casa com o da
|
|
340
|
+
classe :class:`Interpolador`.
|
|
339
341
|
|
|
340
342
|
Returns:
|
|
341
343
|
Series Float64 ``taxa_interpolada`` na mesma ordem de
|
|
@@ -55,10 +55,7 @@ def dados(data: DateLike) -> pl.DataFrame:
|
|
|
55
55
|
df = utils.adicionar_taxa_di(df, data_ref)
|
|
56
56
|
|
|
57
57
|
df = df.with_columns(
|
|
58
|
-
rentabilidade=
|
|
59
|
-
lambda s: rentabilidade(s["taxa_indicativa"], s["taxa_di"]),
|
|
60
|
-
return_dtype=pl.Float64,
|
|
61
|
-
)
|
|
58
|
+
rentabilidade=rentabilidade_expr("taxa_indicativa", "taxa_di"),
|
|
62
59
|
)
|
|
63
60
|
|
|
64
61
|
return df.select(
|
|
@@ -226,6 +223,28 @@ def rentabilidade(taxa_lft: float, taxa_di: float) -> float:
|
|
|
226
223
|
return (fator_lft * fator_di - 1) / (fator_di - 1)
|
|
227
224
|
|
|
228
225
|
|
|
226
|
+
def rentabilidade_expr(
|
|
227
|
+
taxa_lft: pl.Expr | str,
|
|
228
|
+
taxa_di: pl.Expr | str,
|
|
229
|
+
) -> pl.Expr:
|
|
230
|
+
"""Cria expressão Polars para a rentabilidade da LFT sobre o DI.
|
|
231
|
+
|
|
232
|
+
Args:
|
|
233
|
+
taxa_lft: Nome de coluna ou expressão Polars com a taxa anualizada da
|
|
234
|
+
LFT sobre a Selic.
|
|
235
|
+
taxa_di: Nome de coluna ou expressão Polars com a taxa DI Futuro
|
|
236
|
+
anualizada (interpolada para o mesmo vencimento da LFT).
|
|
237
|
+
|
|
238
|
+
Returns:
|
|
239
|
+
pl.Expr: Expressão sem alias com a rentabilidade da LFT sobre o DI.
|
|
240
|
+
"""
|
|
241
|
+
expr_lft = taxa_lft if isinstance(taxa_lft, pl.Expr) else pl.col(taxa_lft)
|
|
242
|
+
expr_di = taxa_di if isinstance(taxa_di, pl.Expr) else pl.col(taxa_di)
|
|
243
|
+
fator_lft = (expr_lft + 1) ** (1 / 252)
|
|
244
|
+
fator_di = (expr_di + 1) ** (1 / 252)
|
|
245
|
+
return (fator_lft * fator_di - 1) / (fator_di - 1)
|
|
246
|
+
|
|
247
|
+
|
|
229
248
|
def _calcular_pu(
|
|
230
249
|
vna: float,
|
|
231
250
|
cotacao: float,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|