Fixes the PNL issue on the history command where the trade pnl always showed zero. I've also addressed several other instances where I think we're in danger of a related error happening in the future.
Original bug report: https://github.com/hummingbot/hummingbot/issues/5069 Link: https://github.com/hummingbot/hummingbot/pull/5099