= _utils.download_returns('SPY', '5y')
values snapshot(values)
Plotting Function
User functions for plotting data
to_plotly
to_plotly (fig)
snapshot
snapshot (returns, grayscale=False, figsize=(10, 8), title='Portfolio Summary', fontname='Arial', lw=1.5, mode='comp', subtitle=True, savefig=None, show=True, log_scale=False)
earnings
earnings (returns, start_balance=100000.0, mode='comp', grayscale=False, figsize=(10, 6), title='Portfolio Earnings', fontname='Arial', lw=1.5, subtitle=True, savefig=None, show=True)
= _utils.download_returns('SPY', '5y')
values earnings(values)
returns
returns (returns, benchmark=None, grayscale=False, figsize=(10, 6), returns_label='Strategy', benchmark_label='Benchmark', fontname='Arial', lw=1.5, match_volatility=False, compound=True, cumulative=True, resample=None, ylabel='Cumulative Returns', subtitle=True, savefig=None, show=True, prepare_returns=False)
= _utils.download_returns('SPY', '5y')
values = _utils.download_returns('QQQ', '5y')
benchmark ="SPY", benchmark_label="QQQ") returns(values, benchmark, returns_label
daily_returns
daily_returns (returns, grayscale=False, figsize=(10, 4), fontname='Arial', lw=0.5, log_scale=False, ylabel='Returns', subtitle=True, savefig=None, show=True, prepare_returns=True)
log_returns
log_returns (returns, benchmark=None, grayscale=False, figsize=(10, 5), returns_label='Strategy', benchmark_label='Benchmark', fontname='Arial', lw=1.5, match_volatility=False, compound=True, cumulative=True, resample=None, ylabel='Cumulative Returns', subtitle=True, savefig=None, show=True, prepare_returns=False)
= _utils.download_returns('SPY', '5y')
values = _utils.download_returns('QQQ', '5y')
benchmark ="SPY", benchmark_label="QQQ") log_returns(values, benchmark, returns_label
yearly_returns
yearly_returns (returns, benchmark=None, returns_label='Strategy', benchmark_label='Benchmark', fontname='Arial', grayscale=False, hlw=1.5, hlcolor='red', hllabel='', match_volatility=False, log_scale=False, figsize=(10, 5), ylabel=True, subtitle=True, compounded=True, savefig=None, show=True, prepare_returns=True)
= _utils.download_returns('SPY', '5y')
values = _utils.download_returns('QQQ', '5y')
benchmark ="SPY", benchmark_label="QQQ") yearly_returns(values, benchmark, returns_label
distribution
distribution (returns, fontname='Arial', grayscale=False, ylabel=True, figsize=(10, 6), subtitle=True, compounded=True, savefig=None, show=True, prepare_returns=True)
= _utils.download_returns('SPY', '5y')
values distribution(values)
histogram
histogram (returns, resample='M', fontname='Arial', grayscale=False, figsize=(10, 5), ylabel=True, subtitle=True, compounded=True, savefig=None, show=True, prepare_returns=True)
= _utils.download_returns('SPY', '5y')
values histogram(values)
drawdown
drawdown (returns, grayscale=False, figsize=(10, 3), fontname='Arial', lw=1, log_scale=False, match_volatility=False, compound=False, ylabel='Drawdown', resample=None, subtitle=True, savefig=None, show=True)
= _utils.download_returns('SPY', '5y')
values drawdown(values)
drawdowns_periods
drawdowns_periods (returns, periods=5, lw=1.5, log_scale=False, fontname='Arial', grayscale=False, figsize=(10, 5), ylabel=True, subtitle=True, compounded=True, savefig=None, show=True, prepare_returns=True)
= _utils.download_returns('SPY', '5y')
values drawdowns_periods(values)
rolling_beta
rolling_beta (returns, benchmark, benchmark_label='Benchmark', window1=126, window1_label='6-Months', window2=252, window2_label='12-Months', lw=1.5, fontname='Arial', grayscale=False, figsize=(10, 3), ylabel=True, subtitle=True, savefig=None, show=True, prepare_returns=True)
= _utils.download_returns('SPY', '5y')
values = _utils.download_returns('QQQ', '5y')
benchmark rolling_beta(values, benchmark)
rolling_volatility
rolling_volatility (returns, benchmark=None, returns_label='Strategy', benchmark_label='Benchmark', period=126, period_label='6-Months', periods_per_year=252, lw=1.5, fontname='Arial', grayscale=False, figsize=(10, 3), ylabel='Volatility', subtitle=True, savefig=None, show=True)
= _utils.download_returns('SPY', '5y')
values = _utils.download_returns('QQQ', '5y')
benchmark rolling_volatility(values, benchmark)
rolling_sharpe
rolling_sharpe (returns, benchmark=None, rf=0.0, returns_label='Strategy', benchmark_label='Benchmark', period=126, period_label='6-Months', periods_per_year=252, lw=1.25, fontname='Arial', grayscale=False, figsize=(10, 3), ylabel='Sharpe', subtitle=True, savefig=None, show=True)
= _utils.download_returns('SPY', '5y')
values = _utils.download_returns('QQQ', '5y')
benchmark rolling_sharpe(values, benchmark)
rolling_sortino
rolling_sortino (returns, benchmark=None, rf=0.0, returns_label='Strategy', benchmark_label='Benchmark', period=126, period_label='6-Months', periods_per_year=252, lw=1.25, fontname='Arial', grayscale=False, figsize=(10, 3), ylabel='Sortino', subtitle=True, savefig=None, show=True)
= _utils.download_returns('SPY', '5y')
values = _utils.download_returns('QQQ', '5y')
benchmark rolling_sortino(values, benchmark)
monthly_heatmap
monthly_heatmap (returns, annot_size=10, figsize=(10, 5), cbar=True, square=False, compounded=True, eoy=False, grayscale=False, fontname='Arial', ylabel=True, savefig=None, show=True)
= _utils.download_returns('SPY', '5y')
values =True) monthly_heatmap(values, eoy
outperformance_heatmap
outperformance_heatmap (returns, benchmark=None, annot_size=10, figsize=(10, 5), cbar=True, square=False, benchmark_label='Benchmark', compounded=True, eoy=False, grayscale=False, fontname='Arial', ylabel=True, savefig=None, show=True)
= _utils.download_returns('SPY', '5y')
values = _utils.download_returns('QQQ', '5y')
benchmark outperformance_heatmap(values, benchmark)
monthly_returns
monthly_returns (returns, annot_size=10, figsize=(10, 5), cbar=True, square=False, compounded=True, eoy=False, grayscale=False, fontname='Arial', ylabel=True, savefig=None, show=True)
A wrapper for monthly heatmaps