Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}

"""
Expand Down
2 changes: 1 addition & 1 deletion Algorithm.Python/BasicTemplateOptionStrategyAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
7 changes: 3 additions & 4 deletions Algorithm.Python/CapmAlphaRankingFrameworkAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]]
Expand All @@ -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'''
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Algorithm.Python/CustomDataUniverseRegressionAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion Algorithm.Python/CustomIndicatorAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Algorithm.Python/CustomModelsPEP8Algorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Algorithm.Python/CustomSecurityInitializerAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))]
Expand Down
2 changes: 1 addition & 1 deletion Algorithm.Python/HistoryAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 1 addition & 3 deletions Algorithm.Python/UpdateOrderRegressionAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down