Creates a MarginX margin group with eligible DMA accounts and/or RapidX Portfolio venues.
| Time | Status | User Agent | |
|---|---|---|---|
Retrieving recent requests… | |||
Creates a MarginX margin group and adds the specified DMA accounts and/or RapidX Portfolio venues. DMA-only, RapidX-only and mixed groups are supported.
Rate limit: 10 requests per minute per API key.
API key access
Requires a signed LTP Open API request with TRANSFER permission. Creating a group does not itself borrow or transfer funds.
| API key type | Can call | Scope |
|---|---|---|
| Main User Level API key (also the Main Portfolio key) | Yes | Eligible accounts and Portfolios belonging to the main user, including those assigned to sub-users. |
| Sub-user Level API key | No | Cannot create groups. |
| Dedicated Sub Portfolio Level API key | No | Cannot create groups. |
| Exchange-native API key | No | Use an LTP Main User Level API key. |
Body parameters
Send a JSON object. Both member arrays are required; use [] for the member type you are not adding.
| Name | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Group name, 1–64 characters after trimming leading and trailing whitespace. The name must be unique within the main user's groups. |
dmaGroupMemberList | array of objects | Yes | DMA accounts to add. Each item contains memberId, the DMA account ID. Do not supply a venue for DMA members. |
rxGroupMemberList | array of objects | Yes | RapidX members to add. Each item contains memberId, the Portfolio ID, and venue, its exchange, such as BINANCE or OKX. |
Members and limits
- Use Get Trading Account Assets V2 to find account and Portfolio IDs.
memberIdidentifies an account or Portfolio; it is not a margin group ID. - The two arrays must contain 1–30 members in total. A main user can have up to 20 groups.
- A DMA account is identified by
memberId; a RapidX member is identified bymemberIdandvenue. Do not submit duplicate members or members already belonging to another group. - Accounts must be eligible for MarginX. Frozen, restricted or external accounts cannot be added. Visibility in the account list alone does not establish eligibility.
- If any member fails validation, the creation request fails; invalid members are not silently skipped.
Signing a body containing member arrays
Follow Authentication for the headers and HMAC-SHA256 algorithm. For this endpoint, the signature uses the following representation of nested body values; the HTTP body remains standard JSON:
| Value | Representation in the signing string |
|---|---|
| Empty array | [] |
| DMA array | [{memberId=51001}] |
| RapidX array | [{memberId=71001, venue=BINANCE}] |
| Multiple elements or object fields | Separate with a comma and one space: , |
Sort top-level parameter names alphabetically. Preserve array order and the order of fields within each member object. Exclude top-level fields with JSON null values from the signing string; required fields must still contain valid values.
For the request below, the HMAC input is:
dmaGroupMemberList=[{memberId=51001}]&name=Group Alpha&rxGroupMemberList=[{memberId=71001, venue=BINANCE}]&<nonce>Runnable Python example (replace the example IDs with eligible accounts):
import hashlib
import hmac
import json
import os
import time
import urllib.request
payload = {
"name": "Group Alpha",
"dmaGroupMemberList": [{"memberId": "51001"}],
"rxGroupMemberList": [{"memberId": "71001", "venue": "BINANCE"}],
}
def signing_value(value):
if isinstance(value, list):
return "[" + ", ".join(signing_value(item) for item in value) + "]"
if isinstance(value, dict):
return "{" + ", ".join(
key + "=" + signing_value(item) for key, item in value.items()
) + "}"
return str(value)
nonce = str(int(time.time()))
parameters = "&".join(
key + "=" + signing_value(payload[key])
for key in sorted(payload) if payload[key] is not None
)
signature = hmac.new(
os.environ["LTP_SECRET_KEY"].encode(),
(parameters + "&" + nonce).encode(),
hashlib.sha256,
).hexdigest()
request = urllib.request.Request(
"https://api.liquiditytech.com/api/v2/lending/marginx/groups",
data=json.dumps(payload).encode(),
headers={
"Content-Type": "application/json",
"X-MBX-APIKEY": os.environ["LTP_API_KEY"],
"nonce": nonce,
"signature": signature,
"ts": str(time.time_ns() // 1000),
},
method="POST",
)
with urllib.request.urlopen(request, timeout=30) as response:
print(response.read().decode())Response fields
| Field | Type | Description |
|---|---|---|
code | integer | 200 means success; any other value indicates an error. |
message | string | Result message; success for a successful request. |
data.id | string | ID of the newly created margin group. Use this group ID for subsequent group operations, not a member ID. |
data.name | string | Saved group name, with leading and trailing whitespace removed. |
Success and error examples are available in the response panel.
Error codes
Business errors can return HTTP 200 with a non-success JSON code. Check code, not HTTP status alone. See Error Codes for shared errors.
| Code | When it occurs | What to do |
|---|---|---|
1000 | A member array has the wrong JSON type, for example an object instead of an array. | Send both lists as JSON arrays. Example message: Invalid JSON type for rxGroupMemberList. |
1001 | A required field is missing, including name, either member array, memberId, or a RapidX member's venue. | Supply the field identified by the message. |
100400 | Invalid parameters, such as an empty/overlong name, empty member IDs, no members, duplicate members or an unsupported RapidX venue. | Check the body parameters and member limits. |
-1 | Business validation fails, such as a duplicate group name or an unavailable member. Messages may include Account data temporarily unavailable or MarginX group data unavailable. | Check the group name, account/Portfolio IDs, venue, supported exchange and member eligibility. These messages do not necessarily mean a transient outage; do not blindly retry. |
2000 | Signature verification fails. | Check the nested-value signing rules above and the authentication headers. |
2003 | The calling API key level is not allowed. | Use a Main User Level API key. |
2004 | The calling key lacks a required permission. | Use a key with TRANSFER permission. |
100429 | The rate limit is exceeded. | Reduce the request rate. |
If a creation request times out, check the group list for the submitted name before resubmitting it.
