fixing logic for trades