PnL for every data
-
Hello guys,
I was wondering what could be the best approach to track PnL (and maybe drawdown, that would be amazing) for every data in scenario where I backtest a set of datas (250) as a form of portfolio with ranking? I would love to evaluate which assets brought the most profit/DD, not only the overall portfolio return. I can imagine that instead of running a backtest for a set of data, I could split the logic to run 250 single backtest, but it's not the best approach. I was also thinking about appending a dict on every next() with some trade_notify, is there some more sophisticated way to approach thsi topic?
-
@mrkalindro Can't you just evaluate a list of completed trades?
-
@run-out You are right, I thought there may be some ready option for it, but just simple:
def __init__(self): self.coins_indicators[d]["pnl"] = 0 def notify_trade(self, trade): if trade.isclosed: self.coins_indicators[trade.data]["pnl"] += trade.pnl
Get's the job done, thank you!