A ban on stock trading by judges would be fine, but there's no reason one is required for the other. Congressionals generally have a much greater ability to affect prices of individual stocks than judges do.
https://twitter.com/user/status/1491518803414433793