A man who hacked into the internet accounts of stock brokers has been sentenced to two years in jail.