Skip to main content

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

/v1/perpum/pieceConvert

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

ParameterMandatoryTypeDescription
convertTypetrueLongConversion 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
dealPiecefalseBigDecimalNumber of contracts
faceValuetrueBigDecimalMinimum value per lot
baseSizefalseBigDecimalFace value*Number of sheets (amount in coins)

Response Parameters

ParameterTypeDescription
valueBigDecimalValue 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': ''}