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.
- {pyield-0.12.1 → pyield-0.12.2}/PKG-INFO +1 -1
- pyield-0.12.2/pyield/__about__.py +1 -0
- {pyield-0.12.1 → pyield-0.12.2}/pyield/bonds/ntnf.py +14 -5
- {pyield-0.12.1 → pyield-0.12.2}/pyproject.toml +1 -1
- pyield-0.12.1/pyield/__about__.py +0 -1
- {pyield-0.12.1 → pyield-0.12.2}/LICENSE +0 -0
- {pyield-0.12.1 → pyield-0.12.2}/README.md +0 -0
- {pyield-0.12.1 → pyield-0.12.2}/pyield/__init__.py +0 -0
- {pyield-0.12.1 → pyield-0.12.2}/pyield/bday.py +0 -0
- {pyield-0.12.1 → pyield-0.12.2}/pyield/bonds/__init__.py +0 -0
- {pyield-0.12.1 → pyield-0.12.2}/pyield/bonds/lft.py +0 -0
- {pyield-0.12.1 → pyield-0.12.2}/pyield/bonds/ltn.py +0 -0
- {pyield-0.12.1 → pyield-0.12.2}/pyield/bonds/ntnb.py +0 -0
- {pyield-0.12.1 → pyield-0.12.2}/pyield/bonds/utils.py +0 -0
- {pyield-0.12.1 → pyield-0.12.2}/pyield/date_converter.py +0 -0
- {pyield-0.12.1 → pyield-0.12.2}/pyield/di.py +0 -0
- {pyield-0.12.1 → pyield-0.12.2}/pyield/fetchers/__init__.py +0 -0
- {pyield-0.12.1 → pyield-0.12.2}/pyield/fetchers/anbima.py +0 -0
- {pyield-0.12.1 → pyield-0.12.2}/pyield/fetchers/futures_data/__init__.py +0 -0
- {pyield-0.12.1 → pyield-0.12.2}/pyield/fetchers/futures_data/common.py +0 -0
- {pyield-0.12.1 → pyield-0.12.2}/pyield/fetchers/futures_data/historical.py +0 -0
- {pyield-0.12.1 → pyield-0.12.2}/pyield/fetchers/futures_data/intraday.py +0 -0
- {pyield-0.12.1 → pyield-0.12.2}/pyield/fetchers/futures_data/xml.py +0 -0
- {pyield-0.12.1 → pyield-0.12.2}/pyield/fetchers/indicators.py +0 -0
- {pyield-0.12.1 → pyield-0.12.2}/pyield/fetchers/projections.py +0 -0
- {pyield-0.12.1 → pyield-0.12.2}/pyield/holidays/__init__.py +0 -0
- {pyield-0.12.1 → pyield-0.12.2}/pyield/holidays/br_holidays_new.txt +0 -0
- {pyield-0.12.1 → pyield-0.12.2}/pyield/holidays/br_holidays_old.txt +0 -0
- {pyield-0.12.1 → pyield-0.12.2}/pyield/holidays/holidays_manager.py +0 -0
- {pyield-0.12.1 → pyield-0.12.2}/pyield/interpolator.py +0 -0
- {pyield-0.12.1 → pyield-0.12.2}/pyield/py.typed +0 -0
- {pyield-0.12.1 → pyield-0.12.2}/tests/__init__.py +0 -0
- {pyield-0.12.1 → pyield-0.12.2}/tests/data/SPRD231222.zip +0 -0
- {pyield-0.12.1 → pyield-0.12.2}/tests/data/SPRD240426.zip +0 -0
- {pyield-0.12.1 → pyield-0.12.2}/tests/test_bday.py +0 -0
- {pyield-0.12.1 → pyield-0.12.2}/tests/test_futures.py +0 -0
- {pyield-0.12.1 → pyield-0.12.2}/tests/test_futures_xml.py +0 -0
|
@@ -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
|
-
|
|
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):
|
|
@@ -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
|
|
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
|