percent_return#
API documentation for pandas_ta.performance.percent_return Python function.
- percent_return(close, length=None, cumulative=None, offset=None, **kwargs)[source]#
Percent Return
Calculates the percent return of a Series. See also: help(df.ta.percent_return) for additional **kwargs a valid ‘df’.
- Sources:
https://stackoverflow.com/questions/31287552/logarithmic-returns-in-pandas-dataframe
- Calculation:
- Default Inputs:
length=1, cumulative=False
PCTRET = close.pct_change(length) CUMPCTRET = PCTRET.cumsum() if cumulative
- Args:
close (pd.Series): Series of ‘close’s length (int): It’s period. Default: 20 cumulative (bool): If True, returns the cumulative returns. Default: False offset (int): How many periods to offset the result. Default: 0
- Kwargs:
fillna (value, optional): pd.DataFrame.fillna(value) fill_method (value, optional): Type of fill method
- Returns:
pd.Series: New feature generated.