Skip to content

Commit

Permalink
DOC: consistent docstring for factor_returns
Browse files Browse the repository at this point in the history
  • Loading branch information
eigenfoo committed Jun 11, 2018
1 parent b8a0557 commit 1fac58d
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 23 deletions.
16 changes: 11 additions & 5 deletions pyfolio/plotting.py
Expand Up @@ -501,7 +501,8 @@ def plot_perf_stats(returns, factor_returns, ax=None):
Daily returns of the strategy, noncumulative.
- See full explanation in tears.create_full_tear_sheet.
factor_returns : pd.Series
Daily noncumulative returns of the benchmark.
Daily noncumulative returns of the benchmark factor to which betas are
computed. Usually a benchmark such as market returns.
- This is in the same style as returns.
ax : matplotlib.Axes, optional
Axes upon which to plot.
Expand Down Expand Up @@ -554,7 +555,8 @@ def show_perf_stats(returns, factor_returns=None, positions=None,
Daily returns of the strategy, noncumulative.
- See full explanation in tears.create_full_tear_sheet.
factor_returns : pd.Series, optional
Daily noncumulative returns of the benchmark.
Daily noncumulative returns of the benchmark factor to which betas are
computed. Usually a benchmark such as market returns.
- This is in the same style as returns.
positions : pd.DataFrame, optional
Daily net position values.
Expand Down Expand Up @@ -731,7 +733,8 @@ def plot_rolling_returns(returns,
Daily returns of the strategy, noncumulative.
- See full explanation in tears.create_full_tear_sheet.
factor_returns : pd.Series, optional
Daily noncumulative returns of a risk factor.
Daily noncumulative returns of the benchmark factor to which betas are
computed. Usually a benchmark such as market returns.
- This is in the same style as returns.
live_start_date : datetime, optional
The date when the strategy began live trading, after
Expand Down Expand Up @@ -844,7 +847,8 @@ def plot_rolling_beta(returns, factor_returns, legend_loc='best',
Daily returns of the strategy, noncumulative.
- See full explanation in tears.create_full_tear_sheet.
factor_returns : pd.Series
Daily noncumulative returns of the benchmark.
Daily noncumulative returns of the benchmark factor to which betas are
computed. Usually a benchmark such as market returns.
- This is in the same style as returns.
legend_loc : matplotlib.loc, optional
The location of the legend on the plot.
Expand Down Expand Up @@ -896,7 +900,9 @@ def plot_rolling_volatility(returns, factor_returns=None,
Daily returns of the strategy, noncumulative.
- See full explanation in tears.create_full_tear_sheet.
factor_returns : pd.Series, optional
Daily noncumulative returns of the benchmark.
Daily noncumulative returns of the benchmark factor to which betas are
computed. Usually a benchmark such as market returns.
- This is in the same style as returns.
rolling_window : int, optional
The days window over which to compute the volatility.
legend_loc : matplotlib.loc, optional
Expand Down
43 changes: 25 additions & 18 deletions pyfolio/timeseries.py
Expand Up @@ -301,8 +301,8 @@ def alpha_beta(returns, factor_returns):
Daily returns of the strategy, noncumulative.
- See full explanation in :func:`~pyfolio.timeseries.cum_returns`.
factor_returns : pd.Series
Daily noncumulative returns of the factor to which beta is
computed. Usually a benchmark such as the market.
Daily noncumulative returns of the benchmark factor to which betas are
computed. Usually a benchmark such as market returns.
- This is in the same style as returns.
Returns
Expand All @@ -327,8 +327,8 @@ def alpha(returns, factor_returns):
Daily returns of the strategy, noncumulative.
- See full explanation in :func:`~pyfolio.timeseries.cum_returns`.
factor_returns : pd.Series
Daily noncumulative returns of the factor to which beta is
computed. Usually a benchmark such as the market.
Daily noncumulative returns of the benchmark factor to which betas are
computed. Usually a benchmark such as market returns.
- This is in the same style as returns.
Returns
Expand All @@ -351,8 +351,8 @@ def beta(returns, factor_returns):
Daily returns of the strategy, noncumulative.
- See full explanation in :func:`~pyfolio.timeseries.cum_returns`.
factor_returns : pd.Series
Daily noncumulative returns of the factor to which beta is
computed. Usually a benchmark such as the market.
Daily noncumulative returns of the benchmark factor to which betas are
computed. Usually a benchmark such as market returns.
- This is in the same style as returns.
Returns
Expand Down Expand Up @@ -515,9 +515,10 @@ def rolling_beta(returns, factor_returns,
Daily returns of the strategy, noncumulative.
- See full explanation in tears.create_full_tear_sheet.
factor_returns : pd.Series or pd.DataFrame
Daily noncumulative returns of the benchmark.
Daily noncumulative returns of the benchmark factor to which betas are
computed. Usually a benchmark such as market returns.
- If DataFrame is passed, computes rolling beta for each column.
- This is in the same style as returns.
If DataFrame is passed, computes rolling beta for each column.
rolling_window : int, optional
The size of the rolling window, in days, over which to compute
beta (default 6 months).
Expand Down Expand Up @@ -561,7 +562,10 @@ def rolling_regression(returns, factor_returns,
Daily returns of the strategy, noncumulative.
- See full explanation in tears.create_full_tear_sheet.
factor_returns : pd.DataFrame
Data set containing the risk factors.
Daily noncumulative returns of the benchmark factor to which betas are
computed. Usually a benchmark such as market returns.
- Computes rolling beta for each column.
- This is in the same style as returns.
rolling_window : int, optional
The days window over which to compute the beta. Defaults to 6 months.
nan_threshold : float, optional
Expand Down Expand Up @@ -696,10 +700,11 @@ def perf_stats(returns, factor_returns=None, positions=None,
returns : pd.Series
Daily returns of the strategy, noncumulative.
- See full explanation in tears.create_full_tear_sheet.
factor_returns : pd.Series (optional)
Daily noncumulative returns of the benchmark.
factor_returns : pd.Series, optional
Daily noncumulative returns of the benchmark factor to which betas are
computed. Usually a benchmark such as market returns.
- This is in the same style as returns.
If None, do not compute alpha, beta, and information ratio.
- If None, do not compute alpha, beta, and information ratio.
positions : pd.DataFrame
Daily net position values.
- See full explanation in tears.create_full_tear_sheet.
Expand Down Expand Up @@ -743,10 +748,11 @@ def perf_stats_bootstrap(returns, factor_returns=None, return_stats=True,
returns : pd.Series
Daily returns of the strategy, noncumulative.
- See full explanation in tears.create_full_tear_sheet.
factor_returns : pd.Series (optional)
Daily noncumulative returns of the benchmark.
factor_returns : pd.Series, optional
Daily noncumulative returns of the benchmark factor to which betas are
computed. Usually a benchmark such as market returns.
- This is in the same style as returns.
If None, do not compute alpha, beta, and information ratio.
- If None, do not compute alpha, beta, and information ratio.
return_stats : boolean (optional)
If True, returns a DataFrame of mean, median, 5 and 95 percentiles
for each perf metric.
Expand Down Expand Up @@ -801,10 +807,11 @@ def calc_bootstrap(func, returns, *args, **kwargs):
returns : pd.Series
Daily returns of the strategy, noncumulative.
- See full explanation in tears.create_full_tear_sheet.
factor_returns : pd.Series (optional)
Daily noncumulative returns of the benchmark.
factor_returns : pd.Series, optional
Daily noncumulative returns of the benchmark factor to which betas are
computed. Usually a benchmark such as market returns.
- This is in the same style as returns.
n_samples : int (optional)
n_samples : int, optional
Number of bootstrap samples to draw. Default is 1000.
Increasing this will lead to more stable / accurate estimates.
Expand Down

0 comments on commit 1fac58d

Please sign in to comment.