pyield 0.49.6__tar.gz → 0.49.7__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.49.6 → pyield-0.49.7}/PKG-INFO +1 -1
- {pyield-0.49.6 → pyield-0.49.7}/pyield/b3/boletim.py +5 -1
- {pyield-0.49.6 → pyield-0.49.7}/pyield/bc/sgs.py +5 -1
- {pyield-0.49.6 → pyield-0.49.7}/pyield/bc/vna.py +11 -5
- {pyield-0.49.6 → pyield-0.49.7}/pyield/tpf/leiloes.py +3 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyproject.toml +1 -1
- {pyield-0.49.6 → pyield-0.49.7}/LICENSE +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/README.md +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/__init__.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/_internal/__init__.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/_internal/br_numbers.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/_internal/cache.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/_internal/converters.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/_internal/data_cache.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/_internal/retry.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/_internal/types.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/anbima/__init__.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/anbima/imaq.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/anbima/mercado_secundario.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/b3/__init__.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/b3/_contratos.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/b3/_validar_pregao.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/b3/derivativos_intradia.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/b3/di_over.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/bc/__init__.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/bc/_olinda.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/bc/leiloes.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/bc/tpf_intradia.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/bc/tpf_mensal.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/di1.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/du/__init__.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/du/core.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/du/feriados/__init__.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/du/feriados/feriados_antigos_br.txt +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/du/feriados/feriados_br.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/du/feriados/feriados_novos_br.txt +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/futuro/__init__.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/futuro/contratos.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/futuro/historico.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/futuro/intradia.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/fwd.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/interpolador.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/ipca/__init__.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/ipca/historico.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/ipca/projetado.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/lft.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/ltn.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/ntnb.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/ntnb1.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/ntnbprinc.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/ntnc.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/ntnf.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/py.typed +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/relogio.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/selic/__init__.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/selic/compromissada.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/selic/copom.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/selic/cpm.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/selic/probabilities.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/tpf/__init__.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/tpf/benchmark.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/tpf/pre.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/tpf/rmd/__init__.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/tpf/rmd/_aba_1_3.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/tpf/rmd/_aba_2_1.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/tpf/rmd/_common.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/tpf/rmd/_download.py +0 -0
- {pyield-0.49.6 → pyield-0.49.7}/pyield/tpf/utils.py +0 -0
|
@@ -124,12 +124,16 @@ def baixar_zip(data: DateLike, boletim_completo: bool = False) -> bytes:
|
|
|
124
124
|
|
|
125
125
|
Returns:
|
|
126
126
|
Conteúdo do ZIP externo em bytes quando o ZIP contém um XML legível.
|
|
127
|
-
Retorna ``b""`` quando a resposta não contém
|
|
127
|
+
Retorna ``b""`` para data sem pregão ou quando a resposta não contém
|
|
128
|
+
um ZIP válido.
|
|
128
129
|
"""
|
|
129
130
|
if any_is_empty(data):
|
|
130
131
|
return bytes()
|
|
131
132
|
|
|
132
133
|
data = cv.converter_datas(data)
|
|
134
|
+
if not data_negociacao_valida(data):
|
|
135
|
+
return bytes()
|
|
136
|
+
|
|
133
137
|
data_str = data.strftime("%y%m%d")
|
|
134
138
|
prefixo = "PR" if boletim_completo else "SPRD"
|
|
135
139
|
url = f"https://www.b3.com.br/pesquisapregao/download?filelist={prefixo}{data_str}.zip"
|
|
@@ -30,7 +30,7 @@ import requests
|
|
|
30
30
|
from pyield import relogio
|
|
31
31
|
from pyield._internal.br_numbers import pct_para_decimal
|
|
32
32
|
from pyield._internal.cache import ttl_cache
|
|
33
|
-
from pyield._internal.converters import converter_datas
|
|
33
|
+
from pyield._internal.converters import converter_datas, data_referencia_valida
|
|
34
34
|
from pyield._internal.retry import retry_padrao
|
|
35
35
|
from pyield._internal.types import DateLike, any_is_empty
|
|
36
36
|
|
|
@@ -373,4 +373,8 @@ def ptax(data: DateLike) -> float:
|
|
|
373
373
|
"""
|
|
374
374
|
if any_is_empty(data):
|
|
375
375
|
return float("nan")
|
|
376
|
+
data = converter_datas(data)
|
|
377
|
+
if not data_referencia_valida(data):
|
|
378
|
+
return float("nan")
|
|
379
|
+
|
|
376
380
|
return _extrair_escalar(ptax_serie(data, data), "cotacao")
|
|
@@ -11,22 +11,23 @@ Trecho relevante da resposta (tabela VNA):
|
|
|
11
11
|
28/06/2023 01/03/2026 01/07/2000 210100 14903,011480
|
|
12
12
|
"""
|
|
13
13
|
|
|
14
|
+
import datetime as dt
|
|
15
|
+
|
|
14
16
|
import requests
|
|
15
17
|
|
|
16
18
|
from pyield._internal.cache import ttl_cache
|
|
17
|
-
from pyield._internal.converters import converter_datas
|
|
19
|
+
from pyield._internal.converters import converter_datas, data_referencia_valida
|
|
18
20
|
from pyield._internal.retry import retry_padrao
|
|
19
21
|
from pyield._internal.types import DateLike, any_is_empty
|
|
20
22
|
|
|
21
23
|
|
|
22
24
|
@ttl_cache()
|
|
23
25
|
@retry_padrao
|
|
24
|
-
def _baixar_texto(data_referencia:
|
|
26
|
+
def _baixar_texto(data_referencia: dt.date) -> str:
|
|
25
27
|
"""Baixa o arquivo diário do SELIC no site do BCB."""
|
|
26
28
|
# Exemplo: https://www3.bcb.gov.br/novoselic/rest/arquivosDiarios/pub/download/3/20240418APC238
|
|
27
29
|
url_base = "https://www3.bcb.gov.br/novoselic/rest/arquivosDiarios/pub/download/3/"
|
|
28
|
-
|
|
29
|
-
url_file = f"{data.strftime('%Y%m%d')}APC238"
|
|
30
|
+
url_file = f"{data_referencia.strftime('%Y%m%d')}APC238"
|
|
30
31
|
url = url_base + url_file
|
|
31
32
|
|
|
32
33
|
response = requests.get(url, timeout=10)
|
|
@@ -76,7 +77,8 @@ def vna(data: DateLike) -> float:
|
|
|
76
77
|
data: Data de referência.
|
|
77
78
|
|
|
78
79
|
Returns:
|
|
79
|
-
Valor do VNA da LFT. Retorna ``nan`` se a entrada for nula ou
|
|
80
|
+
Valor do VNA da LFT. Retorna ``nan`` se a entrada for nula, vazia ou
|
|
81
|
+
uma data de referência inválida.
|
|
80
82
|
|
|
81
83
|
Raises:
|
|
82
84
|
ValueError: Se os valores VNA extraídos da fonte forem divergentes.
|
|
@@ -89,6 +91,10 @@ def vna(data: DateLike) -> float:
|
|
|
89
91
|
"""
|
|
90
92
|
if any_is_empty(data):
|
|
91
93
|
return float("nan")
|
|
94
|
+
data = converter_datas(data)
|
|
95
|
+
if not data_referencia_valida(data):
|
|
96
|
+
return float("nan")
|
|
97
|
+
|
|
92
98
|
texto = _baixar_texto(data)
|
|
93
99
|
tabela = _recortar_tabela(texto)
|
|
94
100
|
linhas = _obter_linhas(tabela)
|
|
@@ -395,6 +395,9 @@ def leilao(data: DateLike | Sequence[DateLike]) -> pl.DataFrame:
|
|
|
395
395
|
def _processar_data_unica(data_leilao: DateLike) -> pl.DataFrame:
|
|
396
396
|
"""Busca e processa o leilao de uma unica data."""
|
|
397
397
|
data = cv.converter_datas(data_leilao)
|
|
398
|
+
if not du.eh_dia_util(data):
|
|
399
|
+
return pl.DataFrame()
|
|
400
|
+
|
|
398
401
|
dados_leilao = _buscar_dados_leilao(data)
|
|
399
402
|
if not dados_leilao:
|
|
400
403
|
return pl.DataFrame()
|
|
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
|