@multi_byte-wildebeest Hello.
How to get the Sharpe Ratio is in the Quick Start template.
https://github.com/quantiacs/strategy-q20-nasdaq100-quick-start/blob/master/strategy.ipynb
import qnt.stats as qnstats
def get_sharpe(market_data, weights):
rr = qnstats.calc_relative_return(market_data, weights)
sharpe = qnstats.calc_sharpe_ratio_annualized(rr).values[-1]
return sharpe
sharpe = get_sharpe(data, weights) # weights.sel(time=slice("2006-01-01",None))
or
import qnt.output as qnout
qnout.check(weights, data, "stocks_nasdaq100")
or
stat = qnstats.calc_stat(data, weights)
display(stat.to_pandas().tail())
or
import qnt.graph as qngraph
statistics = qnstats.calc_stat(data, weights)
display(statistics.to_pandas().tail())
performance = statistics.to_pandas()["equity"]
qngraph.make_plot_filled(performance.index, performance, name="PnL (Equity)", type="log")
display(statistics[-1:].sel(field=["sharpe_ratio"]).transpose().to_pandas())
qnstats.print_correlation(weights, data)
Please look at this post
https://quantiacs.com/community/topic/515/what-is-forward-looking-and-why-it-s-effective-badly-to-strategy/6?_=1711712434795