Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alphalens #392

Open
Swordsman-T opened this issue Jan 28, 2021 · 0 comments
Open

Alphalens #392

Swordsman-T opened this issue Jan 28, 2021 · 0 comments

Comments

@Swordsman-T
Copy link

Problem Description

UnboundLocalError: local variable 'period_len' referenced before assignment, line 319

days_diffs = []
        for i in range(30):
            if i >= len(forward_returns.index):
                break
            p_idx = prices.index.get_loc(forward_returns.index[i])
            if p_idx is None or p_idx < 0 or (
                    p_idx + period) >= len(prices.index):
                continue
            start = prices.index[p_idx]
            end = prices.index[p_idx + period]
            period_len = diff_custom_calendar_timedeltas(start, end, freq)
            days_diffs.append(period_len.components.days)

        delta_days = period_len.components.days - mode(days_diffs).mode[0]
        period_len -= pd.Timedelta(days=delta_days)
        label = timedelta_to_string(period_len)

Please provide the full traceback:

[Paste traceback here]

Please provide any additional information below:

Versions

  • Alphalens version:
  • Python version: 3.7
  • Pandas version:
  • Matplotlib version:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant