function calculating portfolio returns