Source: https://money.stackexchange.com/questions/94903/tax-avoidance-mixing-gains-and-losses-in-the-same-tax-year/94945