Huobi Global is going to allow sub user to trade in margin mode

Dear API users,

Huobi Global is currently allowing sub user to trade in spot market, but not in margin mode. Since the effective day of this notification, authorized sub users are allowed to trade in margin mode, through related existing REST API endpoints.

Effective Date: September 16, 2019 (GMT+8)
All the changes will be updated on 【API Docs】

Huobi Global
September 12, 2019

The following are change details:
1) POST /v1/dw/transfer-in/margin
Transfer asset from sub user’s spot account to margin account.
2) POST /v1/dw/transfer-out/margin
Transfer asset from sub user’s margin account to spot account.
3) POST /v1/margin/orders
Apply a margin loan by sub user.
4) POST /v1/margin/orders/{order-id}/repay
Repay margin loan by sub user.
5) GET /v1/margin/loan-orders
Query margin loan orders by sub user.
6) GET /v1/margin/accounts/balance
Query margin account balance by sub user.

Asset transfer between parent user’s spot account and sub user’s spot account is still going through existing endpoint “POST /v1/subuser/transfer”. Asset transfer between parent user’s margin account and sub user’s margin account will not be supported.

Currently parent user is able to query aggregated spot account balance from all sub users through existing endpoint “GET /v1/subuser/aggregate-balance”. Since the effective day of this notification, this endpoint will be supporting aggregated margin account balance from all sub users as well. A new enumerated value “margin” will be added into existing field “type” in response message, in order to differentiate the aggregated balance which is coming from spot account or margin account. (margin account balance = user’s equity – unpaid principal – unpaid interest)

Currently parent user is able to query individual’s spot account balance from specific sub user through existing endpoint “GET /v1/account/accounts/{sub-uid}”. Since the effective day of this notification, this endpoint will be supporting individual’s margin account balance as well. A new field “symbol” will be added into response message, in order to differentiate margin accounts of the sub user.

Currently both parent user and sub user are able to query their own loan orders through existing endpoint “GET /v1/margin/loan-orders”. Since the effective day of this notification, by adding a new optional field “sub-uid” in the request, parent user will be allowed to query loan orders of a specific sub user. If “sub-uid” is not specified, this endpoint will still return loan orders from current logged-in user.

Currently both parent user and sub user are able to query their own margin account balance through existing endpoint “GET /v1/margin/ accounts/balance”. Since the effective day of this notification, by adding a new optional field “sub-uid” in the request, parent user will be allowed to query margin account balance of a specific sub user. If “sub-uid” is not specified, this endpoint will still return margin account balance from current logged-in user.

Parent user is only able to authorize a sub user for margin trading from Huobi official web. An authorized sub user will be able to trade all eligible symbols in margin mode, and share the credit quota with parent user.

1、REST API version 1 – Parent User to Query All Sub Users’ Aggregated Account Balance
GET /v1/subuser/aggregate-balance (API Key Permission: Read)
Request parameter(s):N/A

Response:

ParameterRequiredData TypeDescriptionValue Range
statustrue Status"OK" or "Error"
datatruelist  
{ currencytruestringCurrency 
typetruestringAccount typespot, margin
balance }truestringAccumulated balance from all sub users 

2、REST API version 1 – Parent User to Query Specific Sub User’s Account Balance
GET /v1/account/accounts/{sub-uid} (API Key Permission: Read)
Request parameter(s):N/A

Response:

ParameterRequiredData TypeDescriptionValue Range
statustrue Status"OK" or "Error"
datatruelist  
{ idtruestringSub user account ID 
typetruestringAccount typespot, margin
symboltruestringTrading symbol 
statetruestringAccount statusworking, lock
listtrueobject  
{ currencytruestringCurrency 
typetruestringType of balancetrade, frozen, loan, interest
Balance }}truedecimalBalance 

3、REST API version 1 – Query Loan Orders
GET /v1/margin/loan-orders (API Key Permission: Read)

Request parameter(s):

ParameterRequiredData TypeDescriptionDefault ValueValue Range
symboltruestringTrading symbolNA 
start-datefalsestringStart date of the query in format yyyy-mm-dd-61d 
end-datefalsestringEnd date of the query in format yyyy-mm-ddToday 
statesfalsestringOrder statusallcreated,accrual,cleared,invalid
fromfalsestringStart ID of the queryNA 
directfalsestringDirection of the searchinnextprev - in ascending order from the start IDnext - in descending order from the start ID
sizefalsestringNumber of items in each response100[1,100]
sub-uidfalseintSub user ID (mandatory field while parent user querying sub user’s orders)If not entered, by default it returns margin orders of current user 

Response:

ParameterRequiredData TypeDescriptionValue Range
statustrue Status"OK" or "Error"
datatruelist  
{ idtruelongOrder ID 
user-idtruelongUser ID 
account-idtruelongAccount ID 
symboltruestringTrading symbol 
currencytruestringCurrency 
loan-amounttruestringDebt amount 
loan-balancetruestringUnpaid debt 
interest-ratetruestringInterest rate 
 interest-amounttruestringInterest amount 
interest-balancetruestringUnpaid interest 
created-attruelongOrder creation time 
accrued-attruelongLast counting time of interest 
state }truestringOrder statuscreated,accrual,cleared,invalid

4、REST API version 1 – Query Margin Account Balance
GET /v1/margin/accounts/balance (API Key Permission: Read)
Request parameter(s):

ParameterRequiredData TypeDescriptionDefault ValueValue Range
symbolfalsestringTrading symbolall 
sub-uidfalseintSub user ID (mandatory field while parent user querying sub user’s margin account details)If not entered, by default it returns margin account details of current user 

Response:

ParameterRequiredData TypeDescriptionValue Range
statustrue Status"OK" or "Error"
datatruelist  
{ idtruestringAccount ID 
symboltruestringTrading symbol 
statetruestringAccount statusworking,fl-sys,fl-mgt,fl-end
risk-ratetruestringRisk rate 
fl-pricetruestringLiquidation price 
listtrueobject  
{ currencytruestringCurrency 
typetruestringType of balancetrade, frozen, loan, interest
Balance }}truedecimalBalance