PYield 0.28.1__tar.gz → 0.28.2__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 (40) hide show
  1. {pyield-0.28.1 → pyield-0.28.2}/PKG-INFO +2 -3
  2. pyield-0.28.2/pyield/__about__.py +1 -0
  3. {pyield-0.28.1 → pyield-0.28.2}/pyield/projections.py +9 -21
  4. {pyield-0.28.1 → pyield-0.28.2}/pyproject.toml +2 -3
  5. pyield-0.28.1/pyield/__about__.py +0 -1
  6. {pyield-0.28.1 → pyield-0.28.2}/.gitignore +0 -0
  7. {pyield-0.28.1 → pyield-0.28.2}/LICENSE +0 -0
  8. {pyield-0.28.1 → pyield-0.28.2}/README.md +0 -0
  9. {pyield-0.28.1 → pyield-0.28.2}/pyield/__init__.py +0 -0
  10. {pyield-0.28.1 → pyield-0.28.2}/pyield/anbima/__init__.py +0 -0
  11. {pyield-0.28.1 → pyield-0.28.2}/pyield/anbima/ima.py +0 -0
  12. {pyield-0.28.1 → pyield-0.28.2}/pyield/anbima/imaq.py +0 -0
  13. {pyield-0.28.1 → pyield-0.28.2}/pyield/anbima/tpf.py +0 -0
  14. {pyield-0.28.1 → pyield-0.28.2}/pyield/b3_futures/__init__.py +0 -0
  15. {pyield-0.28.1 → pyield-0.28.2}/pyield/b3_futures/common.py +0 -0
  16. {pyield-0.28.1 → pyield-0.28.2}/pyield/b3_futures/di.py +0 -0
  17. {pyield-0.28.1 → pyield-0.28.2}/pyield/b3_futures/historical.py +0 -0
  18. {pyield-0.28.1 → pyield-0.28.2}/pyield/b3_futures/intraday.py +0 -0
  19. {pyield-0.28.1 → pyield-0.28.2}/pyield/b3_futures/xml.py +0 -0
  20. {pyield-0.28.1 → pyield-0.28.2}/pyield/bc/auction.py +0 -0
  21. {pyield-0.28.1 → pyield-0.28.2}/pyield/bc/ptax.py +0 -0
  22. {pyield-0.28.1 → pyield-0.28.2}/pyield/bc/repos.py +0 -0
  23. {pyield-0.28.1 → pyield-0.28.2}/pyield/bday.py +0 -0
  24. {pyield-0.28.1 → pyield-0.28.2}/pyield/conftest.py +0 -0
  25. {pyield-0.28.1 → pyield-0.28.2}/pyield/data_cache.py +0 -0
  26. {pyield-0.28.1 → pyield-0.28.2}/pyield/date_converter.py +0 -0
  27. {pyield-0.28.1 → pyield-0.28.2}/pyield/holidays/__init__.py +0 -0
  28. {pyield-0.28.1 → pyield-0.28.2}/pyield/holidays/br_holidays_new.txt +0 -0
  29. {pyield-0.28.1 → pyield-0.28.2}/pyield/holidays/br_holidays_old.txt +0 -0
  30. {pyield-0.28.1 → pyield-0.28.2}/pyield/holidays/brholidays.py +0 -0
  31. {pyield-0.28.1 → pyield-0.28.2}/pyield/indicators.py +0 -0
  32. {pyield-0.28.1 → pyield-0.28.2}/pyield/interpolator.py +0 -0
  33. {pyield-0.28.1 → pyield-0.28.2}/pyield/py.typed +0 -0
  34. {pyield-0.28.1 → pyield-0.28.2}/pyield/tools.py +0 -0
  35. {pyield-0.28.1 → pyield-0.28.2}/pyield/tpf/__init__.py +0 -0
  36. {pyield-0.28.1 → pyield-0.28.2}/pyield/tpf/lft.py +0 -0
  37. {pyield-0.28.1 → pyield-0.28.2}/pyield/tpf/ltn.py +0 -0
  38. {pyield-0.28.1 → pyield-0.28.2}/pyield/tpf/ntnb.py +0 -0
  39. {pyield-0.28.1 → pyield-0.28.2}/pyield/tpf/ntnf.py +0 -0
  40. {pyield-0.28.1 → pyield-0.28.2}/pyield/tpf/tools.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PYield
3
- Version: 0.28.1
3
+ Version: 0.28.2
4
4
  Summary: A Python library for analysis of fixed income instruments in Brazil
5
5
  Project-URL: Source, https://github.com/crdcj/PYield
6
6
  Author-email: Carlos Carvalho <cr.cj@outlook.com>
@@ -34,8 +34,7 @@ Classifier: Programming Language :: Python :: 3
34
34
  Classifier: Topic :: Office/Business :: Financial :: Investment
35
35
  Requires-Python: >=3.11
36
36
  Requires-Dist: numpy>=2.0.0
37
- Requires-Dist: pandas[html,parquet]>=2.0.0
38
- Requires-Dist: python-calamine>=0.2.0
37
+ Requires-Dist: pandas[excel,html,parquet]>=2.0.0
39
38
  Requires-Dist: requests>=2.31.0
40
39
  Description-Content-Type: text/markdown
41
40
 
@@ -0,0 +1 @@
1
+ __version__ = "0.28.2"
@@ -1,11 +1,8 @@
1
- import io
2
1
  import locale
3
2
  from dataclasses import dataclass
4
3
  from typing import Literal
5
4
 
6
5
  import pandas as pd
7
- import python_calamine as pc
8
- import requests
9
6
 
10
7
 
11
8
  @dataclass
@@ -62,32 +59,23 @@ def ipca_current_month() -> IndicatorProjection:
62
59
  """
63
60
  # Define the URL and get the data
64
61
  url = "https://www.anbima.com.br/informacoes/indicadores/arqs/indicadores.xls"
65
- response = requests.get(url, timeout=10)
66
- excel_data = io.BytesIO(response.content)
62
+ df = pd.read_excel(url)
67
63
 
68
- # Load the workbook and select the first sheet
69
- workbook = pc.load_workbook(excel_data)
70
- first_sheet = workbook.sheet_names[0]
71
- data = workbook.get_sheet_by_name(first_sheet).to_python(skip_empty_area=True)
64
+ last_update_str = df.columns[0].split("Atualização:")[-1].strip()
72
65
 
73
- # Extract projection update date and time from the first row
74
- update_str = str(data[0][0])
75
- last_update_str = update_str.split("Atualização:")[-1].strip()
76
-
77
- # Find the text containing the IPCA projection and extract its data
78
- ipca_data = next(line for line in data if "IPCA1" in line)
79
- ipca_text = str(ipca_data[-1])
66
+ ipca_row = df[df.iloc[:, 0] == "IPCA1"]
67
+ ipca_date = ipca_row.iloc[0, 1]
68
+ ipca_value = ipca_row.iloc[0, 2]
80
69
 
81
70
  # Extract and format the reference month
82
- projection_text = str(ipca_data[1])
83
- month_str = projection_text.split("(")[-1].split(")")[0]
71
+ ipca_date = ipca_date.split("(")[-1].split(")")[0]
84
72
  locale.setlocale(locale.LC_TIME, "pt_BR.UTF-8")
85
- ipca_month_ts = pd.to_datetime(month_str, format="%b/%y")
86
- reference_period = ipca_month_ts.to_period("M")
73
+ ipca_date = pd.to_datetime(ipca_date, format="%b/%y")
74
+ reference_period = ipca_date.to_period("M")
87
75
  locale.setlocale(locale.LC_TIME, "") # Reset locale to default
88
76
 
89
77
  return IndicatorProjection(
90
78
  last_updated=pd.to_datetime(last_update_str, format="%d/%m/%Y - %H:%M h"),
91
79
  reference_period=reference_period,
92
- projected_value=round(float(ipca_text) / 100, 4),
80
+ projected_value=round(float(ipca_value) / 100, 4),
93
81
  )
@@ -14,9 +14,8 @@ classifiers = [
14
14
  "Topic :: Office/Business :: Financial :: Investment",
15
15
  ]
16
16
  dependencies = [
17
- "pandas[html,parquet]>=2.0.0",
18
- "numpy>=2.0.0",
19
- "python-calamine>=0.2.0",
17
+ "pandas[html,parquet,excel]>=2.0.0",
18
+ "numpy>=2.0.0",
20
19
  "requests>=2.31.0",
21
20
  ]
22
21
  dynamic = ["version"]
@@ -1 +0,0 @@
1
- __version__ = "0.28.1"
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