My question is : how can I backtest my stretagey comparing to a benchmark in Python? And most importantly, how can I get access to the information ratio from backtesting in Python?
Using R notebook, I can do
“backtest(port, bench=‘ES’)”
to get the full analysis comparing to a benchmark. Most importantly, I can get the information ratio, which corresponds to 50% of the points!
However, the backtest function in Python does not support the input of “bench”. We can do
“port.backtest()”,
but cannot do
“port.backtest(bench=‘ES’)”.
I have checked the source code of function “portfolio” in Qlib, and I found the backtest() function , but unfortunately, I coundn’t found anything about backtesting with a benchmark. Also the backtest function does not return the P&L data to the users, which makes the calculation of information ratio impossible.
I am hoping to find a way to either get the information ratio w.r.t a benchmark directly from a backtest or get the P&L data from a backtest, so that I can compute the information ratio myself.
Thanks,