SQL has aggregate functions that operate on grouped columns, returning a single value for the group. In this case, SUM should do what you want.
SELECT SUM(delta) FROM transactions GROUP BY product;
If you need something more specific, you'll need to include a minimal test case, which (for this...