Hi All,

I am trying to run some debugging using VSCode, I have tried reinstalling leanCLI, pylance etc but can not get passed this hurdle. From my understanding it is not importing correctly the subclass QCAlgorithm correctly. This is across all projects and not not isolated. Please see the screenshot attached, any help on solving this would be great. Just to test and make sure it was not my own code being the issue for the example below I am using one of the templates provided and still having issues.

Thanks

192034_1696508866.jpg
# region imports
from QuantConnect.Algorithm import QCAlgorithm
from AlgorithmImports import *
import pdb
pdb.set_trace()
from alpha import VIXAlphaModel
# endregion

class VIXPredictsStockIndexReturns(QCAlgorithm):

    undesired_symbols_from_previous_deployment = []
    checked_symbols_from_previous_deployment = False
    previous_direction_by_symbol = {}
    week = -1

    def Initialize(self):
        self.SetStartDate(2022, 7, 1)
        self.SetEndDate(2023, 7, 1)
        self.SetCash(1_000_000)

        self.SetBrokerageModel(BrokerageName.InteractiveBrokersBrokerage, AccountType.Margin)

        self.Settings.MinimumOrderMarginPortfolioPercentage = 0
        self.UniverseSettings.DataNormalizationMode = DataNormalizationMode.Raw
        self.AddUniverseSelection(ManualUniverseSelectionModel([Symbol.Create("OEF", SecurityType.Equity, Market.USA)]))

        lookback_days = self.GetParameter("lookback_days", 504)
        self.AddAlpha(VIXAlphaModel(
            self, 
            lookback_days,
            self.GetParameter("long_percentile", 90),
            self.GetParameter("short_percentile", 10)
        ))

        self.Settings.RebalancePortfolioOnInsightChanges = False
        self.Settings.RebalancePortfolioOnSecurityChanges = False
        self.SetPortfolioConstruction(EqualWeightingPortfolioConstructionModel(self.rebalance_func))

        self.AddRiskManagement(NullRiskManagementModel())
        
        self.SetExecution(ImmediateExecutionModel())
        
        self.SetWarmUp(timedelta(lookback_days*2))


    def rebalance_func(self, time):
        # Rebalance when all of the following are true:
        #  - Not warming up
        #  - There is QuoteBar data in the current slice
        #  - It's a new week or the insight direction has changed
        direction_by_symbol = {insight.Symbol: insight.Direction for insight in self.Insights}
        if not self.IsWarmingUp and self.CurrentSlice.QuoteBars.Count > 0 \
            and (direction_by_symbol != self.previous_direction_by_symbol or self.Time.date().isocalendar()[1] != self.week):
            self.week = self.Time.date().isocalendar()[1]
            self.previous_direction_by_symbol = direction_by_symbol
            return time
        return None
        

    def OnData(self, data):
        # Exit positions that aren't backed by existing insights.
        # If you don't want this behavior, delete this method definition.
        if not self.IsWarmingUp and not self.checked_symbols_from_previous_deployment:
            for security_holding in self.Portfolio.Values:
                if not security_holding.Invested:
                    continue
                symbol = security_holding.Symbol
                if not self.Insights.HasActiveInsights(symbol, self.UtcTime):
                    self.undesired_symbols_from_previous_deployment.append(symbol)
            self.checked_symbols_from_previous_deployment = True
        
        for symbol in self.undesired_symbols_from_previous_deployment[:]:
            if self.IsMarketOpen(symbol):
                self.Liquidate(symbol, tag="Holding from previous deployment that's no longer desired")
                self.undesired_symbols_from_previous_deployment.remove(symbol)