diff --git a/Algorithm.Python/AllShortableSymbolsCoarseSelectionRegressionAlgorithm.py b/Algorithm.Python/AllShortableSymbolsCoarseSelectionRegressionAlgorithm.py index f192dcd4d7e1..77ea35a6fd52 100644 --- a/Algorithm.Python/AllShortableSymbolsCoarseSelectionRegressionAlgorithm.py +++ b/Algorithm.Python/AllShortableSymbolsCoarseSelectionRegressionAlgorithm.py @@ -109,7 +109,7 @@ def __init__(self): Gets a list of all shortable Symbols, including the quantity shortable as a Dictionary. """ def all_shortable_symbols(self, localtime): - shortable_data_directory = os.path.join(Globals.DataFolder, "equity", Market.USA, "shortable", self.brokerage) + shortable_data_directory = os.path.join(Globals.data_folder, "equity", Market.USA, "shortable", self.brokerage) all_symbols = {} """ diff --git a/Algorithm.Python/BasicTemplateOptionStrategyAlgorithm.py b/Algorithm.Python/BasicTemplateOptionStrategyAlgorithm.py index 03481de50517..f4414a3f0f9e 100644 --- a/Algorithm.Python/BasicTemplateOptionStrategyAlgorithm.py +++ b/Algorithm.Python/BasicTemplateOptionStrategyAlgorithm.py @@ -55,7 +55,7 @@ def on_data(self,slice): if len(contracts) == 0: continue atm_straddle = contracts[0] if atm_straddle != None: - self.sell(OptionStrategies.STRADDLE(self.option_symbol, atm_straddle.strike, atm_straddle.expiry), 2) + self.sell(OptionStrategies.straddle(self.option_symbol, atm_straddle.strike, atm_straddle.expiry), 2) else: self.liquidate() diff --git a/Algorithm.Python/CapmAlphaRankingFrameworkAlgorithm.py b/Algorithm.Python/CapmAlphaRankingFrameworkAlgorithm.py index 9ffd18abc8ac..0b0d043debc9 100644 --- a/Algorithm.Python/CapmAlphaRankingFrameworkAlgorithm.py +++ b/Algorithm.Python/CapmAlphaRankingFrameworkAlgorithm.py @@ -44,7 +44,7 @@ class CapmAlphaRankingUniverseSelectionModel(UniverseSelectionModel): benchmark = "SPY" # Symbols of Dow 30 companies. - symbols = [Symbol.create(x, SecurityType.EQUITY, Market.USA) + _symbols = [Symbol.create(x, SecurityType.EQUITY, Market.USA) for x in ["AAPL", "AXP", "BA", "CAT", "CSCO", "CVX", "DD", "DIS", "GE", "GS", "HD", "IBM", "INTC", "JPM", "KO", "MCD", "MMM", "MRK", "MSFT", "NKE","PFE", "PG", "TRV", "UNH", "UTX", "V", "VZ", "WMT", "XOM"]] @@ -60,8 +60,7 @@ def create_universes(self, algorithm): algorithm.date_rules.month_start(self.benchmark), algorithm.time_rules.after_market_open(self.benchmark), lambda datetime: self.select_pair(algorithm, datetime), - algorithm.universe_settings, - algorithm.security_initializer)] + algorithm.universe_settings)] def select_pair(self, algorithm, date): '''Selects the pair (two stocks) with the highest alpha''' @@ -95,7 +94,7 @@ def roc_updated(s, item): rate_of_change.updated += roc_updated - history = history.close.reset_index(level=0, drop=True).iteritems() + history = history.close.reset_index(level=0, drop=True).items() for time, value in history: rate_of_change.update(time, value) diff --git a/Algorithm.Python/CustomDataUniverseRegressionAlgorithm.py b/Algorithm.Python/CustomDataUniverseRegressionAlgorithm.py index 3983cc8e03f5..c76fb5bf487b 100644 --- a/Algorithm.Python/CustomDataUniverseRegressionAlgorithm.py +++ b/Algorithm.Python/CustomDataUniverseRegressionAlgorithm.py @@ -81,7 +81,7 @@ def OnSecuritiesChanged(self, changes): class MyPyCustomData(PythonData): def get_source(self, config, date, is_live_mode): - source = f"{Globals.DataFolder}/equity/usa/daily/{LeanData.generate_zip_file_name(config.symbol, date, config.resolution, config.tick_type)}" + source = f"{Globals.data_folder}/equity/usa/daily/{LeanData.generate_zip_file_name(config.symbol, date, config.resolution, config.tick_type)}" return SubscriptionDataSource(source) def reader(self, config, line, date, is_live_mode): diff --git a/Algorithm.Python/CustomDataUniverseScheduledRegressionAlgorithm.py b/Algorithm.Python/CustomDataUniverseScheduledRegressionAlgorithm.py index 12a7e5430916..d966317a7c4f 100644 --- a/Algorithm.Python/CustomDataUniverseScheduledRegressionAlgorithm.py +++ b/Algorithm.Python/CustomDataUniverseScheduledRegressionAlgorithm.py @@ -72,7 +72,7 @@ def on_end_of_algorithm(self): class MyPyCustomData(PythonData): def get_source(self, config, date, is_live_mode): - source = f"{Globals.DataFolder}/equity/usa/daily/{LeanData.generate_zip_file_name(config.symbol, date, config.resolution, config.tick_type)}" + source = f"{Globals.data_folder}/equity/usa/daily/{LeanData.generate_zip_file_name(config.symbol, date, config.resolution, config.tick_type)}" return SubscriptionDataSource(source) def reader(self, config, line, date, is_live_mode): diff --git a/Algorithm.Python/CustomIndicatorAlgorithm.py b/Algorithm.Python/CustomIndicatorAlgorithm.py index 112b00e32067..6f191eb2a698 100644 --- a/Algorithm.Python/CustomIndicatorAlgorithm.py +++ b/Algorithm.Python/CustomIndicatorAlgorithm.py @@ -31,7 +31,7 @@ def initialize(self) -> None: self._custom = CustomSimpleMovingAverage('custom', 60) # The python custom class must inherit from PythonIndicator to enable Updated event handler - self._custom.updated += self._custom_updated + self._custom.updated += self.custom_updated self._custom_window = RollingWindow[IndicatorDataPoint](5) self.register_indicator("SPY", self._custom, Resolution.MINUTE) diff --git a/Algorithm.Python/CustomModelsPEP8Algorithm.py b/Algorithm.Python/CustomModelsPEP8Algorithm.py index 4c7d1967dd06..da79087d17d1 100644 --- a/Algorithm.Python/CustomModelsPEP8Algorithm.py +++ b/Algorithm.Python/CustomModelsPEP8Algorithm.py @@ -117,7 +117,7 @@ def has_sufficient_buying_power_for_order(self, parameters): class SimpleCustomFillModelPEP8(FillModel): def __init__(self): - super().__init() + super().__init__() def _create_order_event(self, asset, order): utc_time = Extensions.convert_to_utc(asset.local_time, asset.exchange.time_zone) diff --git a/Algorithm.Python/CustomSecurityInitializerAlgorithm.py b/Algorithm.Python/CustomSecurityInitializerAlgorithm.py index e1f5fd20502c..febcb383189e 100644 --- a/Algorithm.Python/CustomSecurityInitializerAlgorithm.py +++ b/Algorithm.Python/CustomSecurityInitializerAlgorithm.py @@ -29,7 +29,7 @@ def initialize(self): # set our initializer to our custom type self.set_brokerage_model(BrokerageName.INTERACTIVE_BROKERS_BROKERAGE) - func_security_seeder = FuncSecuritySeeder(Func[Security, BaseData](self.custom_seed_function)) + func_security_seeder = FuncSecuritySeeder(self.custom_seed_function) self.set_security_initializer(CustomSecurityInitializer(self.brokerage_model, func_security_seeder, DataNormalizationMode.RAW)) self.set_start_date(2013,10,1) diff --git a/Algorithm.Python/FuturesChainFullDataRegressionAlgorithm.py b/Algorithm.Python/FuturesChainFullDataRegressionAlgorithm.py index 6f35e7b0c7b1..d6e6d53be1c9 100644 --- a/Algorithm.Python/FuturesChainFullDataRegressionAlgorithm.py +++ b/Algorithm.Python/FuturesChainFullDataRegressionAlgorithm.py @@ -32,7 +32,7 @@ def initialize(self): for index, row in df.iterrows(): if row['bidprice'] == 0 and row['askprice'] == 0 and row['volume'] == 0: - raise Exception("FuturesChain() returned contract with no data."); + raise AssertionError("FuturesChain() returned contract with no data."); # Get contracts expiring within 6 months, with the latest expiration date, and lowest price contracts = df.loc[(df.expiry <= self.time + timedelta(days=180))] diff --git a/Algorithm.Python/HistoryAlgorithm.py b/Algorithm.Python/HistoryAlgorithm.py index 26458a551506..999341caa90a 100644 --- a/Algorithm.Python/HistoryAlgorithm.py +++ b/Algorithm.Python/HistoryAlgorithm.py @@ -141,7 +141,7 @@ def assert_history_count(self, method_call, trade_bar_history, expected): class CustomDataEquity(PythonData): def get_source(self, config, date, is_live): zip_file_name = LeanData.generate_zip_file_name(config.Symbol, date, config.Resolution, config.TickType) - source = Globals.DataFolder + "/equity/usa/daily/" + zip_file_name + source = Globals.data_folder + "/equity/usa/daily/" + zip_file_name return SubscriptionDataSource(source) def reader(self, config, line, date, is_live): diff --git a/Algorithm.Python/UpdateOrderRegressionAlgorithm.py b/Algorithm.Python/UpdateOrderRegressionAlgorithm.py index 7092c1f216e0..f06c2866fcc4 100644 --- a/Algorithm.Python/UpdateOrderRegressionAlgorithm.py +++ b/Algorithm.Python/UpdateOrderRegressionAlgorithm.py @@ -58,9 +58,7 @@ def on_data(self, data): if self.time.month != self.last_month: # we'll submit the next type of order from the queue order_type = self.order_types_queue.dequeue() - #Log("") - self.Log("\r\n--------------MONTH: {0}:: {1}".format(self.time.strftime("%B"), order_type)) - #Log("") + self.log("\r\n--------------MONTH: {0}:: {1}".format(self.time.strftime("%B"), order_type)) self.last_month = self.time.month self.log("ORDER TYPE:: {0}".format(order_type)) is_long = self.quantity > 0