Fix trade code calculator