mirror of
https://github.com/wassname/catalyst.git
synced 2026-06-29 08:47:07 +08:00
Scrubbing known warnings
This commit is contained in:
committed by
Jonathan Kamens
parent
74306f5d2d
commit
f44c15bb38
@@ -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)
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user