speed up user profit graph by only doing one query per company in transaction history