Open andreas-vester opened 8 months ago
Not a bug, you cannot expect the max drawdown of a grouped portfolio (where equities are added together) be the same as the average max drawdown of individual portfolios. If one equity has a max drawdown of 10% and another one has also a 10% max drawdown, and both drawdowns do not overlap in time, then the max drawdown of the combined portfolio would be 5% and not 10%.
Ok, fair point. I probably misunderstood the concept of the input argument group_by
in Portfolio
.
Are the following statements correct?
pf.stats(agg_func=None, group_by=["equity", "equity", "comdty"])
pf.stats(agg_func=None, group_by=["equity", "equity", "comdty"], cash_sharing=True)
pf.stats(agg_func=None).groupby(group_by, sort=False).mean()
@polakowo Short feedback would highly be appreciated. Thanks a lot!
If I
group_by
using thePortfolio.stats()
method, there might be a bug.Consider the following example:
I am focussing on max. drawdowns. If I compute the average max. drawdown based on
pf.drawdown().min()
for the equitygroup_by
, i.e. avg(SPY,QQQ), I get the same result as compared to callingpf.stats(agg_func=None).groupby(group_by, sort=False).mean().T
.There's a different max. drawdown when calling
pf.stats(agg_func=None, group_by=group_by).T
.Am I missing something? For instance, total return is the same for both calls. Is this a bug?