SettlementTx
There are two ideal cases in settlement. One when the trader loses margin in the position, and the other when trader gains margin in the position.
There are rather 2 scenarios when the trader would lose part of the margin. One is when the liquidation price hits. The other is when the settlementPrice is below the entryPrice.
Liquidations
The constraints below are used for liquidation of OrderTx
.
IM: Initial Margin, AM: Available Margin, P: Payment
LP: Liquidation Price
AND
is a conjunction constraint0 and 1 subcripts are referrence to previous and new state
The payment is deducted from the OrderTx
and added to LendTx
, changing the LendState
.
The liquidation price LP
is pushed in cleartext to the stack.
Earn Settlement
When a OrderTx
gains margin balance, the payment is deducted from the Lendtx
and added to the OrderTx
. The settlement price is not pushed to the stack in this case.
IM: Initial Margin, AM: Available Margin, P: Payment
AND
is the conjunction constraint0 and 1 subscripts are reference to previous and new state
Last updated