Skip to Content

Transfers

Transfers let you move balances and positions between subaccounts owned by the same authority.

Why Use Subaccount Transfers?

Subaccounts let you isolate risk and organize trading strategies. Common use cases for transfers include:

  • Strategy isolation: Separate market making from directional trading to prevent one strategy’s losses from affecting another’s collateral
  • Risk management: Move profits from an active trading account to a safer holding account
  • Rebalancing: Redistribute collateral when one subaccount needs more margin
  • Bot separation: Isolate automated trading bots on separate subaccounts while keeping manual trades separate
  • Experimentation: Test new strategies on a subaccount with limited capital, then transfer funds if successful

All subaccounts under the same wallet share cross-margin, but transfers let you explicitly move balances and positions to reorganize your capital.

SDK Usage

Transfer a Spot Deposit Between Subaccounts

const marketIndex = 0; // e.g. USDC const amount = driftClient.convertToSpotPrecision(marketIndex, 100); // transferDeposit(amount, marketIndex, fromSubAccountId, toSubAccountId) await driftClient.transferDeposit(amount, marketIndex, 0, 1);
Method DriftClient.transferDepositReference ↗
Parameters:
NameTypeDefault
amountany
marketIndexnumber
fromSubAccountIdnumber
toSubAccountIdnumber
txParamsTxParams
Returns:
Promise<string>

Transfer a Perp Position Between Subaccounts

import { BASE_PRECISION, BN } from "@drift-labs/sdk"; // transferPerpPosition(fromSubAccountId, toSubAccountId, marketIndex, amount) const amount = new BN(1).mul(BASE_PRECISION); // 1 base unit await driftClient.transferPerpPosition(0, 1, 0, amount);
Method DriftClient.transferPerpPositionReference ↗
Parameters:
NameTypeDefault
fromSubAccountIdnumber
toSubAccountIdnumber
marketIndexnumber
amountany
txParamsTxParams
Returns:
Promise<string>

Transfer Between Insurance Fund Pools

// Transfer between insurance fund pools (admin only) await driftClient.transferPools();
Method DriftClient.transferPoolsReference ↗
Parameters:
NameTypeDefault
depositFromMarketIndexnumber
depositToMarketIndexnumber
borrowFromMarketIndexnumber
borrowToMarketIndexnumber
depositAmountany
borrowAmountany
fromSubAccountIdnumber
toSubAccountIdnumber
txParamsTxParams
Returns:
Promise<string>

Transfer Isolated Perp Position Deposit

// Move deposits associated with an isolated perp position between subaccounts await driftClient.transferIsolatedPerpPositionDeposit(0, 1, 0);
Method DriftClient.transferIsolatedPerpPositionDepositReference ↗
Parameters:
NameTypeDefault
amountany
perpMarketIndexnumber
subAccountIdnumber
txParamsTxParams
trySettleboolean
noBufferboolean
Returns:
Promise<string>
Last updated on