If you still see debt after selling, most likely you are using the wrong account mode. Closing a position does not automatically repay the borrowed money for you.

A leading global cryptocurrency platform,suitable for both beginners and experienced traders.
New user benefit: 20% off trading fees upon registration!!
OKX's rule is: different account modes handle closing positions and debt repayment differently. If this is unclear, it is normal to see debt after selling assets.
Case 1: Contract Mode – Closing a Position Clears Debt Automatically
If you use contract mode, whether cross or isolated, closing a position makes the system automatically repay your borrowed amount and interest. The rule is simple: closing a position = debt automatically cleared to zero.
If you still have debt in this case, it is usually because the position loss was too large and the sale proceeds were not enough to repay the full loan. The liquidation engine sells in batches, and in extreme markets you may still owe a small amount.
[What to do]: Go to the Assets page and check if the Liabilities field still shows a number.
[How to do it]: If debt remains, it means the sale proceeds did not cover the full loan. You can manually repay the rest, or deposit the owed coin and let the system deduct it automatically.
[Done when]: The Liabilities field on the Assets page shows 0.
Case 2: Cross-Currency/Portfolio Margin Mode – You Must Repay Manually After Closing
Under cross-currency margin mode (PM), debt does not disappear automatically after closing. This mode allows your account to have a negative balance (debt), so closing a position does not clear the debt for you.
Debt can be created for several reasons:
A spot leverage order is filled and sells more than your available balance, directly creating debt.
The unrealized loss on a cross-margin contract position exceeds the interest-free limit, and the excess becomes interest-bearing debt.
In cross-currency margin mode, after closing a position you need to manually buy back the owed coin in the spot market to repay. There are three repayment methods:
Repay directly with the borrowed coin: If you have the owed coin in your account, go to Assets → Borrow → Repay and enter the amount. For partial repayment, the system repays interest first, then principal.
Repay with collateral assets: If you do not want to buy coins, you can use other assets in your account such as BTC or ETH. The system will sell these assets for the needed coin to repay. Note that this process involves fees and slippage.
Manually buy and repay: Buy the owed coin directly in the spot market. After the purchase, the system will automatically transfer and repay the debt.

A leading global cryptocurrency platform,suitable for both beginners and experienced traders.
New user benefit: 20% off trading fees upon registration!!
How to Verify It Is Done
After the checks above, go to the Assets page and check the Liabilities field. If it shows 0, the loan is fully repaid. If it still shows a number, follow the rules in Case 1 or Case 2 to manually clear the remaining debt.
Also note: Borrowing interest is charged hourly. Any unpaid debt keeps generating interest. The longer you wait, the more you will owe.


