MAINT: Clean up set_algo_instance usage in TradingAlgorithm.

TradingAlgorithm always uses set_algo_instance in pairs of
set_algo_instance(self) and set_algo_instance(None).  Refactoring this to use a
context manager.