Subscribe Funding Fee Rate
API Description
This websocket allows querying the real-time funding fee rate for a specified trading instrument.
Note: Funding Fee Rate data is available via both Resful and Websocket APIs. This page describes the Websocket API. For information on the RESTful API, please click here
Precautions
- The RESTful API provides funding rate information from the last settlement. However, Websocket API and webpage delivers real-time funding rate updates.
Authentication
This is a public websocket and does not require authentication. For details on using the Websocket API, please refer to Introduction > Authentication & Code Snippet > Futures > Websocket Public Interface.
Websocket URL
Frequency Limit
None
Subscription Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| event | true | String | Subscribe or unsubscribe. sub: subscribe; unsub: unsubscribe. Note: This parameter is case-sensitive. |
| params | true | Json | Requested parameter objects including: |
| -biz | true | String | Specifies the channel, e.g., "futures" Note: Lowercase is recommended. |
| -type | true | String | Defines the function type, e.g., "funding_rate" Note: Lowercase is recommended. |
| -pairCode | true | String | The base currency of the instrument. (e.g., BTC or btc). This parameter is case-insensitive. Note: For instruments that start with numbers (e.g., 1000PEPE), both uppercase and lowercase formats are valid. |
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| biz | String | Specifies the channel, e.g., 'futures". |
| type | String | Defines the function type, e.g., "funding_rate" |
| result | boolean | Indicates whether the subscription or unsubscription was successful: true, false. |
| channel | String | Specifies the action performed: subscribe or unsubscribe. |
| pairCode | String | Base currency of the instrument, e.g., BTC. |
| data | Json | Data object, containing the following fields: |
| -r | big Decimal | Funding fee rate |
| -nt | Long | Timestamp (unix) |
| -n | string | Base currency of the instrument, e.g., btc |
Subscription Example
The following Python code shows how to subscribe to funding fee rate for "BTC".
Note: For a complete code example, please refer to Introduction > Authentication & Code Snippet > Futures > Websocket Public Interface.
subscription_params = { "event": "sub",
"params": {
"biz": "futures",
"pairCode": "BTC",
"type": "funding_rate"}}
url = "wss://ws.futurescw.com/perpum"
FuturesWebsocketPublic(url, subscription_params) #function FuturesWebsocketPublic() is defined in section (Introduction > Authentication & Code Snippet > Futures > Websocket Public Interface)
Note: For a complete Java code example, please refer to Introduction > Authentication & Code Snippet > Futures > Websocket Public Interface.
Response Example
The Websocket subscription will keep updating the funding fee rate in real-time. For brevity, only the initial response for python subscrption is provided below:
{'biz': 'futures',
'pairCode': 'BTC',
'data': {'result': True},
'channel': 'subscribe',
'type': 'funding_rate'}
{'biz': 'futures',
'pairCode': 'btc',
'data': {'r': 4.926e-05, 'nt': 1745490090000, 'n': 'btc'},
'type': 'funding_rate'},.....