Re: *Whose* code?
It's a fair point, however all employment and service contracts for banks have very wide ranging copyright assignment clauses. These are to the point that if you work on something, say some open source, out of working hours then the employer owns it, not the employee.
Algorithms of this type are highly sought after, and are a valuable thing.
He deserved to be punished for this, it was theft.