Modified HW3 to write portfolio values to CSV file