after archive, delete stock states when no more transactions

and better tests