PYield 0.29.2__tar.gz → 0.29.3__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 (48) hide show
  1. {pyield-0.29.2 → pyield-0.29.3}/PKG-INFO +1 -1
  2. pyield-0.29.3/pyield/__about__.py +1 -0
  3. {pyield-0.29.2 → pyield-0.29.3}/pyield/__init__.py +4 -3
  4. pyield-0.29.3/pyield/b3/__init__.py +9 -0
  5. {pyield-0.29.2/pyield/b3_futures → pyield-0.29.3/pyield/b3}/di.py +1 -2
  6. pyield-0.29.3/pyield/b3/di_over.py +70 -0
  7. {pyield-0.29.2/pyield/b3_futures → pyield-0.29.3/pyield/b3/futures}/__init__.py +2 -2
  8. {pyield-0.29.2/pyield/b3_futures → pyield-0.29.3/pyield/b3/futures}/historical.py +1 -1
  9. {pyield-0.29.2/pyield/b3_futures → pyield-0.29.3/pyield/b3/futures}/xml.py +1 -1
  10. {pyield-0.29.2 → pyield-0.29.3}/pyield/tpf/ltn.py +1 -1
  11. {pyield-0.29.2 → pyield-0.29.3}/pyield/tpf/ntnf.py +1 -1
  12. {pyield-0.29.2 → pyield-0.29.3}/pyield/tpf/tools.py +1 -1
  13. pyield-0.29.2/pyield/__about__.py +0 -1
  14. {pyield-0.29.2 → pyield-0.29.3}/.gitignore +0 -0
  15. {pyield-0.29.2 → pyield-0.29.3}/LICENSE +0 -0
  16. {pyield-0.29.2 → pyield-0.29.3}/README.md +0 -0
  17. {pyield-0.29.2 → pyield-0.29.3}/pyield/anbima/__init__.py +0 -0
  18. {pyield-0.29.2 → pyield-0.29.3}/pyield/anbima/ima.py +0 -0
  19. {pyield-0.29.2 → pyield-0.29.3}/pyield/anbima/imaq.py +0 -0
  20. {pyield-0.29.2 → pyield-0.29.3}/pyield/anbima/ipca.py +0 -0
  21. {pyield-0.29.2 → pyield-0.29.3}/pyield/anbima/tpf.py +0 -0
  22. {pyield-0.29.2/pyield/b3_futures → pyield-0.29.3/pyield/b3/futures}/common.py +0 -0
  23. {pyield-0.29.2/pyield/b3_futures → pyield-0.29.3/pyield/b3/futures}/intraday.py +0 -0
  24. {pyield-0.29.2 → pyield-0.29.3}/pyield/bc/__init__.py +0 -0
  25. {pyield-0.29.2 → pyield-0.29.3}/pyield/bc/auction.py +0 -0
  26. {pyield-0.29.2 → pyield-0.29.3}/pyield/bc/bcdata.py +0 -0
  27. {pyield-0.29.2 → pyield-0.29.3}/pyield/bc/ptax.py +0 -0
  28. {pyield-0.29.2 → pyield-0.29.3}/pyield/bc/repos.py +0 -0
  29. {pyield-0.29.2 → pyield-0.29.3}/pyield/bc/sec.py +0 -0
  30. {pyield-0.29.2 → pyield-0.29.3}/pyield/bc/vna.py +0 -0
  31. {pyield-0.29.2 → pyield-0.29.3}/pyield/bday.py +0 -0
  32. {pyield-0.29.2 → pyield-0.29.3}/pyield/config.py +0 -0
  33. {pyield-0.29.2 → pyield-0.29.3}/pyield/conftest.py +0 -0
  34. {pyield-0.29.2 → pyield-0.29.3}/pyield/data_cache.py +0 -0
  35. {pyield-0.29.2 → pyield-0.29.3}/pyield/date_converter.py +0 -0
  36. {pyield-0.29.2 → pyield-0.29.3}/pyield/forwards.py +0 -0
  37. {pyield-0.29.2 → pyield-0.29.3}/pyield/holidays/__init__.py +0 -0
  38. {pyield-0.29.2 → pyield-0.29.3}/pyield/holidays/br_holidays_new.txt +0 -0
  39. {pyield-0.29.2 → pyield-0.29.3}/pyield/holidays/br_holidays_old.txt +0 -0
  40. {pyield-0.29.2 → pyield-0.29.3}/pyield/holidays/brholidays.py +0 -0
  41. {pyield-0.29.2 → pyield-0.29.3}/pyield/ibge/__init__.py +0 -0
  42. {pyield-0.29.2 → pyield-0.29.3}/pyield/ibge/ipca.py +0 -0
  43. {pyield-0.29.2 → pyield-0.29.3}/pyield/interpolator.py +0 -0
  44. {pyield-0.29.2 → pyield-0.29.3}/pyield/py.typed +0 -0
  45. {pyield-0.29.2 → pyield-0.29.3}/pyield/tpf/__init__.py +0 -0
  46. {pyield-0.29.2 → pyield-0.29.3}/pyield/tpf/lft.py +0 -0
  47. {pyield-0.29.2 → pyield-0.29.3}/pyield/tpf/ntnb.py +0 -0
  48. {pyield-0.29.2 → pyield-0.29.3}/pyproject.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PYield
3
- Version: 0.29.2
3
+ Version: 0.29.3
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>
@@ -0,0 +1 @@
1
+ __version__ = "0.29.3"
@@ -1,9 +1,9 @@
1
1
  import logging
2
2
 
3
- from pyield import anbima, bc, bday, ibge
3
+ from pyield import anbima, b3, bc, bday, ibge
4
4
  from pyield.__about__ import __version__
5
- from pyield.b3_futures import futures
6
- from pyield.b3_futures.di import DIFutures
5
+ from pyield.b3 import futures
6
+ from pyield.b3.di import DIFutures
7
7
  from pyield.forwards import forward_rates
8
8
  from pyield.interpolator import Interpolator
9
9
  from pyield.tpf import lft, ltn, ntnb, ntnf
@@ -22,6 +22,7 @@ __all__ = [
22
22
  "ntnb",
23
23
  "ntnf",
24
24
  "bc",
25
+ "b3",
25
26
  ]
26
27
 
27
28
  # Configura o logger do pacote principal com um NullHandler
@@ -0,0 +1,9 @@
1
+ from pyield.b3.di import DIFutures
2
+ from pyield.b3.di_over import di_over
3
+ from pyield.b3.futures import futures
4
+
5
+ __all__ = [
6
+ "di_over",
7
+ "futures",
8
+ "DIFutures",
9
+ ]
@@ -1,9 +1,8 @@
1
1
  import pandas as pd
2
2
 
3
- import pyield.b3_futures as b3
4
3
  import pyield.date_converter as dc
5
4
  import pyield.forwards as tl
6
- from pyield import bday, interpolator
5
+ from pyield import b3, bday, interpolator
7
6
  from pyield.data_cache import get_anbima_dataset, get_di_dataset
8
7
  from pyield.date_converter import DateArray, DateScalar
9
8
 
@@ -0,0 +1,70 @@
1
+ import ftplib
2
+
3
+ from pyield.date_converter import DateScalar, convert_input_dates
4
+
5
+
6
+ def di_over(date: DateScalar) -> float:
7
+ """
8
+ Gets the DI (Interbank Deposit) rate for a specific date from B3/CETIP FTP server.
9
+
10
+ Args:
11
+ date (str): Date in DD/MM/YYYY format
12
+
13
+ Returns:
14
+ float: DI rate for the specified date
15
+
16
+ Raises:
17
+ ValueError: If date is not in the correct format
18
+ ftplib.error_perm: If the file is not found or there is a permission error
19
+ Exception: For any other unexpected error
20
+
21
+ Examples:
22
+ >>> di_over("28/02/2025")
23
+ 0.1315
24
+ """
25
+ ftp = None
26
+ try:
27
+ # Convert date to file format
28
+ date_obj = convert_input_dates(date)
29
+ filename = date_obj.strftime("%Y%m%d.txt")
30
+
31
+ # Connect to FTP and get the file
32
+ ftp = ftplib.FTP("ftp.cetip.com.br")
33
+ ftp.login()
34
+ ftp.cwd("/MediaCDI")
35
+
36
+ # Read rate
37
+ lines = []
38
+ ftp.retrlines(f"RETR {filename}", lines.append)
39
+
40
+ # Close FTP connection
41
+ ftp.quit()
42
+
43
+ # Get and format rate
44
+ if lines:
45
+ raw_rate = lines[0].strip()
46
+ rate = int(raw_rate) / 10000
47
+ return round(rate, 5)
48
+ else:
49
+ return "Empty file or no data"
50
+
51
+ except ValueError as e:
52
+ return f"Date format error: {e}"
53
+ except ftplib.error_perm as e:
54
+ return f"File access error: {e}"
55
+ except Exception as e:
56
+ return f"Unexpected error: {e}"
57
+ finally:
58
+ # Ensure FTP connection is closed
59
+ if ftp:
60
+ try:
61
+ ftp.quit()
62
+ except: # noqa
63
+ pass
64
+
65
+
66
+ # Example usage
67
+ if __name__ == "__main__":
68
+ date = "28/02/2025"
69
+ rate = di_over(date)
70
+ print(f"DI Rate for {date}: {rate}")
@@ -5,8 +5,8 @@ from zoneinfo import ZoneInfo
5
5
  import pandas as pd
6
6
 
7
7
  from pyield import date_converter as dc
8
- from pyield.b3_futures.historical import fetch_historical_df
9
- from pyield.b3_futures.intraday import fetch_intraday_df
8
+ from pyield.b3.futures.historical import fetch_historical_df
9
+ from pyield.b3.futures.intraday import fetch_intraday_df
10
10
  from pyield.date_converter import DateScalar
11
11
 
12
12
  TIMEZONE_BZ = ZoneInfo("America/Sao_Paulo")
@@ -4,7 +4,7 @@ import pandas as pd
4
4
  import requests
5
5
 
6
6
  from pyield import bday
7
- from pyield.b3_futures import common
7
+ from pyield.b3.futures import common
8
8
 
9
9
  COUNT_CONVENTIONS = {
10
10
  "DAP": 252,
@@ -8,7 +8,7 @@ import requests
8
8
  from lxml import etree
9
9
 
10
10
  from pyield import bday
11
- from pyield.b3_futures import common
11
+ from pyield.b3.futures import common
12
12
 
13
13
 
14
14
  def _get_file_from_path(file_path: Path) -> io.BytesIO:
@@ -3,7 +3,7 @@ import pandas as pd
3
3
  from pyield import bday
4
4
  from pyield import date_converter as dc
5
5
  from pyield.anbima import tpf
6
- from pyield.b3_futures import di
6
+ from pyield.b3 import di
7
7
  from pyield.date_converter import DateScalar
8
8
  from pyield.tpf import tools as tt
9
9
 
@@ -7,7 +7,7 @@ from pyield import bday
7
7
  from pyield import date_converter as dc
8
8
  from pyield import interpolator as ip
9
9
  from pyield.anbima import tpf
10
- from pyield.b3_futures import di
10
+ from pyield.b3 import di
11
11
  from pyield.date_converter import DateScalar
12
12
  from pyield.tpf import tools as tt
13
13
 
@@ -5,7 +5,7 @@ import pandas as pd
5
5
 
6
6
  from pyield import date_converter as dc
7
7
  from pyield.anbima import tpf
8
- from pyield.b3_futures.di import DIFutures
8
+ from pyield.b3.di import DIFutures
9
9
  from pyield.date_converter import DateScalar
10
10
 
11
11
 
@@ -1 +0,0 @@
1
- __version__ = "0.29.2"
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