ranaroussi / quantstats

Function with cyclomatic complexity higher than threshold PY-R1000
Anti-pattern
Minor
1 occurrence in this check
aggregate_returns has a cyclomatic complexity of 16 with "high" risk
121    return returns.groupby(groupby).sum()
122
123
124def aggregate_returns(returns, period=None, compounded=True):125    """Aggregates returns based on date periods"""
126    if period is None or "day" in period:
127        return returns