Use sudo with the -u switch to specify the postgres user.
sudo -u postgres createdb stocks