Skip to content

Get broker account balances

Request

Get account balances for a broker in all assets.

Sample script

The following shell script demonstrates how to authenticate and retrieve account balances from the API. To execute this request, you will need the following credentials:

  • Broker Org Name: Your organization's identifier.
  • API_KEY: Your unique access key.
  • SECRET: The secret key associated with your API Key (used for signing).

The API requires an HMAC signature within the Authorization header. The script below calculates this signature and formats the header as follows:

Authorization: hmac username="${API_KEY}", algorithm="hmac-sha256", headers="date request-line", signature="${SIGNATURE}"

Sample shell script

# Variables
URL_PATH="/custody/api/broker/account/balances"
QUERY="org=<broker_org_name>&isOrgLP=false"
API_KEY="UGmfhBAoXTePWcxtljL0VSAiHTNAW3Uc"
SECRET="<secret>"

# RFC 1123 date in GMT
DATE=$(LC_ALL=C date -u +"%a, %d %b %Y %H:%M:%S GMT")

# Build signing string EXACTLY as Kong expects
SIGNING_STRING="date: ${DATE}\nGET ${URL_PATH}?${QUERY} HTTP/1.1"

# Generate HMAC signature (base64)
SIGNATURE=$(printf "%b" "$SIGNING_STRING" | openssl dgst -sha256 -hmac "$SECRET" -binary | base64)

# Show for debugging
echo "Signing String:"
printf "%b\n" "$SIGNING_STRING"
echo ""
echo "Signature: $SIGNATURE"
echo ""

# Execute request
curl -v "https://crdnet-uat.codexnetwork.org${URL_PATH}?${QUERY}" \
-H "Date: ${DATE}" \
-H "Authorization: hmac username=\"${API_KEY}\", algorithm=\"hmac-sha256\", \
    headers=\"date request-line\", signature=\"${SIGNATURE}\""
Security
SSO_TOKEN
Query
orgNamestring, <= 255 charactersrequired

Custody / liquidity provider (LP) / exchange / customer organization name

isLPbooleanrequired

Whether the organization is an LP (true) or customer (false).

JavaScript
const query = new URLSearchParams({
  orgName: 'string',
  isLP: 'true'
}).toString();

const resp = await fetch(
  `https://docs.fxinside.net/_mock/openapi/integral-api-reference/rest/custody/v2/broker/account/balances?${query}`,
  {
    method: 'GET',
    headers: {
      SSO_TOKEN: 'YOUR_API_KEY_HERE'
    }
  }
);

const data = await resp.text();
console.log(data);

Responses

Successful operation. If there are no balances, an empty array is returned.

Bodyapplication/json
Array [
custodyOrgstring, <= 255 characters

Custody organization ID associated with the balances.

Example:"CustodyOrgName"
customerOrgstring, <= 255 characters

Customer organization ID associated with the balances.

Example:"CustomerOrgName"
balancesArray of objects(balance)
]
Response
[ { "custodyOrg": "BrokerName", "customerOrg": "LP1", "balances": [ … ] } ]