PYield 0.12.1__tar.gz → 0.12.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 (37) hide show
  1. {pyield-0.12.1 → pyield-0.12.2}/PKG-INFO +1 -1
  2. pyield-0.12.2/pyield/__about__.py +1 -0
  3. {pyield-0.12.1 → pyield-0.12.2}/pyield/bonds/ntnf.py +14 -5
  4. {pyield-0.12.1 → pyield-0.12.2}/pyproject.toml +1 -1
  5. pyield-0.12.1/pyield/__about__.py +0 -1
  6. {pyield-0.12.1 → pyield-0.12.2}/LICENSE +0 -0
  7. {pyield-0.12.1 → pyield-0.12.2}/README.md +0 -0
  8. {pyield-0.12.1 → pyield-0.12.2}/pyield/__init__.py +0 -0
  9. {pyield-0.12.1 → pyield-0.12.2}/pyield/bday.py +0 -0
  10. {pyield-0.12.1 → pyield-0.12.2}/pyield/bonds/__init__.py +0 -0
  11. {pyield-0.12.1 → pyield-0.12.2}/pyield/bonds/lft.py +0 -0
  12. {pyield-0.12.1 → pyield-0.12.2}/pyield/bonds/ltn.py +0 -0
  13. {pyield-0.12.1 → pyield-0.12.2}/pyield/bonds/ntnb.py +0 -0
  14. {pyield-0.12.1 → pyield-0.12.2}/pyield/bonds/utils.py +0 -0
  15. {pyield-0.12.1 → pyield-0.12.2}/pyield/date_converter.py +0 -0
  16. {pyield-0.12.1 → pyield-0.12.2}/pyield/di.py +0 -0
  17. {pyield-0.12.1 → pyield-0.12.2}/pyield/fetchers/__init__.py +0 -0
  18. {pyield-0.12.1 → pyield-0.12.2}/pyield/fetchers/anbima.py +0 -0
  19. {pyield-0.12.1 → pyield-0.12.2}/pyield/fetchers/futures_data/__init__.py +0 -0
  20. {pyield-0.12.1 → pyield-0.12.2}/pyield/fetchers/futures_data/common.py +0 -0
  21. {pyield-0.12.1 → pyield-0.12.2}/pyield/fetchers/futures_data/historical.py +0 -0
  22. {pyield-0.12.1 → pyield-0.12.2}/pyield/fetchers/futures_data/intraday.py +0 -0
  23. {pyield-0.12.1 → pyield-0.12.2}/pyield/fetchers/futures_data/xml.py +0 -0
  24. {pyield-0.12.1 → pyield-0.12.2}/pyield/fetchers/indicators.py +0 -0
  25. {pyield-0.12.1 → pyield-0.12.2}/pyield/fetchers/projections.py +0 -0
  26. {pyield-0.12.1 → pyield-0.12.2}/pyield/holidays/__init__.py +0 -0
  27. {pyield-0.12.1 → pyield-0.12.2}/pyield/holidays/br_holidays_new.txt +0 -0
  28. {pyield-0.12.1 → pyield-0.12.2}/pyield/holidays/br_holidays_old.txt +0 -0
  29. {pyield-0.12.1 → pyield-0.12.2}/pyield/holidays/holidays_manager.py +0 -0
  30. {pyield-0.12.1 → pyield-0.12.2}/pyield/interpolator.py +0 -0
  31. {pyield-0.12.1 → pyield-0.12.2}/pyield/py.typed +0 -0
  32. {pyield-0.12.1 → pyield-0.12.2}/tests/__init__.py +0 -0
  33. {pyield-0.12.1 → pyield-0.12.2}/tests/data/SPRD231222.zip +0 -0
  34. {pyield-0.12.1 → pyield-0.12.2}/tests/data/SPRD240426.zip +0 -0
  35. {pyield-0.12.1 → pyield-0.12.2}/tests/test_bday.py +0 -0
  36. {pyield-0.12.1 → pyield-0.12.2}/tests/test_futures.py +0 -0
  37. {pyield-0.12.1 → pyield-0.12.2}/tests/test_futures_xml.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PYield
3
- Version: 0.12.1
3
+ Version: 0.12.2
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-Email: Carlos Carvalho <cr.cj@outlook.com>
@@ -0,0 +1 @@
1
+ __version__ = "0.12.2"
@@ -321,12 +321,13 @@ def gross_di_spreads(reference_date: str | pd.Timestamp) -> pd.Series:
321
321
  return df["DISpread"]
322
322
 
323
323
 
324
- def net_di_spread(
324
+ def net_di_spread( # noqa
325
325
  settlement_date: str | pd.Timestamp,
326
326
  maturity_date: str | pd.Timestamp,
327
327
  ytm: float,
328
- di_rates: list[float],
329
- di_expirations: list[pd.Timestamp],
328
+ di_rates: list[float] | pd.Series,
329
+ di_expirations: list[pd.Timestamp] | pd.Series,
330
+ initial_guess: float | None = None,
330
331
  ) -> float:
331
332
  """
332
333
  Calculate the net DI spread for a bond given the YTM and the DI rates.
@@ -385,9 +386,17 @@ def net_di_spread(
385
386
  return (bond_cash_flows / (1 + di_interp + p) ** byears).sum() - bond_price
386
387
 
387
388
  try:
389
+ if initial_guess:
390
+ # Search interval is 50 bps above and below the initial guess
391
+ a = initial_guess - 50 / 10_000 # 50 bps below the initial guess
392
+ b = initial_guess + 50 / 10_000 # 50 bps above the initial guess
393
+ else:
394
+ # Search interval is from -0.01 to 0.01 (i.e., -100 to 100 bps)
395
+ a = -0.01
396
+ b = 0.01
397
+
388
398
  # Find the spread (p) that zeroes the price difference
389
- # Search interval is from -0.01 to 0.01 (i.e., -100 to 100 bps)
390
- p_solution = brentq(price_difference, -0.01, 0.01, maxiter=100)
399
+ p_solution = brentq(price_difference, a, b, maxiter=100)
391
400
  # Convert the solution to basis points (bps) and round to two decimal places
392
401
  p_solution = round((p_solution * 10_000), 2)
393
402
  except (ValueError, RuntimeError):
@@ -34,7 +34,7 @@ dependencies = [
34
34
  "pyarrow",
35
35
  ]
36
36
  dynamic = []
37
- version = "0.12.1"
37
+ version = "0.12.2"
38
38
 
39
39
  [project.license]
40
40
  file = "LICENSE"
@@ -1 +0,0 @@
1
- __version__ = "0.12.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