I want to liquidate all my positions in case of any exception (in my code or in another thread).

How do I do that?

Author