Fix algorithm for finding best trades