The Margin Engine