MCPcopy
hub / github.com/tradytics/surpriver / load_data_from_dictionary

Method load_data_from_dictionary

data_loader.py:215–241  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

213 return features, historical_price_info, future_price_info, symbol_names
214
215 def load_data_from_dictionary(self):
216 # Load data from dictionary
217 print("Loading data from dictionary")
218 dictionary_data = np.load(self.DICT_PATH, allow_pickle = True).item()
219
220 features = []
221 symbol_names = []
222 historical_price_info = []
223 future_price_info = []
224 for symbol in dictionary_data:
225 feature_list = self.taEngine.get_features(dictionary_data[symbol]["features"])
226 current_prices = dictionary_data[symbol]["current_prices"]
227 future_prices = dictionary_data[symbol]["future_prices"]
228
229 # Check if there is any null value
230 if np.isnan(feature_list).any() == True:
231 continue
232
233 features.append(feature_list)
234 symbol_names.append(symbol)
235 historical_price_info.append(current_prices)
236 future_price_info.append(future_prices)
237
238 # Sometimes, there are some errors in feature generation or price extraction, let us remove that stuff
239 features, historical_price_info, future_price_info, symbol_names = self.remove_bad_data(features, historical_price_info, future_price_info, symbol_names)
240
241 return features, historical_price_info, future_price_info, symbol_names
242
243 def remove_bad_data(self, features, historical_price_info, future_price_info, symbol_names):
244 """

Callers 1

find_anomaliesMethod · 0.80

Calls 2

remove_bad_dataMethod · 0.95
get_featuresMethod · 0.80

Tested by

no test coverage detected