Replace "insert_query_for_one_day" with "insert_query_for_n_histories"