How is stock profit calculated