How can we have the estimation of Sharpe submitted ?
-
Hi, how can we know the IS Sharpe will be when develop my strategy ?
For example, the backtest_ml prints Sharpe at the end, but as I know, it is the Sharpe of the last day of trading.
Many strategies developed locally have Sharpe > 1.0 but when submitted are filtered by IS Sharpe.
-
@multi_byte-wildebeest Dear multi_byte-wildebeest,
The sharpe ratio is calculated for a specific period, so the sharpe ratio that you see in the end is one for period of when you started your calculation up until when you stopped it. To get some estimation for STOCKS_NASDAQ100 competition type that has in-sample start date set to 1.1.2006., you should set parameters in your strategy that you backtest to also start from that same date. If it happens that sharpe ratio is significantly lower after submission for the same period, that means that you could have forward looking somewhere in your strategy (you look for data in the future to calculate weights for those days).
Regards
-
@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.ipynbimport 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