History data in one query, refactor on HTTP data agent