master: added saving to database and filter for gainers and losers.