Hi Community,

I am wondering if any of you have tried to implement custom evaluation metric such as sortino ratio or adjusted sortino ratio using backtesting data.

My original idea is to calculate the metric either in OnEndOfAlgorithm() method or in a separate research notebook. Nevertheless for either way I would need the daily portfolio return or portfolio return in other datetime resolution. After investigating into Lean API and several community posts, such as

Calculate Running Statistics & Make Accessible In Algorithm · Issue #1105 · QuantConnect/Lean

How to calculate sharpe ratio in python? by Yd124

Sharpe Ratio - QuantConnect.com

Lean: QuantConnect.Algorithm.QCAlgorithm Class Reference

Lean: QuantConnect.Securities.SecurityPortfolioManager Class Reference

I failed to find a proper way/an official API to extract daily performance of the entire portfolio from QC. However I found a hacky way to retrieve such information from QC Backtesting chart, which on the other hand is sometimes not reliable in terms of different backtesting condition. Thus if any QCer had successfully retrieved such information using solid API or had experience with calculating Sortino Ratio in QC, please let me know. Thanks a lot!

 

Best Regards,