Funding your Margin Account
Funding your margin account involves transferring funds between your main balance and your margin account. This process is essential to start margin trading and to manage your positions.
You can:
- Deposit: Transfer funds from your main balance to your margin account to increase your trading power
- Withdraw: Transfer funds from your margin account back to your main balance, subject to margin level requirements
Each operation requires an idempotency key to prevent duplicate transactions. You must have sufficient balance in the source account (main balance for deposits, margin account for withdrawals).
If you retry with the same idempotency key while the original request is still in progress, the API returns 409 (concurrent_request). After the original request completes, retries with the same key within its lifetime return the same successful response (see BAP-19).
To process a deposit or withdrawal, use the Process margin funds movement endpoint.
Related endpoints
To check your movements history, use:
Important Restrictions
- Account Status: The margin account must have
INACTIVEorACTIVEstatus to process any movement. Accounts withBLOCKED,LIQUIDATING, orONBOARDINGstatus cannot process movements. - Currency Availability: Only currencies available for margin trading can be deposited to the margin account. Check the Get Margin Available Currencies endpoint for the list of supported currencies.
- Withdrawal Requirements: Withdrawals from margin account are only allowed when the withdrawal keeps the account healthy, meaning the margin level remains above the safe threshold after the operation. You can check the safe threshold and current margin level using the Get Margin Account Summary endpoint.
Error responses
| HTTP status | Error code | When it happens |
|---|---|---|
404 | resource_not_found | No margin account exists for the authenticated user |
409 | concurrent_request | A movement with the same idempotency key is already in progress |
422 | not_enough_balance | Insufficient balance in the source account (main for deposits, margin for withdrawals) |
422 | currency_not_enabled | Currency is not enabled for margin trading or is not listed on a live order book |
422 | withdrawal_rejected | Withdrawal would leave margin level below the safe threshold |
Updated 12 days ago
