Skip to content

Commit efd3018

Browse files
committed
Removing TODOs, reading data from the web, updating code to remove warnings
1 parent 9840beb commit efd3018

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

example_br.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88

99
# Read and plot data
1010
yield_curve = pd.read_csv(
11-
"sample_data/di monthly maturities.csv", # TODO change to read from web
11+
"https://raw.githubusercontent.com/gusamarante/pyacm/refs/heads/main/sample_data/di%20monthly%20maturities.csv",
1212
index_col=0,
1313
)
1414
yield_curve = yield_curve.iloc[:, :121] # maturities up to 10y
1515
yield_curve = yield_curve.dropna()
1616
yield_curve.index = pd.to_datetime(yield_curve.index)
17-
yield_curve = yield_curve[yield_curve.index >= "2007-03-01"] # TODO deal with this missing data
17+
yield_curve = yield_curve[yield_curve.index >= "2007-03-01"]
1818

1919

2020
# Plot the Series of selcted maturities

example_us.py

Whitespace-only changes.

pit_estimates.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
yield_curve = yield_curve.iloc[:, :121] # maturities up to 10y
2020
yield_curve = yield_curve.dropna()
2121
yield_curve.index = pd.to_datetime(yield_curve.index)
22-
yield_curve = yield_curve[yield_curve.index >= "2007-03-01"] # TODO deal with this missing data
22+
yield_curve = yield_curve[yield_curve.index >= "2007-03-01"]
2323

2424
tp = pd.DataFrame(columns=yield_curve.columns)
2525
er = pd.DataFrame(columns=yield_curve.columns)

pyacm/acm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def __init__(self, curve, n_factors=5):
130130

131131
self.n_factors = n_factors
132132
self.curve = curve
133-
self.curve_monthly = curve.resample('M').mean()
133+
self.curve_monthly = curve.resample('ME').mean()
134134
self.t = self.curve_monthly.shape[0] - 1
135135
self.n = self.curve_monthly.shape[1]
136136
self.rx_m, self.rf_m = self._get_excess_returns()

pyacm/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ def _fetch_single_code(series_id):
9292

9393
url = r'https://fred.stlouisfed.org/data/' + series_id + '.txt'
9494
df = pd.read_csv(url, sep='\t')
95-
series_start = df[df[df.columns[0]].str.contains('DATE\s+VALUE')].index[0] + 1
95+
series_start = df[df[df.columns[0]].str.contains(r'DATE\s+VALUE')].index[0] + 1
9696
df = df.loc[series_start:]
97-
df = df[df.columns[0]].str.split('\s+', expand=True)
97+
df = df[df.columns[0]].str.split(r'\s+', expand=True)
9898
df = df[~(df[1] == '.')]
9999
df = pd.DataFrame(data=df[1].values.astype(float),
100100
index=pd.to_datetime(df[0]),

0 commit comments

Comments
 (0)