-
Notifications
You must be signed in to change notification settings - Fork 5
feat: adds loading bar #33
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -3,7 +3,7 @@ | |||||
| from typing import Dict, Optional | ||||||
|
|
||||||
| import pandas as pd | ||||||
|
|
||||||
| from tqdm import tqdm | ||||||
|
|
||||||
| class VectorizedBacktest: | ||||||
| """ | ||||||
|
|
@@ -74,40 +74,54 @@ def run(self, weight_scheme: str = "rank") -> Dict: | |||||
|
|
||||||
| # Compute daily weights from signals (rebalance only on rebalance dates) | ||||||
| weights_list = [] | ||||||
| for date in returns_df.index: | ||||||
| if self._should_rebalance(date, prev_rebalance_date): | ||||||
| # Rebalance: compute new target weights | ||||||
| current_weights = self._calculate_weights( | ||||||
| aligned_signals.loc[date], weight_scheme | ||||||
| ) | ||||||
| prev_rebalance_date = date | ||||||
|
|
||||||
| # Append current weights (maintain between rebalances) | ||||||
| weights_list.append(current_weights) | ||||||
| with tqdm(len(returns_df.index),desc="Backtesting", unit="day") as pbar: | ||||||
|
||||||
| with tqdm(len(returns_df.index),desc="Backtesting", unit="day") as pbar: | |
| with tqdm(total=len(returns_df.index), desc="Backtesting", unit="day") as pbar: |
Copilot
AI
Nov 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect spacing in else : - there should be no space before the colon. Should be else: according to PEP 8.
| else : | |
| else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space after comma in function arguments. Should be
tqdm(total=len(returns_df.index), desc="Backtesting", unit="day")with a space after the comma followinglen(returns_df.index).