示例#1
0
    def capture(self, factor_returns):
        """Capture ratio.

        Args:
            factor_returns (array_like): Benchmark return to compare returns against. Will broadcast."""
        factor_returns = reshape_fns.broadcast_to(
            reshape_fns.to_2d(factor_returns, raw=True),
            reshape_fns.to_2d(self._obj, raw=True))
        return self.wrap_reduced(nb.capture_nb(self.to_2d_array(), factor_returns, self.ann_factor))
示例#2
0
    def capture(self, benchmark_rets, wrap_kwargs=None):
        """Capture ratio.

        Args:
            benchmark_rets (array_like): Benchmark return to compare returns against. Will broadcast."""
        benchmark_rets = reshape_fns.broadcast_to(
            reshape_fns.to_2d(benchmark_rets, raw=True),
            reshape_fns.to_2d(self._obj, raw=True))
        wrap_kwargs = merge_dicts(dict(name_or_index='capture'), wrap_kwargs)
        return self.wrapper.wrap_reduced(nb.capture_nb(
            self.to_2d_array(), benchmark_rets, self.ann_factor
        ), **wrap_kwargs)
示例#3
0
    def capture(self,
                benchmark_rets: tp.ArrayLike,
                wrap_kwargs: tp.KwargsLike = None) -> tp.MaybeSeries:
        """Capture ratio.

        Args:
            benchmark_rets (array_like): Benchmark return to compare returns against. Will broadcast."""
        benchmark_rets = broadcast_to(to_2d(benchmark_rets, raw=True),
                                      to_2d(self._obj, raw=True))
        result = nb.capture_nb(self.to_2d_array(), benchmark_rets,
                               self.ann_factor)
        wrap_kwargs = merge_dicts(dict(name_or_index='capture'), wrap_kwargs)
        return self.wrapper.wrap_reduced(result, **wrap_kwargs)