Skip to content

Commit

Permalink
minor test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
enzbus committed Nov 8, 2023
1 parent 9a5f2e6 commit fd47081
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cvxportfolio/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ def _universe_mask_at_time(self, t):
past_returns = self.returns.loc[self.returns.index < t]
valid_universe_mask = ((past_returns.count() >= self.min_history) &
(~self.returns.loc[t].isnull()))
if len(sum(valid_universe_mask)) <= 1:
if sum(valid_universe_mask) <= 1:
raise DataError(
f'The trading universe at time {t} has size less or equal'
+ ' than one, i.e., only the cash account. There are probably '
Expand Down
4 changes: 2 additions & 2 deletions cvxportfolio/tests/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,14 +443,14 @@ def test_user_provided_market_data(self):

without_prices = UserProvidedMarketData(
returns=used_returns, volumes=used_prices, cash_key='USDOLLAR',
base_location=self.datadir)
base_location=self.datadir, min_history=pd.Timedelta('0d'))
_, _, past_volumes, _, current_prices = \
without_prices.serve(t)
self.assertTrue(current_prices is None)

without_volumes = UserProvidedMarketData(
returns=used_returns, cash_key='USDOLLAR',
base_location=self.datadir)
base_location=self.datadir, min_history=pd.Timedelta('0d'))
_, _, past_volumes, current_volumes, \
current_prices = without_volumes.serve(t)

Expand Down
2 changes: 1 addition & 1 deletion docs/manual.rst
Original file line number Diff line number Diff line change
Expand Up @@ -213,5 +213,5 @@ Many Cvxportfolio internal variables, such as the weights and holdings vectors
that you can access in a :class:`cvxportfolio.BacktestResult` object, include
the cash account as their last element. In most cases used-provided data is not
concerned with the cash account (such as all examples above) and so it can be
ignored.
ignored. Exceptions are noted in the documentation of each object.

0 comments on commit fd47081

Please sign in to comment.