I tested with different cases, and my code seems working fine. My sort logic is: name in alphabetical ascending order, if same, then date in descending order, if same, then profit (last-open) in descending order. I can't figure out where is the problem.