INNER CODE UNIT · Python

_download_or_load_candles

Erfaniaa/crypto-trading-strategy-backtester · backtester.py:90

	def _download_or_load_candles(self, timeframe):
		print("download_or_load_candles", timeframe, "started")
		if os.path.isfile(self.candles_file_path[timeframe]):
			self.candles_list[timeframe] = pickle.load(open(self.candles_file_path[timeframe], "rb"))
		else:
			while True:
				try:
					self.candles_list[timeframe] = binance_api.get_candles(timeframe, self.start_date_timestamp, self.end_date_timestamp, self.coins_symbol)
					pickle.dump(self.candles_list[timeframe], open(self.candles_file_path[timeframe], "wb"))
					break
				except:
					print("ERROR in download_or_load_candles", timeframe)
		print("download_or_load_candles", timeframe, "finished")


	def _download_or_load_all_timeframes_candles(self):
		print("download_or_load_all_timeframes_candles started")
		for timeframe in self.all_timeframes_list:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…