def should_update_data(self, time_frame): previous_time_frame = TimeFrameManager.get_previous_time_frame(self.config_time_frames, time_frame, time_frame) previous_time_frame_sec = TimeFramesMinutes[previous_time_frame] previous_time_frame_updated_times = self.time_frame_get_times[previous_time_frame.value] current_time_frame_sec = TimeFramesMinutes[time_frame] current_time_frame_updated_times = self.time_frame_get_times[time_frame.value] if previous_time_frame_updated_times - ( current_time_frame_updated_times * (current_time_frame_sec / previous_time_frame_sec)) >= 0: return True else: return False
def should_update_data(self, time_frame): previous_time_frame = TimeFrameManager.get_previous_time_frame( self.config_time_frames, time_frame, time_frame) previous_time_frame_sec = TimeFramesMinutes[previous_time_frame] previous_time_frame_updated_times = self.time_frame_get_times[ previous_time_frame.value] current_time_frame_sec = TimeFramesMinutes[time_frame] current_time_frame_updated_times = self.time_frame_get_times[ time_frame.value] if previous_time_frame_updated_times - ( current_time_frame_updated_times * (current_time_frame_sec / previous_time_frame_sec)) >= 0: return True else: return False
def should_update_data(self, symbol, time_frame, trader): previous_time_frame = TimeFrameManager.get_previous_time_frame( self.config_time_frames, time_frame, time_frame) previous_time_frame_sec = TimeFramesMinutes[previous_time_frame] previous_time_frame_updated_times = self.time_frame_get_times[ previous_time_frame.value] current_time_frame_sec = TimeFramesMinutes[time_frame] current_time_frame_updated_times = self.time_frame_get_times[ time_frame.value] time_refresh_condition = ( previous_time_frame_updated_times - (current_time_frame_updated_times * (current_time_frame_sec / previous_time_frame_sec)) >= 0) recent_trades_condition = trader.get_open_orders() and ( self.fetched_trades_counter[symbol] > current_time_frame_updated_times) return time_refresh_condition and (not trader.get_open_orders() or recent_trades_condition)