qis.plot_prices¶
- qis.plot_prices(prices, perf_stats_labels=(PerfStat.P.a. return, PerfStat.Vol, PerfStat.Sharpe (rf=0)), perf_params=None, regime_benchmark=None, pivot_prices=None, regime_classifier=<qis.perfstats.regime_classifier.BenchmarkReturnsQuantilesRegime object>, var_format='{:, .1f}', digits_to_show=1, sharpe_format='{:.2f}', x_date_freq='YE', trend_line=TrendLine.NONE, is_log=False, resample_freq=None, start_to_one=True, end_to_one=False, title=None, ax=None, **kwargs)[source]¶
plot price or NAV series with performance statistics in the legend.
The legend is the point of this plot: each series is labelled with the statistics in
perf_stats_labelscomputed over the plotted window, so the chart and the numbers cannot disagree. Series are rebased so that levels are comparable across instruments.Arguments shared with every
plot_*function —ax,title,var_format,x_date_freq,fontsize,colorsand the rest — are documented inqis/docs/plotting_kwargs.md.- Parameters:
prices (DataFrame | Series) – price or NAV levels indexed by date, one column per instrument. A Series is promoted to a one-column frame
perf_stats_labels (List[PerfStat] | None) – statistics to append to each legend entry, computed on the plotted window. None labels with the column name alone
perf_params (PerfParams) – annualisation, frequency and rate conventions for those statistics. None uses the defaults of
PerfParamsregime_benchmark (str) – column name whose returns classify the regime shading. None draws no shading
pivot_prices (Series) – benchmark levels for the regime classification when the benchmark is not one of the plotted columns
regime_classifier (BenchmarkReturnsQuantilesRegime) – how the benchmark return is mapped to a regime
var_format (str) – format for the price levels in the legend
digits_to_show (int) – significant digits for the performance statistics
sharpe_format (str) – format for Sharpe ratios, which conventionally carry more digits than the other statistics
x_date_freq (str) – tick frequency on the date axis
trend_line (TrendLine) – trend line drawn through each series
is_log (bool) – plot the vertical axis on a log scale, so that equal vertical distances are equal relative moves
resample_freq (str) – resample the prices before plotting, forward-filling. None plots at the input frequency
start_to_one (bool) – rebase every series to 1.0 at its first observation
end_to_one (bool) – rebase every series to 1.0 at its last observation instead, which compares the paths that led to the same endpoint. Takes precedence over
start_to_onetitle (str) – axis title
ax (Axes) – axis to draw on; None creates a figure
- Returns:
the figure drawn on, whether or not
axwas supplied- Return type: