Mastering Margin Trading