def _compute(self, arrays, dates, assets, mask): is_my_asset = (assets == self._asset.sid) out = repeat_first_axis(is_my_asset, len(mask)) # Raise an exception if `self._asset` does not exist for the entirety # of the timeframe over which we are computing. if (is_my_asset.sum() != 1) or ((out & mask).sum() != len(mask)): raise NonExistentAssetInTimeFrame( asset=self._asset, start_date=dates[0], end_date=dates[-1], ) return out
def _compute(self, windows, dates, assets, mask): asset = self._asset asset_column = searchsorted(assets.values, asset.sid) if assets[asset_column] != asset.sid: raise NonExistentAssetInTimeFrame( asset=asset, start_date=dates[0], end_date=dates[-1], ) # Return a 2D array with one column rather than a 1D array of the # column. return windows[0][:, [asset_column]]