Any realized and unrealized PnL accrued from open or closed positions needs to be “Settled” into the USDC balance of the account. PnL settlement can happen anytime for any account if other users trigger a settlement. Any user can also trigger PnL settlement of their own account by following these steps:
Get a Settle PnL nonce
Get a nonce from Get settle PnL nonce.
Obtain signature from EIP-712
Sign an EIP-712 message in the following format:
|Broker ID, the valid list can be found [here]
|Chain ID of the connected chain where the message was signed
|Valid withdrawal nonce from Get settle PnL nonce
|current timestamp in UNIX milliseconds
Request PnL settlement
Request a PnL settlement through Request Pnl settlement API.