Skip to content

Commit 24f3414

Browse files
committed
Remove FRED, and other minor adjustments
1 parent efd3018 commit 24f3414

File tree

4 files changed

+3
-68
lines changed

4 files changed

+3
-68
lines changed

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ but I found an earlier version of the paper on SSRN where the authors go deeper
4141
- To get daily / real-time estimates, the factor loadings estimated from the monthly frquency are used to transform the daily data
4242

4343

44-
45-
4644
# Usage
4745
The tricky part of using this model is getting the correct data format:
4846
- The model works with annualized log-yields for zero-coupon bonds

example_br.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# TODO Turn this into a jupyter notebook
2-
31
from pyacm import NominalACM
42
import matplotlib.pyplot as plt
53
import matplotlib.dates as mdates

pyacm/utils.py

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import numpy as np
2-
import pandas as pd
32

43

54
def vec(mat):
@@ -42,63 +41,3 @@ def commutation_matrix(shape):
4241
w = np.arange(m * n).reshape((m, n), order="F").T.ravel(order="F")
4342
k = np.eye(m * n)[w, :]
4443
return k
45-
46-
47-
class FRED(object):
48-
"""
49-
Wrapper for the data API of the FRED
50-
"""
51-
52-
def fetch(self, series_id):
53-
"""
54-
Grabs series from the FRED website and returns them in a pandas
55-
dataframe
56-
57-
Parameters
58-
----------
59-
series_id: str, list, dict
60-
string with series ID, list of strings of the series ID or
61-
dict with series ID as keys and their desired names as values
62-
"""
63-
64-
if type(series_id) is list:
65-
66-
df = pd.DataFrame()
67-
68-
for cod in series_id:
69-
single_series = self._fetch_single_code(cod)
70-
df = pd.concat([df, single_series], axis=1)
71-
72-
df.sort_index(inplace=True)
73-
74-
elif type(series_id) is dict:
75-
76-
df = pd.DataFrame()
77-
78-
for cod in series_id.keys():
79-
single_series = self._fetch_single_code(cod)
80-
df = pd.concat([df, single_series], axis=1)
81-
82-
df.columns = series_id.values()
83-
84-
else:
85-
86-
df = self._fetch_single_code(series_id)
87-
88-
return df
89-
90-
@staticmethod
91-
def _fetch_single_code(series_id):
92-
93-
url = r'https://fred.stlouisfed.org/data/' + series_id + '.txt'
94-
df = pd.read_csv(url, sep='\t')
95-
series_start = df[df[df.columns[0]].str.contains(r'DATE\s+VALUE')].index[0] + 1
96-
df = df.loc[series_start:]
97-
df = df[df.columns[0]].str.split(r'\s+', expand=True)
98-
df = df[~(df[1] == '.')]
99-
df = pd.DataFrame(data=df[1].values.astype(float),
100-
index=pd.to_datetime(df[0]),
101-
columns=[series_id])
102-
df.index.rename('Date', inplace=True)
103-
104-
return df

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@
2222
long_description=long_description,
2323
packages=find_packages(),
2424
install_requires=[
25+
'matplotlib',
26+
'numpy',
2527
'pandas',
2628
'scikit-learn',
27-
'numpy',
28-
'matplotlib',
2929
'tqdm',
3030
],
3131
keywords=[
3232
'asset pricing',
3333
'yield curve',
3434
'term premium',
3535
],
36-
)
36+
)

0 commit comments

Comments
 (0)