Skip to main content

get_returns

get_returns(
    close: pandas.core.series.Series,
) ‑> pandas.core.series.Series
Compute log returns from a pandas Series of closing prices. Log returns are calculated as the difference of the natural logarithm of consecutive prices. Parameters:
NameTypeDefaultDescription
closepd.Series--A pandas Series representing asset closing prices.
Returns:
TypeDescription
pd.SeriesA Series of log returns.

get_returns_nb

get_returns_nb(
    close: numpy.ndarray,
) ‑> numpy.ndarray
Compute log returns using a Numba-compiled function. This function calculates log returns by taking the difference of the natural logarithm of consecutive prices. Parameters:
NameTypeDefaultDescription
closetp.Array2d--A NumPy array representing asset closing prices.
Returns:
TypeDescription
tp.Array2dA NumPy array of log returns.

get_cumulative_returns

get_cumulative_returns(
    close: numpy.ndarray,
) ‑> numpy.ndarray
Compute cumulative log returns from a pandas Series of closing prices. Cumulative returns are obtained by computing the cumulative sum of log returns. Parameters:
NameTypeDefaultDescription
closepd.Series--A pandas Series representing asset closing prices.
Returns:
TypeDescription
pd.SeriesA Series of cumulative log returns.

get_cumulative_returns_nb

get_cumulative_returns_nb(
    close: numpy.ndarray,
) ‑> numpy.ndarray
Compute cumulative log returns using a Numba-compiled function. This function calculates cumulative returns by computing the cumulative sum of log returns. Parameters:
NameTypeDefaultDescription
closetp.Array2d--A 2-D NumPy array representing asset closing prices.
Returns:
TypeDescription
tp.Array2dA NumPy array of cumulative log returns.