Bank monitor margin to lock/release cash. If no more cash avaible , bank will warning user. If margin too low, bank will auto-close the trade to return loan.
Equity = Asset – Debt
Equity = Asset0 + Cash – Debt
Equity – Cash = Asset0 – Debt = Margin
%Margin = (Equity-Cash)/Asset0 (current locked margin)
%ExtendMargin = Equity/Asset0 (extensible margin)
Cash0 (free cash) = Equity – Asset0*Fix_Margin%
Bank monitor free cash if it =0, users have not enough cash to maintain their position.
Deadlock, Inconsistent, Low performance
The platform require bank lock user money before accept/execute orders, but the bank require platform provide market price before it process orders -> easy to death lock, inconsistent. If we avoid from deadlock and inconsistent, we must accept low performance. The platform should not process any order before bank finish its job.