Changing portfolio to code