Scrubbing known warnings

This commit is contained in:
Andrew Liang
2015-04-16 18:05:30 -04:00
committed by Jonathan Kamens
parent 74306f5d2d
commit f44c15bb38
2 changed files with 8 additions and 7 deletions
+6 -5
View File
@@ -194,7 +194,7 @@ class RiskMetricsCumulative(object):
# Create container for all minutes on first iteration
trading_minutes = minutes_for_day
else:
trading_minutes = trading_minutes + minutes_for_day
trading_minutes = trading_minutes.union(minutes_for_day)
return trading_minutes
def get_daily_index(self):
@@ -462,16 +462,17 @@ algorithm_returns ({algo_count}) in range {start} : {end} on {dt}"
http://en.wikipedia.org/wiki/Beta_(finance)
"""
# it doesn't make much sense to calculate beta for less than two days,
# so return none.
if len(self.annualized_mean_returns) < 2:
return 0.0
# Drop nans if there are gaps in the data
algorithm_returns = self.algorithm_returns.dropna()
benchmark_returns = \
self.benchmark_returns.loc[algorithm_returns.index]
# it doesn't make much sense to calculate beta for less than two days,
# so return none.
if len(algorithm_returns) < 2:
return 0.0
returns_matrix = np.vstack([algorithm_returns,
benchmark_returns])
C = np.cov(returns_matrix, ddof=1)
+2 -2
View File
@@ -535,7 +535,7 @@ class HistoryContainer(object):
Add new sids to the container.
"""
self.sids = pd.Index(
sorted(self.sids + _ensure_index(to_add)),
sorted(self.sids.union(_ensure_index(to_add))),
)
self._realign_sids()
@@ -544,7 +544,7 @@ class HistoryContainer(object):
Remove sids from the container.
"""
self.sids = pd.Index(
sorted(self.sids - _ensure_index(to_drop)),
sorted(self.sids.difference(_ensure_index(to_drop))),
)
self._realign_sids()