Add automatic calculation for trade codes