def get_object_configuration(self): return ( "*OBJECT CONFIGURATION* \n" "Coin from: {} \ncoin to: {} \ndate from: {} \ndate to: {} \ninterval: {} \nlimit: {} \n" .format(self._coin_from[0], self._coin_to[0], self._date_from, utils_date_time.get_date_from_epoch(self._date_to[0]), self._interval[0], self._limit[0]))
def create_readable_table_from_jsonarray(json, epoch=False, format=DATE_FORMAT_TIME): if json == None or len(json) == 0: print("JSON == NONE OR LENGTH OF IT IS ZERO") return None headers_table = [] for col_name in json[0]: headers_table.append(col_name) table = PrettyTable(headers_table) for interval in json: row_array = [] for attr in interval: # if epoch was passed print time as epoch if epoch: row_array.append(interval[attr]) # if epoch=False print time as readable date else: if attr == 'time': row_array.append( get_date_from_epoch(interval[attr], format)) else: row_array.append(interval[attr]) table.add_row(row_array) return table
def print_sudden_jump_results(sudden_jump_dict): for coin in sudden_jump_dict: if len(sudden_jump_dict[coin]) != 0: print("Coin: {} broke threshold {} times".format( coin, len(sudden_jump_dict[coin]))) for epoch in sudden_jump_dict[coin]: print(get_date_from_epoch(epoch)) else: print("{} didn't break threshold any time".format(coin))
def print_occurs_date_with_ratio(list): for occur in list: print("Date: {}, ratio: {}".format( get_date_from_epoch(occur[0], format=DATE_FORMAT_TIME), occur[1]))
def print_occurs_date_from_epochs(array): for occur in array: print(get_date_from_epoch(occur, format=DATE_FORMAT))
def print_interval_with_date(interval): print("{} : {}".format(get_date_from_epoch(interval['time']), interval))
def print_interval(interval): print("for date: {}".format(get_date_from_epoch(interval['time']))) for attr in interval: print("{}: {}".format(attr, interval[attr]))