Hello,

This sample code from documentation doesnt work

class UpcomingSplitsExampleAlgorithm(QCAlgorithm):
    def initialize(self) -> None:
        self.set_start_date(2020, 1, 1)
        self.set_end_date(2024, 10, 1)
        self.set_cash(100000)

        # Trade on daily basis based on daily upcoming splits signals.
        self.universe_settings.resolution = Resolution.DAILY
        # Universe consists of equities with upcoming splits events.
        self._universe = self.add_universe(EODHDUpcomingSplits, self.selection)
    
    def selection(self, splits: List[EODHDUpcomingSplits]) -> List[Symbol]:
        # Split (more shares with lower price) will make the stock more affordable and drive up the demand.
        # Hence, include all stocks that will have a split within the next 7 days.
        # Note that spliting up the stock means the split factor > 1.
        return [x.symbol for x in splits if x.split_factor > 1]
    
    def on_data(self, slice: Slice) -> None:
        # Equally invest in each member of the universe to evenly dissipate the capital risk.
        total_count = len(self._universe.members)
        targets = [PortfolioTarget.percent(self, symbol, 1. / total_count) for symbol in self._universe.members.keys()]
        self.set_holdings(targets)

    def on_securities_changed(self, changes: SecurityChanges) -> None:
        for removed in changes.removed_securities:
            # Liquidate the ones exit the universe (already split) to capitalize the microeconomic demand.
            self.liquidate(removed.symbol)

Link to the docs
Upcoming Splits - QuantConnect.com

 

Error I get:

25|

6:59:18

:

Runtime Error: 'Dictionary[Symbol,Security]' object is not callable
  at on_data
    targets = [PortfolioTarget.percent(self, symbol, 1. / total_count) for symbol in self._universe.members.keys()]
                                                                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 in main.py: line 26 (Open Stack Trace)