How to calculate the credit line of margin financing and securities lending?

Hello, the credit limit is determined by credit rating, customer's credit limit, application amount, financial assets, total assets and the company's remaining available credit limit. Margin of customer margin =MIN (company's remaining available credit line, company's single customer line, customer application line, credit line, financial assets ×50% or total assets ×25%).