Source: https://money.stackexchange.com/questions/83872/how-do-i-calculate-capital-gains-from-form-1099-b-from-my-broker