From 43a080a0b4124f2958bb714bcfed24bca24c167f Mon Sep 17 00:00:00 2001 From: carstenf <58643140+carstenf@users.noreply.github.com> Date: Sun, 17 Dec 2023 16:44:34 +0100 Subject: [PATCH 1/2] Update load_quandl_sf1.py --- alphacompiler/data/load_quandl_sf1.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/alphacompiler/data/load_quandl_sf1.py b/alphacompiler/data/load_quandl_sf1.py index d4448b6..bed0bbe 100644 --- a/alphacompiler/data/load_quandl_sf1.py +++ b/alphacompiler/data/load_quandl_sf1.py @@ -33,6 +33,13 @@ def clear_raw_folder(raw_folder_path): + # check if raw exists, else create raw + raw_f_path = os.path.join(BASE, "raw") + if not os.path.exists(raw_f_path): + # If it doesn't exist, create the "raw" folder + os.makedirs(raw_f_path) + print(f"The 'raw' folder has been created at: {raw_f_path}") + # removes all the files in the raw folder print(' ** clearing the raw/ folder **') files = glob.glob(raw_folder_path + '/*') From 241b735f4796cb3e79e4fc6e3115e16dd172d99e Mon Sep 17 00:00:00 2001 From: carstenf <58643140+carstenf@users.noreply.github.com> Date: Sun, 17 Dec 2023 16:48:43 +0100 Subject: [PATCH 2/2] Update zipline_data_tools.py --- alphacompiler/util/zipline_data_tools.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/alphacompiler/util/zipline_data_tools.py b/alphacompiler/util/zipline_data_tools.py index 74d9c35..6beb1f1 100644 --- a/alphacompiler/util/zipline_data_tools.py +++ b/alphacompiler/util/zipline_data_tools.py @@ -67,7 +67,8 @@ def get_tickers_from_bundle(bundle_name): bundle_data = load(bundle_name, os.environ, None) # get a list of all sids - lifetimes = bundle_data.asset_finder._compute_asset_lifetimes(frozenset([str("US")])) + #lifetimes = bundle_data.asset_finder._compute_asset_lifetimes(frozenset([str("US")])) + lifetimes = bundle_data.asset_finder._compute_asset_lifetimes(country_codes=[str("US")]) # enable zipline-reloaded all_sids = lifetimes.sid # retreive all assets in the bundle @@ -82,7 +83,8 @@ def get_all_assets_for_bundle(bundle_name): bundle_data = load(bundle_name, os.environ, None) # get a list of all sids - lifetimes = bundle_data.asset_finder._compute_asset_lifetimes(frozenset([str("US")])) + #lifetimes = bundle_data.asset_finder._compute_asset_lifetimes(frozenset([str("US")])) + lifetimes = bundle_data.asset_finder._compute_asset_lifetimes(country_codes=[str("US")]) # enable zipline-reloaded all_sids = lifetimes.sid print('all_sids: ', all_sids)