Please refer to API Authentication Guide for more information regarding authentication.
Prerequisites
- Both the source and destination subaccounts must belong to the same main account
- The API key must have
trade:read_writescope - The API key must have
mainaccountscope for moving positions between subaccounts - You need the subaccount IDs (UIDs) which can be found in
My Account >> Subaccountstab
Rate limits
If you exceed the rate limit, you will receive error code13780 (move_positions_over_limit) with a wait parameter indicating how many seconds you should wait before trying again.
Moving positions
To move positions from a source subaccount to a target subaccount, use theprivate/move_positions method.
Example Request
Parameters
currency(optional): The currency symbol to filter positions. If not specified, positions for all currencies will be considered.source_uid(required): ID of the source subaccount. Can be found inMy Account >> Subaccountstab.target_uid(required): ID of the target subaccount. Can be found inMy Account >> Subaccountstab.trades(required): Array of trade objects specifying which positions to move. Each trade object can contain:instrument_name(required): The instrument name (e.g., “BTC-PERPETUAL”, “BTC-28JAN22-32500-C”)amount(required): The amount/quantity of the position to moveprice(optional): The price at which to move the position. If not specified, Deribit defaults to using the average entry price of the position.
Response
target_uid: The target subaccount IDsource_uid: The source subaccount IDprice: The price at which the position was movedinstrument_name: The instrument namedirection: The direction of the position (“buy” for long positions, “sell” for short positions)amount: The amount that was moved
Pricing
If noprice is specified in the request for a particular trade, Deribit defaults to using the average entry price of the position in the source subaccount. This ensures that the position is moved at its original cost basis.
You can also explicitly specify a price if you want to move the position at a different price level.
Moving full vs partial positions
You can move either full or partial positions:- Full position: Specify the entire position amount in the
amountfield - Partial position: Specify a portion of the position amount
amount must not exceed the available position size in the source subaccount.
Error handling
Rate limit errors
If you exceed the rate limit (6 requests/minute), you will receive:wait field before retrying.
Internal server errors
Common errors
- Invalid subaccount IDs: Ensure both
source_uidandtarget_uidare valid and belong to the same main account - Insufficient position: The
amountspecified exceeds the available position in the source subaccount - Invalid instrument: The
instrument_nameis not valid or the position doesn’t exist - Scope errors: Ensure your API key has both
trade:read_writeandmainaccountscopes
Best practices
- Check positions first: Before moving positions, verify the current positions in the source subaccount using
private/get_positions - Move in batches: Due to rate limits, if you need to move many positions, consider batching them into a single request rather than making multiple requests
- Verify after move: After moving positions, verify the positions in both source and target subaccounts to confirm the move was successful
- Handle errors gracefully: Implement retry logic with exponential backoff for rate limit errors
- Monitor rate limits: Keep track of your request rate to avoid hitting the 6 requests/minute limit
Example: Moving multiple positions
Here’s an example of moving multiple positions across different instruments:Related methods
private/get_positions- Get current positions for an accountprivate/get_subaccounts- List all subaccounts under your main accountprivate/get_subaccounts_details- Get detailed information about subaccounts