Skip to content
Client Notification

Exchange V2

Manually performs currency exchange for a customer to repay borrowed funds.

Request parameters

  • Required: aaid (account ID), exchange_books (list of exchange entries). Each entry requires from_currency and to_currency, plus exactly one of from_amount or to_amount.
  • Body shape: {"aaid": 10000000, "exchange_books": [{"from_currency": "USD", "to_currency": "HKD", "from_amount": "100.00"}]}.
  • See the field definitions for each field's format, allowed values, and business meaning.

Business notes

Executes currency conversion entry by entry to repay the customer's borrowing; each entry specifies the from/to currencies and amounts.

Prerequisite: the account must have an FX repayment reminder (swap-remind) record under margin-call debt info (risk_debt_info); otherwise the call fails with 30020049. Use query_exchange_v2 with the same aaid to check the debt amount and available cash books first.

Risk warning

This operation directly moves real funds through exchange and repayment and cannot be reversed. Verify the account, currencies, and amounts before calling.

Result

On success the manual exchange repayment is completed; subsequent state and returned data follow the 200 response definition.

POSThttps://b-api.lbkrs.com/v1/risk_monitoring/exchange_v2

Authorization

AuthorizationstringheaderRequired

Send the Broker ACCESS_TOKEN as Authorization: Bearer <token>.

Permission

margin_call.risk_debt_info

The Broker ACCESS_TOKEN must be granted the permission above, or the call will be rejected.

Request body application/json

aaidintegerrequired

Account ID. Programmatically derived by the client from the selected record's record.aaid_val; not a form-editable field.

Pass the internal numeric ID of the customer's securities account (aaid), not the securities account number account_no (such as H00000000) or the customer ID member_id. One customer can have multiple aaid values.

exchange_booksarray<object>required

Exchange Books. Array of exchange entries; multiple entries can be submitted. Each entry is an object with from_currency, to_currency, and exactly one of from_amount / to_amount.

Child attributes
from_currencystringrequired

From Currency. Currency to convert from; choose one of the currencies held in the customer's cash books.

to_currencystringrequired

To Currency. Currency to convert to. Options come from the backend data dictionary of exchange-supported currencies; use the options the service returns.

from_amountstring

From Amount. Amount of from_currency to convert. Submit either from_amount or to_amount, not both; the other side is computed from the exchange rate.

to_amountstring

To Amount. Amount of to_currency to receive. Mutually exclusive with from_amount; submit only one of them.

Responses

HTTP 200The request was processed successfully. The response data does not contain additional business fields.
Standard response envelopecodemessagedata
dataobjectdata structure

No nested fields

HTTP 400Bad request. Check the business error code in code and the error details in message.
Standard response envelopecodemessagedata
dataobjectdata structure

No nested fields

HTTP 401The user is not authenticated, or the login session has expired.
Standard response envelopecodemessagedata
dataobjectdata structure

No nested fields

HTTP 403The current account is not authorized to use this feature. Grant the required permission to the account in User Permission.
Standard response envelopecodemessagedata
dataobjectdata structure

No nested fields

HTTP 408The request timed out. Check the business error code in code and the error details in message.
Standard response envelopecodemessagedata
dataobjectdata structure

No nested fields

Whale Docs