PYield 0.31.2__tar.gz → 0.31.4__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 (50) hide show
  1. {pyield-0.31.2 → pyield-0.31.4}/PKG-INFO +1 -1
  2. pyield-0.31.4/pyield/__about__.py +1 -0
  3. {pyield-0.31.2 → pyield-0.31.4}/pyield/anbima/ettj.py +4 -2
  4. {pyield-0.31.2 → pyield-0.31.4}/pyield/tpf/ltn.py +32 -0
  5. {pyield-0.31.2 → pyield-0.31.4}/pyield/tpf/ntnb.py +35 -0
  6. {pyield-0.31.2 → pyield-0.31.4}/pyield/tpf/ntnf.py +32 -0
  7. pyield-0.31.2/pyield/__about__.py +0 -1
  8. {pyield-0.31.2 → pyield-0.31.4}/.gitignore +0 -0
  9. {pyield-0.31.2 → pyield-0.31.4}/LICENSE +0 -0
  10. {pyield-0.31.2 → pyield-0.31.4}/README.md +0 -0
  11. {pyield-0.31.2 → pyield-0.31.4}/pyield/__init__.py +0 -0
  12. {pyield-0.31.2 → pyield-0.31.4}/pyield/anbima/__init__.py +0 -0
  13. {pyield-0.31.2 → pyield-0.31.4}/pyield/anbima/ima.py +0 -0
  14. {pyield-0.31.2 → pyield-0.31.4}/pyield/anbima/imaq.py +0 -0
  15. {pyield-0.31.2 → pyield-0.31.4}/pyield/anbima/ipca.py +0 -0
  16. {pyield-0.31.2 → pyield-0.31.4}/pyield/anbima/tpf.py +0 -0
  17. {pyield-0.31.2 → pyield-0.31.4}/pyield/b3/__init__.py +0 -0
  18. {pyield-0.31.2 → pyield-0.31.4}/pyield/b3/di.py +0 -0
  19. {pyield-0.31.2 → pyield-0.31.4}/pyield/b3/di_over.py +0 -0
  20. {pyield-0.31.2 → pyield-0.31.4}/pyield/b3/futures/__init__.py +0 -0
  21. {pyield-0.31.2 → pyield-0.31.4}/pyield/b3/futures/common.py +0 -0
  22. {pyield-0.31.2 → pyield-0.31.4}/pyield/b3/futures/historical.py +0 -0
  23. {pyield-0.31.2 → pyield-0.31.4}/pyield/b3/futures/intraday.py +0 -0
  24. {pyield-0.31.2 → pyield-0.31.4}/pyield/b3/futures/xml.py +0 -0
  25. {pyield-0.31.2 → pyield-0.31.4}/pyield/bc/__init__.py +0 -0
  26. {pyield-0.31.2 → pyield-0.31.4}/pyield/bc/auction.py +0 -0
  27. {pyield-0.31.2 → pyield-0.31.4}/pyield/bc/bcdata.py +0 -0
  28. {pyield-0.31.2 → pyield-0.31.4}/pyield/bc/ptax.py +0 -0
  29. {pyield-0.31.2 → pyield-0.31.4}/pyield/bc/repo.py +0 -0
  30. {pyield-0.31.2 → pyield-0.31.4}/pyield/bc/trade.py +0 -0
  31. {pyield-0.31.2 → pyield-0.31.4}/pyield/bc/vna.py +0 -0
  32. {pyield-0.31.2 → pyield-0.31.4}/pyield/bday.py +0 -0
  33. {pyield-0.31.2 → pyield-0.31.4}/pyield/conftest.py +0 -0
  34. {pyield-0.31.2 → pyield-0.31.4}/pyield/data_cache.py +0 -0
  35. {pyield-0.31.2 → pyield-0.31.4}/pyield/date_converter.py +0 -0
  36. {pyield-0.31.2 → pyield-0.31.4}/pyield/forwards.py +0 -0
  37. {pyield-0.31.2 → pyield-0.31.4}/pyield/holidays/__init__.py +0 -0
  38. {pyield-0.31.2 → pyield-0.31.4}/pyield/holidays/br_holidays_new.txt +0 -0
  39. {pyield-0.31.2 → pyield-0.31.4}/pyield/holidays/br_holidays_old.txt +0 -0
  40. {pyield-0.31.2 → pyield-0.31.4}/pyield/holidays/brholidays.py +0 -0
  41. {pyield-0.31.2 → pyield-0.31.4}/pyield/ibge/__init__.py +0 -0
  42. {pyield-0.31.2 → pyield-0.31.4}/pyield/ibge/ipca.py +0 -0
  43. {pyield-0.31.2 → pyield-0.31.4}/pyield/interpolator.py +0 -0
  44. {pyield-0.31.2 → pyield-0.31.4}/pyield/py.typed +0 -0
  45. {pyield-0.31.2 → pyield-0.31.4}/pyield/retry.py +0 -0
  46. {pyield-0.31.2 → pyield-0.31.4}/pyield/tpf/__init__.py +0 -0
  47. {pyield-0.31.2 → pyield-0.31.4}/pyield/tpf/lft.py +0 -0
  48. {pyield-0.31.2 → pyield-0.31.4}/pyield/tpf/ntnc.py +0 -0
  49. {pyield-0.31.2 → pyield-0.31.4}/pyield/tpf/tools.py +0 -0
  50. {pyield-0.31.2 → pyield-0.31.4}/pyproject.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PYield
3
- Version: 0.31.2
3
+ Version: 0.31.4
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.31.4"
@@ -137,8 +137,10 @@ def intraday_ettj() -> pd.DataFrame:
137
137
  Note:
138
138
  All rates are expressed in decimal format (e.g., 0.12 for 12%).
139
139
  """
140
- text = requests.get(INTRADAY_ETTJ_URL).text
141
- text_parts = text.split("ETTJ IPCA (%a.a./252)")
140
+
141
+ request_payload = {"Dt_Ref": "", "saida": "csv"}
142
+ response = requests.post(INTRADAY_ETTJ_URL, data=request_payload)
143
+ text_parts = response.text.split("ETTJ IPCA (%a.a./252)")
142
144
 
143
145
  nominal_text = text_parts[0]
144
146
  lines = nominal_text.splitlines()
@@ -230,3 +230,35 @@ def historical_premium(
230
230
 
231
231
  # Calculate and return the premium using the extracted rates
232
232
  return premium(ltn_rate, di_rate)
233
+
234
+
235
+ def dv01(
236
+ settlement: DateScalar,
237
+ maturity: DateScalar,
238
+ rate: float,
239
+ ) -> float:
240
+ """
241
+ Calculate the DV01 (Dollar Value of 01) for an LTN in R$.
242
+
243
+ Represents the price change in R$ for a 1 basis point (0.01%) increase in yield.
244
+
245
+ Args:
246
+ settlement (DateScalar): The settlement date in 'DD-MM-YYYY' format
247
+ or a pandas Timestamp.
248
+ maturity (DateScalar): The maturity date in 'DD-MM-YYYY' format or
249
+ a pandas Timestamp.
250
+ rate (float): The discount rate used to calculate the present value of
251
+ the cash flows, which is the yield to maturity (YTM) of the LTN.
252
+
253
+ Returns:
254
+ float: The DV01 value, representing the price change for a 1 basis point
255
+ increase in yield.
256
+
257
+ Examples:
258
+ >>> from pyield import ltn
259
+ >>> ltn.dv01("26-03-2025", "01-01-2032", 0.150970)
260
+ 0.2269059999999854
261
+ """
262
+ price1 = price(settlement, maturity, rate)
263
+ price2 = price(settlement, maturity, rate + 0.0001)
264
+ return price1 - price2
@@ -550,3 +550,38 @@ def duration(
550
550
  df["DCF"] = df["CashFlow"] / (1 + rate) ** df["BY"]
551
551
  np_duration = (df["DCF"] * df["BY"]).sum() / df["DCF"].sum()
552
552
  return float(np_duration)
553
+
554
+
555
+ def dv01(
556
+ settlement: DateScalar,
557
+ maturity: DateScalar,
558
+ rate: float,
559
+ vna: float,
560
+ ) -> float:
561
+ """
562
+ Calculate the DV01 (Dollar Value of 01) for an NTN-B in R$.
563
+
564
+ Represents the price change in R$ for a 1 basis point (0.01%) increase in yield.
565
+
566
+ Args:
567
+ settlement (DateScalar): The settlement date in 'DD-MM-YYYY' format
568
+ or a pandas Timestamp.
569
+ maturity (DateScalar): The maturity date in 'DD-MM-YYYY' format or
570
+ a pandas Timestamp.
571
+ rate (float): The discount rate used to calculate the present value of
572
+ the cash flows, which is the yield to maturity (YTM) of the NTN-B.
573
+
574
+ Returns:
575
+ float: The DV01 value, representing the price change for a 1 basis point
576
+ increase in yield.
577
+
578
+ Examples:
579
+ >>> from pyield import ntnb
580
+ >>> ntnb.dv01("26-03-2025", "15-08-2060", 0.074358, 4470.979474)
581
+ 4.640875999999935
582
+ """
583
+ quotation1 = quotation(settlement, maturity, rate)
584
+ quotation2 = quotation(settlement, maturity, rate + 0.0001)
585
+ price1 = price(vna, quotation1)
586
+ price2 = price(vna, quotation2)
587
+ return price1 - price2
@@ -653,3 +653,35 @@ def duration(
653
653
  df["DCF"] = df["CashFlow"] / (1 + rate) ** df["BY"]
654
654
  np_duration = (df["DCF"] * df["BY"]).sum() / df["DCF"].sum()
655
655
  return float(np_duration)
656
+
657
+
658
+ def dv01(
659
+ settlement: DateScalar,
660
+ maturity: DateScalar,
661
+ rate: float,
662
+ ) -> float:
663
+ """
664
+ Calculate the DV01 (Dollar Value of 01) for an NTN-F in R$.
665
+
666
+ Represents the price change in R$ for a 1 basis point (0.01%) increase in yield.
667
+
668
+ Args:
669
+ settlement (DateScalar): The settlement date in 'DD-MM-YYYY' format
670
+ or a pandas Timestamp.
671
+ maturity (DateScalar): The maturity date in 'DD-MM-YYYY' format or
672
+ a pandas Timestamp.
673
+ rate (float): The discount rate used to calculate the present value of
674
+ the cash flows, which is the yield to maturity (YTM) of the NTN-F.
675
+
676
+ Returns:
677
+ float: The DV01 value, representing the price change for a 1 basis point
678
+ increase in yield.
679
+
680
+ Examples:
681
+ >>> from pyield import ntnf
682
+ >>> ntnf.dv01("26-03-2025", "01-01-2035", 0.151375)
683
+ 0.39025200000003224
684
+ """
685
+ price1 = price(settlement, maturity, rate)
686
+ price2 = price(settlement, maturity, rate + 0.0001)
687
+ return price1 - price2
@@ -1 +0,0 @@
1
- __version__ = "0.31.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
File without changes
File without changes
File without changes
File without changes
File without changes