PYield 0.30.4__tar.gz → 0.30.6__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.30.4 → pyield-0.30.6}/PKG-INFO +1 -1
- pyield-0.30.6/pyield/__about__.py +1 -0
- {pyield-0.30.4 → pyield-0.30.6}/pyield/b3/di.py +17 -12
- pyield-0.30.4/pyield/__about__.py +0 -1
- {pyield-0.30.4 → pyield-0.30.6}/.gitignore +0 -0
- {pyield-0.30.4 → pyield-0.30.6}/LICENSE +0 -0
- {pyield-0.30.4 → pyield-0.30.6}/README.md +0 -0
- {pyield-0.30.4 → pyield-0.30.6}/pyield/__init__.py +0 -0
- {pyield-0.30.4 → pyield-0.30.6}/pyield/anbima/__init__.py +0 -0
- {pyield-0.30.4 → pyield-0.30.6}/pyield/anbima/ettj.py +0 -0
- {pyield-0.30.4 → pyield-0.30.6}/pyield/anbima/ima.py +0 -0
- {pyield-0.30.4 → pyield-0.30.6}/pyield/anbima/imaq.py +0 -0
- {pyield-0.30.4 → pyield-0.30.6}/pyield/anbima/ipca.py +0 -0
- {pyield-0.30.4 → pyield-0.30.6}/pyield/anbima/tpf.py +0 -0
- {pyield-0.30.4 → pyield-0.30.6}/pyield/b3/__init__.py +0 -0
- {pyield-0.30.4 → pyield-0.30.6}/pyield/b3/di_over.py +0 -0
- {pyield-0.30.4 → pyield-0.30.6}/pyield/b3/futures/__init__.py +0 -0
- {pyield-0.30.4 → pyield-0.30.6}/pyield/b3/futures/common.py +0 -0
- {pyield-0.30.4 → pyield-0.30.6}/pyield/b3/futures/historical.py +0 -0
- {pyield-0.30.4 → pyield-0.30.6}/pyield/b3/futures/intraday.py +0 -0
- {pyield-0.30.4 → pyield-0.30.6}/pyield/b3/futures/xml.py +0 -0
- {pyield-0.30.4 → pyield-0.30.6}/pyield/bc/__init__.py +0 -0
- {pyield-0.30.4 → pyield-0.30.6}/pyield/bc/auction.py +0 -0
- {pyield-0.30.4 → pyield-0.30.6}/pyield/bc/bcdata.py +0 -0
- {pyield-0.30.4 → pyield-0.30.6}/pyield/bc/ptax.py +0 -0
- {pyield-0.30.4 → pyield-0.30.6}/pyield/bc/repo.py +0 -0
- {pyield-0.30.4 → pyield-0.30.6}/pyield/bc/trade.py +0 -0
- {pyield-0.30.4 → pyield-0.30.6}/pyield/bc/vna.py +0 -0
- {pyield-0.30.4 → pyield-0.30.6}/pyield/bday.py +0 -0
- {pyield-0.30.4 → pyield-0.30.6}/pyield/conftest.py +0 -0
- {pyield-0.30.4 → pyield-0.30.6}/pyield/data_cache.py +0 -0
- {pyield-0.30.4 → pyield-0.30.6}/pyield/date_converter.py +0 -0
- {pyield-0.30.4 → pyield-0.30.6}/pyield/forwards.py +0 -0
- {pyield-0.30.4 → pyield-0.30.6}/pyield/holidays/__init__.py +0 -0
- {pyield-0.30.4 → pyield-0.30.6}/pyield/holidays/br_holidays_new.txt +0 -0
- {pyield-0.30.4 → pyield-0.30.6}/pyield/holidays/br_holidays_old.txt +0 -0
- {pyield-0.30.4 → pyield-0.30.6}/pyield/holidays/brholidays.py +0 -0
- {pyield-0.30.4 → pyield-0.30.6}/pyield/ibge/__init__.py +0 -0
- {pyield-0.30.4 → pyield-0.30.6}/pyield/ibge/ipca.py +0 -0
- {pyield-0.30.4 → pyield-0.30.6}/pyield/interpolator.py +0 -0
- {pyield-0.30.4 → pyield-0.30.6}/pyield/py.typed +0 -0
- {pyield-0.30.4 → pyield-0.30.6}/pyield/retry.py +0 -0
- {pyield-0.30.4 → pyield-0.30.6}/pyield/tpf/__init__.py +0 -0
- {pyield-0.30.4 → pyield-0.30.6}/pyield/tpf/lft.py +0 -0
- {pyield-0.30.4 → pyield-0.30.6}/pyield/tpf/ltn.py +0 -0
- {pyield-0.30.4 → pyield-0.30.6}/pyield/tpf/ntnb.py +0 -0
- {pyield-0.30.4 → pyield-0.30.6}/pyield/tpf/ntnf.py +0 -0
- {pyield-0.30.4 → pyield-0.30.6}/pyield/tpf/tools.py +0 -0
- {pyield-0.30.4 → pyield-0.30.6}/pyproject.toml +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.30.6"
|
|
@@ -21,8 +21,7 @@ class DIFutures:
|
|
|
21
21
|
|
|
22
22
|
Args:
|
|
23
23
|
date (DateScalar | None): The trade date to retrieve the
|
|
24
|
-
DI contract data. If None,
|
|
25
|
-
used.
|
|
24
|
+
DI contract data. If None, an empty DataFrame is returned.
|
|
26
25
|
month_start (bool): If True, adjusts the expirations to the start of the month.
|
|
27
26
|
pre_filter (bool): If True, filters the DI contracts to match only
|
|
28
27
|
expirations with existing prefixed TN bond maturities (LTN and NTN-F).
|
|
@@ -65,7 +64,7 @@ class DIFutures:
|
|
|
65
64
|
|
|
66
65
|
def __init__(
|
|
67
66
|
self,
|
|
68
|
-
date: DateScalar,
|
|
67
|
+
date: DateScalar | None = None,
|
|
69
68
|
month_start: bool = False,
|
|
70
69
|
pre_filter: bool = False,
|
|
71
70
|
all_columns: bool = True,
|
|
@@ -104,6 +103,9 @@ class DIFutures:
|
|
|
104
103
|
|
|
105
104
|
def _update_df(self) -> pd.DataFrame:
|
|
106
105
|
"""Retrieve DI contract DataFrame for the initialized trade date."""
|
|
106
|
+
if self._date is None:
|
|
107
|
+
logger.info("No date specified. Returning empty DataFrame.")
|
|
108
|
+
return pd.DataFrame()
|
|
107
109
|
# Return an empty DataFrame if the trade date is a holiday
|
|
108
110
|
if not bday.is_business_day(self._date):
|
|
109
111
|
logger.warning("Specified date is not a business day.")
|
|
@@ -189,7 +191,9 @@ class DIFutures:
|
|
|
189
191
|
- SettlementRate: The zero rate (interest rate) for each expiration.
|
|
190
192
|
- ForwardRate: The fwd rate calculated between successive expirations.
|
|
191
193
|
"""
|
|
194
|
+
# Use a local copy of the DI DataFrame
|
|
192
195
|
df = self.df
|
|
196
|
+
|
|
193
197
|
if df.empty:
|
|
194
198
|
return pd.DataFrame()
|
|
195
199
|
|
|
@@ -356,12 +360,13 @@ class DIFutures:
|
|
|
356
360
|
return self._date
|
|
357
361
|
|
|
358
362
|
@date.setter
|
|
359
|
-
def date(self, value: DateScalar):
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
363
|
+
def date(self, value: DateScalar | None):
|
|
364
|
+
if value:
|
|
365
|
+
self._date = dc.convert_input_dates(value)
|
|
366
|
+
bz_today = pd.Timestamp.today(tz="America/Sao_Paulo")
|
|
367
|
+
bz_today = bz_today.normalize().tz_localize(None)
|
|
368
|
+
if self._date > bz_today:
|
|
369
|
+
raise ValueError("Trade date cannot be in the future.")
|
|
365
370
|
self._dirty = True
|
|
366
371
|
|
|
367
372
|
@property
|
|
@@ -380,7 +385,7 @@ class DIFutures:
|
|
|
380
385
|
|
|
381
386
|
@month_start.setter
|
|
382
387
|
def month_start(self, value: bool):
|
|
383
|
-
self._month_start = value
|
|
388
|
+
self._month_start = bool(value)
|
|
384
389
|
self._dirty = True
|
|
385
390
|
|
|
386
391
|
@property
|
|
@@ -399,7 +404,7 @@ class DIFutures:
|
|
|
399
404
|
|
|
400
405
|
@pre_filter.setter
|
|
401
406
|
def pre_filter(self, value: bool):
|
|
402
|
-
self._pre_filter = value
|
|
407
|
+
self._pre_filter = bool(value)
|
|
403
408
|
self._dirty = True
|
|
404
409
|
|
|
405
410
|
@property
|
|
@@ -408,5 +413,5 @@ class DIFutures:
|
|
|
408
413
|
|
|
409
414
|
@all_columns.setter
|
|
410
415
|
def all_columns(self, value: bool):
|
|
411
|
-
self._all_columns = value
|
|
416
|
+
self._all_columns = bool(value)
|
|
412
417
|
self._dirty = True
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.30.4"
|
|
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
|
|
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
|