If assigned, you must fulfill the obligation to buy or sell the underlying asset. You don’t have any control over assignment and will be notified if your contract gets assigned. The collateral will then be taken from the account to execute the obligation of the contract.
How can I avoid unexpected assignments?
Monitor your positions and consider buying back options before expiry if they are in-the-money to avoid assignment.
When selling option contracts that are nearing expiration and currently in-the-money, you can anticipate that these contracts may be assigned upon expiry. To avoid assignment, you can take action by buying back the option before expiration. This allows you to avoid the obligation of selling (for calls) or buying (for puts) the underlying shares.