pyacm 0.2__py3-none-any.whl → 0.4__py3-none-any.whl

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.
pyacm/acm.py CHANGED
@@ -130,7 +130,7 @@ class NominalACM:
130
130
 
131
131
  self.n_factors = n_factors
132
132
  self.curve = curve
133
- self.curve_monthly = curve.resample('ME').mean()
133
+ self.curve_monthly = curve.resample('M').mean()
134
134
  self.t = self.curve_monthly.shape[0] - 1
135
135
  self.n = self.curve_monthly.shape[1]
136
136
  self.rx_m, self.rf_m = self._get_excess_returns()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyacm
3
- Version: 0.2
3
+ Version: 0.4
4
4
  Summary: ACM Term Premium
5
5
  Author: Tobias Adrian, Richard K. Crump, Emanuel Moench
6
6
  Maintainer: Gustavo Amarante
@@ -33,6 +33,7 @@ carries all the relevant variables as atributes:
33
33
  - Yields fitted by the model
34
34
  - Risk-neutral yields
35
35
  - Term premium
36
+ - Historical in-sample expected returns
36
37
  - Expected return loadings
37
38
  - Hypothesis testing (Not sure if correct, more info observations below)
38
39
 
@@ -42,6 +43,38 @@ carries all the relevant variables as atributes:
42
43
  pip install pyacm
43
44
  ```
44
45
 
46
+ # Usage
47
+ ```python
48
+ from pyacm import NominalACM
49
+
50
+ acm = NominalACM(
51
+ curve=yield_curve,
52
+ n_factors=5,
53
+ )
54
+ ```
55
+ The tricky part of using this model is getting the correct data format. The
56
+ `yield_curve` dataframe in the expression above requires:
57
+ - Annualized log-yields for zero-coupon bonds
58
+ - Observations (index) must be in either monthly or daily frequency
59
+ - Maturities (columns) must be equally spaced in **monthly** frequency and start
60
+ at month 1. This means that you need to construct a bootstraped curve for every
61
+ date and interpolate it at fixed monthly maturities
62
+ - Whichever maturity you want to be the longest, your input data should have one
63
+ column more. For example, if you want term premium estimate up to the 10-year
64
+ yield (120 months), your input data should include maturities up to 121 months.
65
+ This is needed to properly compute the returns.
66
+
67
+ # Examples
68
+
69
+ The estimates for the US are available on the [NY FED website](https://www.newyorkfed.org/research/data_indicators/term-premia-tabs#/overview).
70
+
71
+ The jupyter notebook [`example_br`](https://github.com/gusamarante/pyacm/blob/main/example_br.ipynb)
72
+ contains an example application to the Brazilian DI futures curve that showcases all the available methods.
73
+
74
+ <p align="center">
75
+ <img src="https://raw.githubusercontent.com/gusamarante/pyacm/refs/heads/main/images/DI%20term%20premium.png" alt="DI Term Premium"/>
76
+ <img src="https://raw.githubusercontent.com/gusamarante/pyacm/refs/heads/main/images/DI%20observed%20vs%20risk%20neutral.png" alt="Observed VS Risk Neutral"/>
77
+ </p>
45
78
 
46
79
  # Original Article
47
80
  > Adrian, Tobias and Crump, Richard K. and Moench, Emanuel,
@@ -56,14 +89,6 @@ but I found an earlier version of the paper on SSRN where the authors go deeper
56
89
  - To get daily / real-time estimates, the factor loadings estimated from the monthly frquency are used to transform the daily data
57
90
 
58
91
 
59
- # Usage
60
- The tricky part of using this model is getting the correct data format:
61
- - The model works with annualized log-yields for zero-coupon bonds
62
- - Observations (index) must be in either monthly or daily frequency
63
- - Maturities (columns) must be equally spaced in **monthly** frequency and start at month 1. This means that you need to construct a bootstraped curve for every date and interpolate it at fixed monthly maturities.
64
- - Whichever maturity you want to be the longest, your input data should have one column more. For example, if you want term premium estimate up to the 10-year yield (120 months), your input data should include maturities up to 121 months. This is needed to properly compute the returns.
65
-
66
-
67
92
  # Observations
68
93
  I am not completely sure that computations in the [inferences attributes][inference_atribute]
69
94
  are correct. If you find any mistakes, please open a pull request following the contributing
@@ -0,0 +1,8 @@
1
+ pyacm/__init__.py,sha256=pRFuR3Au_ybQAmkJduGrLMKGJd1pxjhGfhsfsjlK-mU,66
2
+ pyacm/acm.py,sha256=5UxKhc5lptSE-K99Uo3b6hMkIfM-5y1P01qeb_K5xW0,14491
3
+ pyacm/utils.py,sha256=-PmH9L3LpzqUP-QU5BHisoLSBYrq-3PaPgR-W1sS1z8,904
4
+ pyacm-0.4.dist-info/LICENSE,sha256=YbUXx25Z6PzP4k4rsbs6tN58NiCwGIIrTMzql4iTeDs,1073
5
+ pyacm-0.4.dist-info/METADATA,sha256=eRotNIVK0skIEzKi4f0u2bnInhd_Ap2CuStomM-KliU,4164
6
+ pyacm-0.4.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
7
+ pyacm-0.4.dist-info/top_level.txt,sha256=xQy7q1eSKCnRtTnwb-Iz_spT0UDNdTyzKd43yz-ffrI,6
8
+ pyacm-0.4.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- pyacm/__init__.py,sha256=pRFuR3Au_ybQAmkJduGrLMKGJd1pxjhGfhsfsjlK-mU,66
2
- pyacm/acm.py,sha256=sUtw0NMEDfrpCtRWmVTryvJqMQXFvXo6m9tRAH1PGEA,14492
3
- pyacm/utils.py,sha256=-PmH9L3LpzqUP-QU5BHisoLSBYrq-3PaPgR-W1sS1z8,904
4
- pyacm-0.2.dist-info/LICENSE,sha256=YbUXx25Z6PzP4k4rsbs6tN58NiCwGIIrTMzql4iTeDs,1073
5
- pyacm-0.2.dist-info/METADATA,sha256=UUo-0gkeAL5nudUKju0UQlsUCs5VCzrfrFGvbVkNLFE,3286
6
- pyacm-0.2.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
7
- pyacm-0.2.dist-info/top_level.txt,sha256=xQy7q1eSKCnRtTnwb-Iz_spT0UDNdTyzKd43yz-ffrI,6
8
- pyacm-0.2.dist-info/RECORD,,
File without changes
File without changes