Functions optimization of Margin Lending System