fix trade code calculations for reals this time