Daily and Historical Returns

Returns are implemented in finquant.returns.

The module provides functions to compute different kinds of returns of stocks.

finquant.returns.cumulative_returns(data, dividend=0)

Returns DataFrame with cumulative returns

\(\displaystyle R = \dfrac{\text{price}_{t_i} - \text{price}_{t_0} + \text{dividend}}{\text{price}_{t_0}}\)

Input:
data:pandas.DataFrame with daily stock prices
dividend:float (default= 0), paid dividend
Output:
ret:a pandas.DataFrame of cumulative Returns of given stock prices.
finquant.returns.daily_log_returns(data)

Returns DataFrame with daily log returns

\(R_{\log} = \log\left(1 + \dfrac{\text{price}_{t_i} - \text{price}_{t_{i-1}}}{\text{price}_{t_{i-1}}}\right)\)

Input:
data:pandas.DataFrame with daily stock prices
Output:
ret:a pandas.DataFrame of log(1 + daily percentage change of Returns)
finquant.returns.daily_returns(data)

Returns DataFrame with daily returns (percentage change)

\(\displaystyle R = \dfrac{\text{price}_{t_i} - \text{price}_{t_{i-1}}}{\text{price}_{t_{i-1}}}\)

Input:
data:pandas.DataFrame with daily stock prices
Output:
ret:a pandas.DataFrame of daily percentage change of Returns of given stock prices.
finquant.returns.historical_mean_return(data, freq=252)

Returns the mean return based on historical stock price data.

Input:
data:pandas.DataFrame with daily stock prices
freq:int (default= 252), number of trading days, default value corresponds to trading days in a year
Output:
ret:a pandas.DataFrame of historical mean Returns.