Javascript crypto-currency profit/loss calculator