Function optimization of Margin Lending System