I have revised my question here:
https://ttlc.intuit.com/community/tax-credits-deductions/discussion/how-to-calculate-gain-loss-for-t...