Class: BrokerClient
Extends
BaseRestClient
Constructors
Constructor
new BrokerClient(restClientOptions?: RestClientOptions, networkOptions?: AxiosRequestConfig): BrokerClient;Create an instance of the REST client. Pass API credentials in the object in the first parameter.
Parameters
| Parameter | Type | Description |
|---|---|---|
restClientOptions? | RestClientOptions | options to configure REST API connectivity |
networkOptions? | AxiosRequestConfig | HTTP networking options for axios |
Returns
BrokerClient
Inherited from
BaseRestClient.constructor
Methods
applyFastWithdrawal()
applyFastWithdrawal(params: FastApiWithdrawApplyRequest): Promise<APISuccessResponse<FastApiWithdrawApplyResponse>>;Apply for Fast Withdrawal
Submit a Fast API withdrawal request to an external address or internal account. Initial request returns 2FA factors; resubmit with validation to complete withdrawal.
Parameters
| Parameter | Type |
|---|---|
params | FastApiWithdrawApplyRequest |
Returns
Promise<APISuccessResponse<FastApiWithdrawApplyResponse>>
createSubAccount()
createSubAccount(params: object): Promise<APISuccessResponse<CreateBrokerSubAccountResponse>>;Add SubAccount
This endpoint supports Broker users to create sub-accounts. Note that the account name is unique across the exchange. It is recommended to add a special identifier to prevent name duplication.
Parameters
| Parameter | Type |
|---|---|
params | { accountName: string; } |
params.accountName | string |
Returns
Promise<APISuccessResponse<CreateBrokerSubAccountResponse>>
createSubAccountApi()
createSubAccountApi(params: CreateBrokerSubAccountApiRequest): Promise<APISuccessResponse<CreateBrokerSubAccountApiResponse>>;Add SubAccount API
This interface supports the creation of Broker sub-account APIKEY. Supports up to 20 IPs in the whitelist. Permissions: General, Spot, Margin, Futures, InnerTransfer, Transfer, Earn. Label must be between 4 and 32 characters.
Parameters
| Parameter | Type |
|---|---|
params | CreateBrokerSubAccountApiRequest |
Returns
Promise<APISuccessResponse<CreateBrokerSubAccountApiResponse>>
deletePrivate()
deletePrivate(endpoint: string, params?: any): Promise<any>;Parameters
| Parameter | Type |
|---|---|
endpoint | string |
params? | any |
Returns
Promise<any>
Inherited from
BaseRestClient.deletePrivate
deleteSubAccountApi()
deleteSubAccountApi(params: DeleteBrokerSubAccountApiRequest): Promise<APISuccessResponse<boolean>>;Delete SubAccount API
This interface supports deleting Broker's sub-account APIKEY.
Parameters
| Parameter | Type |
|---|---|
params | DeleteBrokerSubAccountApiRequest |
Returns
Promise<APISuccessResponse<boolean>>
get()
get(endpoint: string, params?: any): Promise<any>;Parameters
| Parameter | Type |
|---|---|
endpoint | string |
params? | any |
Returns
Promise<any>
Inherited from
BaseRestClient.get
getBrokerInfo()
getBrokerInfo(params: GetBrokerInfoRequest): Promise<APISuccessResponse<BrokerInfo>>;Get Broker Info
This endpoint supports querying the basic information of the current Broker
Parameters
| Parameter | Type |
|---|---|
params | GetBrokerInfoRequest |
Returns
Promise<APISuccessResponse<BrokerInfo>>
getBrokerRebate()
getBrokerRebate(params: object): Promise<APISuccessResponse<{
url: string;
}>>;Get Broker Rebate
This interface supports downloading Broker rebate orders. Returns a URL to download a CSV file containing the rebate data. The URL is valid for 1 day. Maximum interval between begin and end dates is 6 months.
Parameters
| Parameter | Type |
|---|---|
params | { begin: string; end: string; tradeType: "1" | "2"; } |
params.begin | string |
params.end | string |
params.tradeType | "1" | "2" |
Returns
Promise<APISuccessResponse<{ url: string; }>>
getClientType()
getClientType(): RestClientType;Defines the client type (affecting how requests & signatures behave)
Returns
RestClientType
Overrides
BaseRestClient.getClientType
getDeposit()
getDeposit(params: object): Promise<APISuccessResponse<BrokerDepositRecord>>;Get Deposit Detail
This endpoint supports querying the deposit record of sub-accounts created by a Broker (excluding main account of nd broker).
Status:
- PROCESSING: Processing
- SUCCESS: Successful
- FAILURE: Failed
- PRE_SUCCESS: Funds credited ahead of final block confirmation
- WAIT_TRM_MGT: Under compliance verification
- TRM_MGT_REJECTED: Rejected after compliance verification
- ROLLBACKING: Reversing deposit
- ROLLBACK: Deposit reversed, no funds credited
- WAIT_RISK_MGT: Under risk verification
- RISK_MGT_REJECTED: Rejected after risk verification
Parameters
| Parameter | Type |
|---|---|
params | { currency: string; hash: string; } |
params.currency | string |
params.hash | string |
Returns
Promise<APISuccessResponse<BrokerDepositRecord>>
getDeposits()
getDeposits(params?: GetBrokerDepositListRequest): Promise<APISuccessResponse<BrokerDepositRecord[]>>;Get Deposit List
This endpoint can obtain the deposit records of each sub-account under the ND Broker. Default limit is 1000 records (max 1000). Results are sorted in descending order by default.
Status:
- PROCESSING: Processing
- SUCCESS: Successful
- FAILURE: Failed
- PRE_SUCCESS: Funds credited ahead of final block confirmation
- WAIT_TRM_MGT: Under compliance verification
- TRM_MGT_REJECTED: Rejected after compliance verification
- ROLLBACKING: Reversing deposit
- ROLLBACK: Deposit reversed, no funds credited
- WAIT_RISK_MGT: Under risk verification
- RISK_MGT_REJECTED: Rejected after risk verification
Parameters
| Parameter | Type |
|---|---|
params? | GetBrokerDepositListRequest |
Returns
Promise<APISuccessResponse<BrokerDepositRecord[]>>
getMarkupFee()
getMarkupFee(params?: GetBrokerMarkupFeeRequest): Promise<APISuccessResponse<GetBrokerMarkupFeeResponse>>;Get Markup Fee Default markup plus optional per-UID items.
Parameters
| Parameter | Type |
|---|---|
params? | GetBrokerMarkupFeeRequest |
Returns
Promise<APISuccessResponse<GetBrokerMarkupFeeResponse>>
getPrivate()
getPrivate(endpoint: string, params?: any): Promise<any>;Parameters
| Parameter | Type |
|---|---|
endpoint | string |
params? | any |
Returns
Promise<any>
Inherited from
BaseRestClient.getPrivate
getSubAccountApis()
getSubAccountApis(params: GetBrokerSubAccountApisRequest): Promise<APISuccessResponse<BrokerSubAccountApi[]>>;Get SubAccount API
This interface supports querying the Broker's sub-account APIKEYs. Can optionally filter by specific apiKey.
Parameters
| Parameter | Type |
|---|---|
params | GetBrokerSubAccountApisRequest |
Returns
Promise<APISuccessResponse<BrokerSubAccountApi[]>>
getSubAccounts()
getSubAccounts(params: GetBrokerSubAccountsRequest): Promise<APISuccessResponse<GetBrokerSubAccountsResponse>>;Get SubAccount
This interface supports querying sub-accounts created by Broker. Returns paginated results with default page size of 20 (max 100).
Parameters
| Parameter | Type |
|---|---|
params | GetBrokerSubAccountsRequest |
Returns
Promise<APISuccessResponse<GetBrokerSubAccountsResponse>>
getTransferHistory()
getTransferHistory(params: object): Promise<APISuccessResponse<BrokerTransferHistory>>;Get Transfer History
This endpoint supports querying transfer records of the broker itself and its created sub-accounts.
Account Types:
- MAIN: Funding account
- TRADE: Spot trading account
- CONTRACT: Contract account
- MARGIN: Margin account
- ISOLATED: Isolated margin account
Status:
- PROCESSING: Processing
- SUCCESS: Successful
- FAILURE: Failed
Parameters
| Parameter | Type |
|---|---|
params | { orderId: string; } |
params.orderId | string |
Returns
Promise<APISuccessResponse<BrokerTransferHistory>>
getWithdrawal()
getWithdrawal(params: object): Promise<APISuccessResponse<BrokerWithdrawalRecord>>;Get Withdrawal Detail
This endpoint supports querying the withdrawal records of sub-accounts created by a Broker (excluding main account of nd broker).
Status:
- PROCESSING: Processing
- WALLET_PROCESSING: Wallet Processing
- REVIEW: Under Review
- SUCCESS: Successful
- FAILURE: Failed
Parameters
| Parameter | Type |
|---|---|
params | { withdrawalId: string; } |
params.withdrawalId | string |
Returns
Promise<APISuccessResponse<BrokerWithdrawalRecord>>
hasAccessToken()
hasAccessToken(): boolean;Returns
boolean
Inherited from
BaseRestClient.hasAccessToken
post()
post(endpoint: string, params?: any): Promise<any>;Parameters
| Parameter | Type |
|---|---|
endpoint | string |
params? | any |
Returns
Promise<any>
Inherited from
BaseRestClient.post
postPrivate()
postPrivate(
endpoint: string,
params?: any,
internalReqContext?: InternalRequestContext
): Promise<any>;Parameters
| Parameter | Type |
|---|---|
endpoint | string |
params? | any |
internalReqContext? | InternalRequestContext |
Returns
Promise<any>
Inherited from
BaseRestClient.postPrivate
setAccessToken()
setAccessToken(newAccessToken: string): void;Parameters
| Parameter | Type |
|---|---|
newAccessToken | string |
Returns
void
Inherited from
BaseRestClient.setAccessToken
setMarkupFee()
setMarkupFee(params: SetBrokerMarkupFeeRequest): Promise<APISuccessResponse<SetBrokerMarkupFeeResponse>>;Set Markup Fee Maker and taker markup must be set together. Both 0 cancels markup.
Parameters
| Parameter | Type |
|---|---|
params | SetBrokerMarkupFeeRequest |
Returns
Promise<APISuccessResponse<SetBrokerMarkupFeeResponse>>
submitTransfer()
submitTransfer(params: BrokerTransferRequest): Promise<APISuccessResponse<{
orderId: string;
}>>;Transfer
This endpoint supports fund transfer between Broker account and Broker sub-accounts. Please be aware that withdrawal from sub-account is not directly supported. Broker has to transfer funds from broker sub-account to broker account to initiate the withdrawals.
Direction:
- OUT: Broker account is transferred to Broker sub-account
- IN: Broker sub-account is transferred to Broker account
Account Types:
- MAIN: Funding account
- TRADE: Spot trading account
Parameters
| Parameter | Type |
|---|---|
params | BrokerTransferRequest |
Returns
Promise<APISuccessResponse<{ orderId: string; }>>
updateSubAccountApi()
updateSubAccountApi(params: UpdateBrokerSubAccountApiRequest): Promise<APISuccessResponse<BrokerSubAccountApi>>;Modify SubAccount API
This interface supports modifying the Broker's sub-account APIKEY. Supports up to 20 IPs in the whitelist. Permissions: General, Spot, Margin, Futures, InnerTransfer, Transfer, Earn. Label must be between 4 and 32 characters.
Parameters
| Parameter | Type |
|---|---|
params | UpdateBrokerSubAccountApiRequest |
Returns
Promise<APISuccessResponse<BrokerSubAccountApi>>