Skip to main content

Subscribe Mega Coupon

API Description

The Websocket provides real-time updates on the Mega Coupon, pushing information only when Mega Coupon is issued or nearing expiration. It delivers key details such as balance, status, validity period, and whether advanced KYC verification is required, aiding in efficient asset management.

For more details on Mega Coupon, refer to https://coinw.zendesk.com/hc/en-us/articles/23111150445977-Introduction-to-Futures-Mega-Coupon

Note: Mega Coupon data is accessible via both RESTful and Websocket APIs. This page describes the WebSocket API. For information on the RESTful API, please click here

Precautions

  1. The Websocket only pushes updates when Mega Coupon is issued or approaching expiration.

Authentication

This is a private Websocket and requires authentication. For details on using the Websocket API, please refer to Introduction > Authentication & Code Snippet > Futures > Websocket Private Interface.

Websocket URL

wss://ws.futurescw.com/perpum

Frequency limit

The frequency limit for this subscription is 1 request/2s per user ID.

Subscription Parameters

ParameterMandatoryTypeDescription
eventtrueStringSubscribe or unsubscribe. sub: subscribe; unsub: unsubscribe.
Note: This parameter is case-sensitive.
paramstrueJsonData object containing the following fields:
-biztrueStringSpecifies the channel, e.g., "futures".
-typetrueStringDefines the function type, e.g., "assets_ag".

Response Parameters

ParameterTypeDescription
bizStringSpecifies the channel, e.g., "futures".
typeStringFunction type e.g., "assets_ag".
resultbooleanIndicates whether the subscription or unsubscription was successful: true, false.
channelStringSpecifies the action performed: subscribe or unsubscribe.
pairCodeStringBase currency of the instrument, i.e., BTC
dataJsonData object, containing the following fields:
-agRecordIdLongMagnum Gold ID
-updateDateLongUpdate time (timestamp)
-backAmountBigDecimalOverdue amount
-currentAmountBigDecimalRemaining amount
-remarkStringRemark
-userIdLongUser ID
-totalAmountBigDecimalTotal amount of Mega Coupon
-createdDateLongCreation time (timestamp)
-kycIntegerAdvanced KYC requirement:
1: yes,
0: no
-assetsOutBigDecimalWhether the transferred assets are invalid:
1: yes,
0: no
-startTimeLongValidity start time (timestamp)
-endTimeLongValidity expiration date (timestamp)
-statusIntegerStatus:
0: Pending,
1: Unused,
2: Used,
3: Expired,
4: Issuance failed

Subscription Example

The following Python code shows how to subscribe to Mega Coupon using Websocket.

Note: For a complete code example, please refer to Introduction > Authentication & Code Snippet > Futures > Websocket Private Interface.

url = "wss://ws.futurescw.com/perpum"
subscription_payload = {"event": "sub",
"params": {"biz": "futures",
"type": "assets_ag"}}
api_key= "your_api_key"
sec_key = "your_sec_key"

FuturesWebsocketPrivate(url, api_key, sec_key, subscription_payload) # function FuturesWebsocketPrivate() is defined in section (Introduction > Authentication & Code Snippet > Futures > Websocket Private Interface)

Note: For a complete Java code example, please refer to Introduction > Authentication & Code Snippet > Futures > Websocket Private Interface.

Response Example

The following is an example response returned by the above Python subscription, it keeps updatating in real-time:

{'event': 'sub', 'params': {'biz': 'futures', 'type': 'assets_ag'}}
{'biz': 'futures',
'data': [{'agRecordId': 475,
'updateDate': 1713192123887,
'backAmount': 0,
'currentAmount': 11,
'remark': '',
'userId': 600001274,
'totalAmount': 11,
'createdDate': 1713192123887,
'kyc': 1,
'assetsOut': 1,
'startTime': 1713192110000,
'endTime': 1713278512000,
'status': 1}],
'type': 'assets_ag'}.........