Issue #20001:use correct cost method when calculating margin
Merge pull request #28 from garyhgohoos/20001

Issue #20001:use correct cost method when calculating margin