HTX is going to support six new features in REST API for cross margin trading
- API Announcements
Dear API users,
Since the effective day of this notification, HTX will be supporting a few new endpoints in REST API as following –
1)POST /v1/cross-margin/transfer-in transfer asset from spot trading account to cross-margin account
2)POST /v1/cross-margin/transfer-out transfer asset from cross-margin account to spot trading account
3)POST /v1/cross-margin/orders place an order to apply cross-margin loan
4)POST /v1/cross-margin/orders/{order-id}/repay repay a previous cross-margin loan order
5)GET /v1/cross-margin/loan-orders query existing cross-margin loan orders
6)GET /v1/cross-margin/accounts/balance query cross-margin account balance
Effective Date:October 11, 2019 (GMT+8)
All the changes will be updated on 【API Docs】
HTX
October 11, 2019
The following are change details:
1. REST API – Transfer asset between spot trading account and cross-margin account
POST /v1/cross-margin/transfer-in (API key permission: Trade)
POST /v1/cross-margin/transfer-out (API key permission: Trade)
Request parameter(s)
Parameter | Required | Data Type | Description | Value Range | Default Value |
currency | true | string | Currency | ||
amount | true | string | Transfer amount |
Response
Parameter | Required | Data Type | Description | Value Range |
status | true | string | Status | "OK" or "Error" |
data | true | int | Transfer ID |
2. REST API – Place a cross-margin loan order
POST /v1/cross-margin/orders (API key permission: Trade)
Request parameter(s)
Parameter | Required | Data Type | Description | Value Range | Default Value |
currency | true | string | Currency | ||
amount | true | string | Loan amount |
Response
Parameter | Required | Data Type | Description | Value Range |
status | true | string | Status | "OK" or "Error" |
data | true | int | Margin order ID |
3. REST API – Repay a previous cross-margin loan order
POST /v1/cross-margin/orders/{order-id}/repay (API key permission: Trade)
Request parameter(s)
Parameter | Required | Data Type | Description | Value Range | Default Value |
order-id | true | string | Margin order ID | ||
amount | true | string | Repay amount |
Response
Parameter | Required | Data Type | Description | Value Range |
status | true | string | Status | "OK" or "Error" |
data | true | int | Margin order id |
4. REST API – Query existing cross-margin loan orders
GET /v1/cross-margin/loan-orders (API key permission: Read)
Request parameter(s)
Parameter | Required | Data Type | Description | Value Range | Default Value |
start-date | false | string | Start time (in format yyyy-mm-dd) | ||
end-date | false | string | End time (in format yyyy-mm-dd) | ||
currency | false | string | Currency | ||
state | false | string | Order status | created,accrual,cleared,invalid | all |
from | false | string | Start margin order ID | 0 | |
direct | false | string | prev,next | ||
size | false | string | Number of items in each response | [10,100] | 100 |
Response
Parameter | Required | Data Type | Description | Value Range |
status | true | string | Status | "OK" or "Error" |
data | true | object | ||
{ id | true | long | Margin order ID | |
user-id | true | long | User ID | |
account-id | true | long | Account ID | |
currency | true | string | Currency | |
loan-amount | true | string | The amount of origin loan | |
loan-balance | true | string | The amount of the loan left | |
interest-amount | true | string | The accumulated loan interest | |
interest-balance | true | string | The amount of loan interest left | |
filled-points | true | string | Point deduction amount | |
filled-ht | true | string | HT deduction amount | |
created-at | true | long | Margin order creation time | |
accrued-at | true | long | Latest accrued time | |
state } | true | string | Order status | created,accrual,cleared,invalid |
5. REST API – Query cross-margin account balance
GET /v1/cross-margin/accounts/balance (API key permission: Read)
Request parameter(s)
Null
Response
Parameter | Required | Data Type | Description | Value Range |
status | true | string | Status | "OK" or "Error" |
data | true | object | ||
{ id | true | int | Account ID | |
type | true | string | Account type (margin or cross-margin) | cross-margin |
state | true | string | Account status | working,fl-sys,fl-end,fl-negative |
risk-rate | true | string | Risk rate | |
acct-balance-sum | true | string | Account balance totaled in USDT | |
debt-balance-sum | true | string | Debt balance totaled in USDT | |
list | true | array | Account layout by individual currency | |
{ currency | true | string | Currency | |
type | true | string | Account type | trade,frozen,loan,interest,transfer-out-available,loan-available |
balance }} | true | string | Balance (note: while type=transfer-out-available, if balance=-1, it implicates that all balance can be transferred out.) |