Skip to content
Trade Password

Trade Password Set

This interface is used to set the trading password for a specified securities account for the first time. By providing the account number account_no and the encrypted trading password encrypt_password, it completes the initial setup of the trading password.

Password transmission requires the password to be encrypted. The encryption method is as follows:

const Crypto = require('crypto-js')

const encryptedPassword = function encodePassword(ts, password) {
    const keyMD5 = Crypto.MD5(ts.toString())
    const pwdMD5 = Crypto.MD5(password)
    const iv = keyMD5.slice(0, 16)

    return Crypto.AES.encrypt(pwdMD5, keyMD5, {
        mode: Crypto.mode.CBC,
        padding: Crypto.pad.Pkcs7
    });
}

Here ts is the value of x-timestamp in the request header, which is a Unix timestamp.

The encrypted value is tied to the x-timestamp header of the same request, so generate it in the client that sends the request. A value encrypted with a different timestamp fails verification, and a caller that cannot set x-timestamp or run this encryption cannot call this endpoint successfully.

POSThttps://b-api.lbkrs.com/v1/whaleapi/account/trade/set_pwd

Authorization

AuthorizationstringheaderRequired

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

Permission

broker_api.super_manage

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

Request body application/json

account_nostringrequired

Account Number

account_no is the securities account number (such as L6VQEU00121996). It differs from the customer ID member_id and the internal securities account ID aaid.

encrypt_passwordstringrequired

New trading password, encrypted with the AES-CBC method shown in the operation description. Do not send the plaintext password.

Responses

HTTP 200OK
Standard response envelopecodemessagedata
dataobjectdata structure

Data

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