Skip to content

Commit 08f04af

Browse files
feat: plzz work
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent a26f3f0 commit 08f04af

1 file changed

Lines changed: 1 addition & 22 deletions

File tree

  • src/quant_research_starter

src/quant_research_starter/cli.py

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -178,28 +178,7 @@ def backtest(data_file, signals_file, initial_capital, output, plot, plotly):
178178
dict.fromkeys(prices.columns, signals), index=signals.index
179179
)
180180

181-
def run_with_progress(self, weight_scheme="rank"):
182-
returns = []
183-
idx = self.prices.index
184-
185-
for i in tqdm(range(1, len(idx)), desc="Running backtest"):
186-
ret = self._compute_daily_return(
187-
self.prices.iloc[i - 1],
188-
self.prices.iloc[i],
189-
weight_scheme,
190-
)
191-
returns.append(ret)
192-
193-
results = pd.DataFrame({"returns": returns}, index=idx[1:])
194-
results["portfolio_value"] = (
195-
self.initial_capital * (1 + results["returns"]).cumprod()
196-
)
197-
results["final_value"] = results["portfolio_value"].iloc[-1]
198-
results["total_return"] = results["final_value"] / self.initial_capital - 1
199-
200-
return results
201-
202-
VectorizedBacktest.run = run_with_progress
181+
# Use the original vectorized run() method for performance
203182

204183
backtest = VectorizedBacktest(
205184
prices=prices,

0 commit comments

Comments
 (0)