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.
Files changed (68) hide show
  1. {pyield-0.49.6 → pyield-0.49.7}/PKG-INFO +1 -1
  2. {pyield-0.49.6 → pyield-0.49.7}/pyield/b3/boletim.py +5 -1
  3. {pyield-0.49.6 → pyield-0.49.7}/pyield/bc/sgs.py +5 -1
  4. {pyield-0.49.6 → pyield-0.49.7}/pyield/bc/vna.py +11 -5
  5. {pyield-0.49.6 → pyield-0.49.7}/pyield/tpf/leiloes.py +3 -0
  6. {pyield-0.49.6 → pyield-0.49.7}/pyproject.toml +1 -1
  7. {pyield-0.49.6 → pyield-0.49.7}/LICENSE +0 -0
  8. {pyield-0.49.6 → pyield-0.49.7}/README.md +0 -0
  9. {pyield-0.49.6 → pyield-0.49.7}/pyield/__init__.py +0 -0
  10. {pyield-0.49.6 → pyield-0.49.7}/pyield/_internal/__init__.py +0 -0
  11. {pyield-0.49.6 → pyield-0.49.7}/pyield/_internal/br_numbers.py +0 -0
  12. {pyield-0.49.6 → pyield-0.49.7}/pyield/_internal/cache.py +0 -0
  13. {pyield-0.49.6 → pyield-0.49.7}/pyield/_internal/converters.py +0 -0
  14. {pyield-0.49.6 → pyield-0.49.7}/pyield/_internal/data_cache.py +0 -0
  15. {pyield-0.49.6 → pyield-0.49.7}/pyield/_internal/retry.py +0 -0
  16. {pyield-0.49.6 → pyield-0.49.7}/pyield/_internal/types.py +0 -0
  17. {pyield-0.49.6 → pyield-0.49.7}/pyield/anbima/__init__.py +0 -0
  18. {pyield-0.49.6 → pyield-0.49.7}/pyield/anbima/imaq.py +0 -0
  19. {pyield-0.49.6 → pyield-0.49.7}/pyield/anbima/mercado_secundario.py +0 -0
  20. {pyield-0.49.6 → pyield-0.49.7}/pyield/b3/__init__.py +0 -0
  21. {pyield-0.49.6 → pyield-0.49.7}/pyield/b3/_contratos.py +0 -0
  22. {pyield-0.49.6 → pyield-0.49.7}/pyield/b3/_validar_pregao.py +0 -0
  23. {pyield-0.49.6 → pyield-0.49.7}/pyield/b3/derivativos_intradia.py +0 -0
  24. {pyield-0.49.6 → pyield-0.49.7}/pyield/b3/di_over.py +0 -0
  25. {pyield-0.49.6 → pyield-0.49.7}/pyield/bc/__init__.py +0 -0
  26. {pyield-0.49.6 → pyield-0.49.7}/pyield/bc/_olinda.py +0 -0
  27. {pyield-0.49.6 → pyield-0.49.7}/pyield/bc/leiloes.py +0 -0
  28. {pyield-0.49.6 → pyield-0.49.7}/pyield/bc/tpf_intradia.py +0 -0
  29. {pyield-0.49.6 → pyield-0.49.7}/pyield/bc/tpf_mensal.py +0 -0
  30. {pyield-0.49.6 → pyield-0.49.7}/pyield/di1.py +0 -0
  31. {pyield-0.49.6 → pyield-0.49.7}/pyield/du/__init__.py +0 -0
  32. {pyield-0.49.6 → pyield-0.49.7}/pyield/du/core.py +0 -0
  33. {pyield-0.49.6 → pyield-0.49.7}/pyield/du/feriados/__init__.py +0 -0
  34. {pyield-0.49.6 → pyield-0.49.7}/pyield/du/feriados/feriados_antigos_br.txt +0 -0
  35. {pyield-0.49.6 → pyield-0.49.7}/pyield/du/feriados/feriados_br.py +0 -0
  36. {pyield-0.49.6 → pyield-0.49.7}/pyield/du/feriados/feriados_novos_br.txt +0 -0
  37. {pyield-0.49.6 → pyield-0.49.7}/pyield/futuro/__init__.py +0 -0
  38. {pyield-0.49.6 → pyield-0.49.7}/pyield/futuro/contratos.py +0 -0
  39. {pyield-0.49.6 → pyield-0.49.7}/pyield/futuro/historico.py +0 -0
  40. {pyield-0.49.6 → pyield-0.49.7}/pyield/futuro/intradia.py +0 -0
  41. {pyield-0.49.6 → pyield-0.49.7}/pyield/fwd.py +0 -0
  42. {pyield-0.49.6 → pyield-0.49.7}/pyield/interpolador.py +0 -0
  43. {pyield-0.49.6 → pyield-0.49.7}/pyield/ipca/__init__.py +0 -0
  44. {pyield-0.49.6 → pyield-0.49.7}/pyield/ipca/historico.py +0 -0
  45. {pyield-0.49.6 → pyield-0.49.7}/pyield/ipca/projetado.py +0 -0
  46. {pyield-0.49.6 → pyield-0.49.7}/pyield/lft.py +0 -0
  47. {pyield-0.49.6 → pyield-0.49.7}/pyield/ltn.py +0 -0
  48. {pyield-0.49.6 → pyield-0.49.7}/pyield/ntnb.py +0 -0
  49. {pyield-0.49.6 → pyield-0.49.7}/pyield/ntnb1.py +0 -0
  50. {pyield-0.49.6 → pyield-0.49.7}/pyield/ntnbprinc.py +0 -0
  51. {pyield-0.49.6 → pyield-0.49.7}/pyield/ntnc.py +0 -0
  52. {pyield-0.49.6 → pyield-0.49.7}/pyield/ntnf.py +0 -0
  53. {pyield-0.49.6 → pyield-0.49.7}/pyield/py.typed +0 -0
  54. {pyield-0.49.6 → pyield-0.49.7}/pyield/relogio.py +0 -0
  55. {pyield-0.49.6 → pyield-0.49.7}/pyield/selic/__init__.py +0 -0
  56. {pyield-0.49.6 → pyield-0.49.7}/pyield/selic/compromissada.py +0 -0
  57. {pyield-0.49.6 → pyield-0.49.7}/pyield/selic/copom.py +0 -0
  58. {pyield-0.49.6 → pyield-0.49.7}/pyield/selic/cpm.py +0 -0
  59. {pyield-0.49.6 → pyield-0.49.7}/pyield/selic/probabilities.py +0 -0
  60. {pyield-0.49.6 → pyield-0.49.7}/pyield/tpf/__init__.py +0 -0
  61. {pyield-0.49.6 → pyield-0.49.7}/pyield/tpf/benchmark.py +0 -0
  62. {pyield-0.49.6 → pyield-0.49.7}/pyield/tpf/pre.py +0 -0
  63. {pyield-0.49.6 → pyield-0.49.7}/pyield/tpf/rmd/__init__.py +0 -0
  64. {pyield-0.49.6 → pyield-0.49.7}/pyield/tpf/rmd/_aba_1_3.py +0 -0
  65. {pyield-0.49.6 → pyield-0.49.7}/pyield/tpf/rmd/_aba_2_1.py +0 -0
  66. {pyield-0.49.6 → pyield-0.49.7}/pyield/tpf/rmd/_common.py +0 -0
  67. {pyield-0.49.6 → pyield-0.49.7}/pyield/tpf/rmd/_download.py +0 -0
  68. {pyield-0.49.6 → pyield-0.49.7}/pyield/tpf/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pyield
3
- Version: 0.49.6
3
+ Version: 0.49.7
4
4
  Summary: A Python library for analysis of fixed income instruments in Brazil
5
5
  Keywords: fixed-income,brazil,finance,analysis,bonds
6
6
  Author: Carlos Carvalho
@@ -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 um ZIP válido.
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: DateLike) -> str:
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
- data = converter_datas(data_referencia)
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 vazia.
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()
@@ -19,7 +19,7 @@ dependencies = [
19
19
  "fastexcel>=0.19.0",
20
20
  "tzdata>=2024.1; platform_system == 'Windows'",
21
21
  ]
22
- version = "0.49.6"
22
+ version = "0.49.7"
23
23
 
24
24
  [project.urls]
25
25
  Homepage = "https://github.com/crdcj/PYield"
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