Skip to main content
When you want to pull funds out of a PORTFOLIO share group and return them to your chain-level balance, use unlockFromShareGroup. Like other withdrawal actions, you can only move up to the withdrawable amount — the share group’s total equity minus the initial margin (IM) held against open positions and any margin frozen by active orders within that group. Unrealized profits are included in equity but cannot be withdrawn until realized.
You cannot withdraw funds committed as initial margin for open positions or frozen for pending orders within the share group. Close positions and cancel orders in the group first to free up additional margin.

Endpoint

Request

Every request must carry an ECDSA signature and a nonce to prevent replay attacks.

Action parameters

int32
required
groupId (required) — The ID of the source share group. Funds are deducted from this group’s shared margin pool, subject to its withdrawable amount limit.
int32
required
coinId (required) — The coin or currency ID to withdraw back to your chain-level balance.
string
required
amount (required) — The amount to withdraw, expressed as a raw integer string (e.g. "1000"). Must be greater than zero — 0 or a negative value returns 400 INVALID_PARAM and must not exceed the withdrawable amount available in the share group. Decimals are not accepted — use the coin’s smallest unit.
The server does not reject a request that omits marketDeployerId, groupId, or coinId with a 400: an omitted ID is treated as 0, and the resulting invalid combination is returned as HTTP 200 with a non-zero errorCode in response.data. Only a missing, malformed, or non-positive amount returns a 400. Always send every ID explicitly.

Response

A successful withdrawal returns the updated balances for both the source share group and your chain-level ledger. The response type is shareGroupFund, consistent with other share group fund operations.
int32
The coin ID that was withdrawn.
int64
The amount moved from the share group back to your chain-level balance.
int64
The share group’s margin pool balance after the withdrawal.
int64
Your chain-level balance for this coin after the withdrawal.
number
Present only when the request is rejected; a non-zero value means nothing moved.
string
Present together with errorCode. The rejection reason.

Errors

If the request cannot be fulfilled, the exchange still returns HTTP 200 with status: "ok" — the rejection is reported inside response.data, where a non-zero errorCode (number) and an errorMessage are present while the numeric amount and balance fields are set to 0. Common causes include:
  • Amount exceeds withdrawable balance — position IM and order-frozen margin within the group constrain how much can be withdrawn.
  • Unknown groupId — the specified share group does not exist.

HTTP errors

To deposit funds into a share group from your chain-level balance, use lockIntoShareGroup. To move funds from a share group into a market deployer instead, use transferShareGroupToMd.