PortfolioCash function written