Example #1
0
def cum_returns_final_1d_nb(returns: tp.Array1d,
                            start_value: float = 0.) -> float:
    """See `empyrical.cum_returns_final`."""
    out = generic_nb.product_1d_nb(returns + 1.)
    if start_value == 0.:
        return out - 1.
    return out * start_value
Example #2
0
def cum_returns_final_1d_nb(returns, start_value=0.):
    """See `empyrical.cum_returns_final`."""
    out = generic_nb.product_1d_nb(returns + 1.)
    if start_value == 0.:
        return out - 1.
    return out * start_value
Example #3
0
def total_return_apply_nb(idxs, col, returns):
    """Calculate total return from returns."""
    return generic_nb.product_1d_nb(returns + 1) - 1
Example #4
0
def total_return_apply_nb(idxs: tp.Array1d, col: int,
                          returns: tp.Array1d) -> float:
    """Calculate total return from returns."""
    return generic_nb.product_1d_nb(returns + 1) - 1