updated the sell function to record earnings