PYield 0.34.0__tar.gz → 0.34.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 (51) hide show
  1. {pyield-0.34.0 → pyield-0.34.2}/PKG-INFO +1 -1
  2. pyield-0.34.2/pyield/__about__.py +1 -0
  3. {pyield-0.34.0 → pyield-0.34.2}/pyield/bc/trades_monthly.py +14 -12
  4. pyield-0.34.0/pyield/__about__.py +0 -1
  5. {pyield-0.34.0 → pyield-0.34.2}/.gitignore +0 -0
  6. {pyield-0.34.0 → pyield-0.34.2}/LICENSE +0 -0
  7. {pyield-0.34.0 → pyield-0.34.2}/README.md +0 -0
  8. {pyield-0.34.0 → pyield-0.34.2}/pyield/__init__.py +0 -0
  9. {pyield-0.34.0 → pyield-0.34.2}/pyield/anbima/__init__.py +0 -0
  10. {pyield-0.34.0 → pyield-0.34.2}/pyield/anbima/ettj.py +0 -0
  11. {pyield-0.34.0 → pyield-0.34.2}/pyield/anbima/ima.py +0 -0
  12. {pyield-0.34.0 → pyield-0.34.2}/pyield/anbima/imaq.py +0 -0
  13. {pyield-0.34.0 → pyield-0.34.2}/pyield/anbima/ipca.py +0 -0
  14. {pyield-0.34.0 → pyield-0.34.2}/pyield/anbima/tpf.py +0 -0
  15. {pyield-0.34.0 → pyield-0.34.2}/pyield/b3/__init__.py +0 -0
  16. {pyield-0.34.0 → pyield-0.34.2}/pyield/b3/di_over.py +0 -0
  17. {pyield-0.34.0 → pyield-0.34.2}/pyield/b3/dif.py +0 -0
  18. {pyield-0.34.0 → pyield-0.34.2}/pyield/b3/futures/__init__.py +0 -0
  19. {pyield-0.34.0 → pyield-0.34.2}/pyield/b3/futures/common.py +0 -0
  20. {pyield-0.34.0 → pyield-0.34.2}/pyield/b3/futures/historical.py +0 -0
  21. {pyield-0.34.0 → pyield-0.34.2}/pyield/b3/futures/intraday.py +0 -0
  22. {pyield-0.34.0 → pyield-0.34.2}/pyield/b3/futures/xml.py +0 -0
  23. {pyield-0.34.0 → pyield-0.34.2}/pyield/bc/__init__.py +0 -0
  24. {pyield-0.34.0 → pyield-0.34.2}/pyield/bc/auction.py +0 -0
  25. {pyield-0.34.0 → pyield-0.34.2}/pyield/bc/bcdata.py +0 -0
  26. {pyield-0.34.0 → pyield-0.34.2}/pyield/bc/ptax.py +0 -0
  27. {pyield-0.34.0 → pyield-0.34.2}/pyield/bc/repo.py +0 -0
  28. {pyield-0.34.0 → pyield-0.34.2}/pyield/bc/trades_intraday.py +0 -0
  29. {pyield-0.34.0 → pyield-0.34.2}/pyield/bc/vna.py +0 -0
  30. {pyield-0.34.0 → pyield-0.34.2}/pyield/bday.py +0 -0
  31. {pyield-0.34.0 → pyield-0.34.2}/pyield/conftest.py +0 -0
  32. {pyield-0.34.0 → pyield-0.34.2}/pyield/data_cache.py +0 -0
  33. {pyield-0.34.0 → pyield-0.34.2}/pyield/date_converter.py +0 -0
  34. {pyield-0.34.0 → pyield-0.34.2}/pyield/fwd.py +0 -0
  35. {pyield-0.34.0 → pyield-0.34.2}/pyield/holidays/__init__.py +0 -0
  36. {pyield-0.34.0 → pyield-0.34.2}/pyield/holidays/br_holidays_new.txt +0 -0
  37. {pyield-0.34.0 → pyield-0.34.2}/pyield/holidays/br_holidays_old.txt +0 -0
  38. {pyield-0.34.0 → pyield-0.34.2}/pyield/holidays/brholidays.py +0 -0
  39. {pyield-0.34.0 → pyield-0.34.2}/pyield/ibge/__init__.py +0 -0
  40. {pyield-0.34.0 → pyield-0.34.2}/pyield/ibge/ipca.py +0 -0
  41. {pyield-0.34.0 → pyield-0.34.2}/pyield/interpolator.py +0 -0
  42. {pyield-0.34.0 → pyield-0.34.2}/pyield/py.typed +0 -0
  43. {pyield-0.34.0 → pyield-0.34.2}/pyield/retry.py +0 -0
  44. {pyield-0.34.0 → pyield-0.34.2}/pyield/tpf/__init__.py +0 -0
  45. {pyield-0.34.0 → pyield-0.34.2}/pyield/tpf/lft.py +0 -0
  46. {pyield-0.34.0 → pyield-0.34.2}/pyield/tpf/ltn.py +0 -0
  47. {pyield-0.34.0 → pyield-0.34.2}/pyield/tpf/ntnb.py +0 -0
  48. {pyield-0.34.0 → pyield-0.34.2}/pyield/tpf/ntnc.py +0 -0
  49. {pyield-0.34.0 → pyield-0.34.2}/pyield/tpf/ntnf.py +0 -0
  50. {pyield-0.34.0 → pyield-0.34.2}/pyield/tpf/tools.py +0 -0
  51. {pyield-0.34.0 → pyield-0.34.2}/pyproject.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PYield
3
- Version: 0.34.0
3
+ Version: 0.34.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>
@@ -0,0 +1 @@
1
+ __version__ = "0.34.2"
@@ -32,7 +32,7 @@ COLUMN_MAPPING = {
32
32
  }
33
33
 
34
34
 
35
- def _build_filename(target_date: DateScalar, all_operations: bool) -> str:
35
+ def _build_filename(target_date: DateScalar, extragoup: bool) -> str:
36
36
  """
37
37
  URL com todos os arquivos disponíveis:
38
38
  https://www4.bcb.gov.br/pom/demab/negociacoes/apresentacao.asp?frame=1
@@ -45,7 +45,7 @@ def _build_filename(target_date: DateScalar, all_operations: bool) -> str:
45
45
  """
46
46
  target_date = convert_input_dates(target_date)
47
47
  file_date = target_date.strftime("%Y%m")
48
- operation_acronym = "T" if all_operations else "E"
48
+ operation_acronym = "E" if extragoup else "T"
49
49
  return f"Neg{operation_acronym}{file_date}.ZIP"
50
50
 
51
51
 
@@ -64,7 +64,7 @@ def _fetch_data_from_url(file_url: str) -> pd.DataFrame:
64
64
 
65
65
 
66
66
  def fpd_monthly_trades(
67
- target_date: DateScalar, all_operations: bool = True
67
+ target_date: DateScalar, extragroup: bool = False
68
68
  ) -> pd.DataFrame:
69
69
  """Fetches monthly secondary trading data for the domestic 'Federal Public Debt'
70
70
  (FPD) registered in the Brazilian Central Bank (BCB) Selic system.
@@ -79,8 +79,14 @@ def fpd_monthly_trades(
79
79
  fetched. This date can be a string, datetime, or pandas Timestamp object.
80
80
  It will be converted to a pandas Timestamp object. Only the year and month
81
81
  of this date will be used to download the corresponding monthly file.
82
- all_operations (bool): If True, fetches all operations. If False, fetches only
83
- the extra group operations. Defaults to True.
82
+ extragroup (bool): If True, fetches only the trades that are considered
83
+ 'extragroup' (between different economic groups)".
84
+ If False, fetches all trades. Default is False.
85
+ Extragroup trades are those where the transferring counterparty's
86
+ conglomerate is different from the receiving counterparty's conglomerate, or
87
+ when at least one of the counterparties does not belong to a conglomerate.
88
+ In the case of funds, the conglomerate considered is that of the
89
+ administrator.
84
90
 
85
91
  Returns:
86
92
  pd.DataFrame: A DataFrame containing the bond trading data for the specified
@@ -103,18 +109,14 @@ def fpd_monthly_trades(
103
109
  Examples:
104
110
  >>> from pyield import bc
105
111
  >>> df = bc.fpd_monthly_trades("07-01-2025") # Returns all trades for Jan/2025
106
-
107
- Notes:
108
- Transactions are considered off-group when the transferring counterparty's
109
- conglomerate is different from the receiving counterparty's conglomerate,
110
- or when at least one of the counterparties does not belong to a conglomerate.
111
- In the case of funds, the conglomerate considered is that of the administrator.
112
112
  """
113
- filename = _build_filename(target_date, all_operations)
113
+ filename = _build_filename(target_date, extragroup)
114
114
  logger.info(f"Fetching FPD trades for {target_date} from BCB")
115
115
  url = f"{BASE_URL}/{filename}"
116
116
  df = _fetch_data_from_url(url)
117
117
  df = df.rename(columns=COLUMN_MAPPING)
118
118
  # Volume are empty in the original BCB file, so we calculate it
119
119
  df["Volume"] = (df["Quantity"] * df["AvgPrice"]).round(2)
120
+ sort_cols = ["SettlementDate", "BondType", "MaturityDate"]
121
+ df = df.sort_values(by=sort_cols).reset_index(drop=True)
120
122
  return df
@@ -1 +0,0 @@
1
- __version__ = "0.34.0"
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