Coin Conversion
API Description
This interface allows conversion between contract units (pieces) and cryptos (coins) in futures trading.
Note: Coin conversion is only available via RESTful API.
Precautions
None
Authentication
This is a private interface and requires authentication. For details on using the RESTful API, refer to Introduction > Authentication & Code Snippet > Futures > RESTful Private Interface.
Request Method
POST
Endpoint
Frequency Limit
The frequency limit for this interface is 10 requests/2s per user ID and IP. In addition to this per-interface limit, a global rate limit is also enforced.
For detailed information on Global rate limits and API Rate Limiting Policy, please refer to the "Frequency Limit" section at click here
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| convertType | true | Long | Conversion type: 1: Convert contract units (pieces) to coins 2: Convert coins to contract units (pieces) Note: For "1": dealPiece is mandatoryFor "2": baseSize is mandatory |
| dealPiece | false | BigDecimal | Number of contracts |
| faceValue | true | BigDecimal | Minimum value per lot |
| baseSize | false | BigDecimal | Face value*Number of sheets (amount in coins) |
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| value | BigDecimal | Value for either contracts or coins |
Request Example
The following Python code shows how to convert contracts to coins.
Note: For a complete code example, please refer to Introduction > Authentication & Code Snippet > Futures > RESTful Private Interface.
params = {
"convertType": 1,
"dealPiece": 11,
"faceValue": 0.001,
}
api_url = "/v1/perpum/pieceConvert"
method = "POST"
response_code, response_data = FuturesRestfulPrivate(params, api_url, method, sec_key, api_key) # function rFuturesRestfulPrivate() is defined in section (Introduction > Authentication & Code Snippet > Futures > RESTful Private Interface)
Note: For a complete Java code example, please refer to Introduction > Authentication & Code Snippet > Futures > RESTful Private Interface.
Response Example
The following is an example response returned by the above Python request:
{'code': 0, 'data': {'value': 0.011}, 'msg': ''}