> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mobula.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Funding Rate

> Fetches the latest CeFi funding rate for a given symbol on a specified exchange. This can be queried via REST or WebSocket.

### Query Details

Fetches the latest CeFi funding rate for a given symbol.

* If no exchange is provided, the endpoint returns the rate from all supported CeFi exchanges by default (`binance`, `bybit`, `hyperliquid`, `deribit`, `okx`, `gate`, `lighter`, `kucoin`, `mexc`, `bitget`, `kraken`, `coinbase`).
* You can specify one or more exchanges by separating them with commas.

> **Note on Gate.io:**\
> Uses `usdt` as the settle currency. Contracts are in format `SYMBOL_USDT` (e.g., `BTC_USDT`).

> **Note on Lighter:**\
> Funding rate sign convention - positive rate means longs pay shorts, negative rate means shorts pay longs. Epoch duration is 1 hour.

> **Note on Bitget:**\
> `quote` selects the contract type - `USDT` → `usdt-futures` (ticker `ETHUSDT`), `USDC` → `usdc-futures` (ticker `ETHPERP`), `USD` → coin-margined `coin-futures`. Defaults to `USDT`.

> **Note on Hyperliquid (DEX - HIP3):**\
> Funding rates from **Hyperliquid DEX** are available **exclusively** for HIP3 instruments.
>
> * **Symbol prefix:** You can prefix the symbol with `dex:` (e.g., `dex:BTC`) or use the **protocol** query parameter.
> * **Protocol parameter:** Use `protocol` with one of `xyz`, `flx`, `vntl`, `hyna`, `km`, `cash` to request funding for that protocol (e.g. `?symbol=BTC&protocol=xyz` → `xyz:BTC`). If omitted, standard behaviour applies (no prefix unless symbol contains `:` or is a stock-like symbol like `XYZ100` which defaults to `xyz`).
> * For custom HIP3 perpetuals such as `XYZ100`, you can use `symbol=dex:XYZ100` or `symbol=XYZ100&protocol=xyz`.\
>   This keeps the existing `dex:` and stock-like prefix behaviour; `protocol` is an alternative way to set the prefix for Hyperliquid only.

### Query Parameters

| Parameter | Type   | Required | Description                                                                                                                                                                                   |
| --------- | ------ | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| symbol    | string | Yes      | The trading pair symbol (e.g., BTC)                                                                                                                                                           |
| quote     | string | No       | Optional quote currency (e.g., USDT)                                                                                                                                                          |
| exchange  | string | No       | Optional CeFi exchanges, comma-separated (`binance,bybit,deribit,okx,hyperliquid,gate,lighter,kucoin,mexc,bitget,kraken,coinbase`)                                                            |
| protocol  | string | No       | Optional. **Hyperliquid only.** One of `xyz`, `flx`, `vntl`, `hyna`, `km`, `cash`. When set, used as symbol prefix (e.g. `protocol=xyz` → `xyz:BTC`). Default is normal (no protocol prefix). |

### Step-by-Step Tutorial and Video Walkthrough

* Check out the guide: [Here](https://docs.mobula.io/guides/how-to-fetch-cefi-funding-rates)

### Usage Examples

1. #### REST

* Query by `symbol` with default `exchange` (all supported):

```bash theme={null}
curl -X GET "https://demo-api.mobula.io/api/1/market/cefi/funding-rate?symbol=BTC"
```

-Query by `symbol` with specific `exchange`:

```bash theme={null}
curl -X GET "https://demo-api.mobula.io/api/1/market/cefi/funding-rate?symbol=BTC&exchange=deribit"
```

* Query by `symbol` with mulitple `exchange`:

```bash theme={null}
curl -X GET "https://demo-api.mobula.io/api/1/market/cefi/funding-rate?symbol=ETH&exchange=deribit,binance"
```

* Query by `symbol` with `quote` and multiple `exchange`:

```bash theme={null}
curl -X GET "https://demo-api.mobula.io/api/1/market/cefi/funding-rate?exchange=deribit,binance&symbol=ETH&quote=USDC"
```

* Query Hyperliquid with `protocol` (e.g. xyz:BTC):

```bash theme={null}
curl -X GET "https://demo-api.mobula.io/api/1/market/cefi/funding-rate?symbol=BTC&exchange=hyperliquid&protocol=xyz"
```

2. #### WebSocket Access

You can also access funding rates via WSS.\
[View more details →](/indexing-stream/stream/websocket/wss-funding)

* **Endpoint:** `wss://api.mobula.io`
* **Payload example:**

```json theme={null}
{
  "type": "funding",
  "authorization": "api-key",
  "payload": {
    "symbol": "BTC",
    "quote" : "USDT",
    "exchange": "deribit,binance,okx,lighter",
    "subscriptionTracking": "true"
  }
}
```

* **With Hyperliquid protocol** (e.g. cash:HOOD): add `"protocol": "cash"` in the payload when using `exchange: "hyperliquid"`. Supported: `xyz`, `flx`, `vntl`, `hyna`, `km`, `cash`.


## OpenAPI

````yaml get /1/market/cefi/funding-rate
openapi: 3.0.0
info:
  version: 1.0.0
  title: Mobula API
  description: >-
    Documentation of the Mobula API


    **Demo API**: The default server (demo-api.mobula.io) is a demo API with
    rate limits.

    For production use, please use api.mobula.io with an API key from
    https://admin.mobula.io
servers:
  - url: https://demo-api.mobula.io/api/
    description: Demo API (rate limited, for testing only)
  - url: https://api.mobula.io/api/
    description: Production API (requires API key)
security: []
tags:
  - name: V2 - Token
    description: Token details, price, security, ATH, and holder data
  - name: V2 - Market Data
    description: Market details, OHLCV history, and lighthouse metrics
  - name: V2 - Trades
    description: Token trades, enriched trades, and trade filters
  - name: V2 - Wallet
    description: Wallet positions, activity, trades, analysis, and labels
  - name: V2 - Assets
    description: Cross-chain asset details and price history
  - name: V2 - Swap
    description: Swap quoting and execution
  - name: V2 - Perps
    description: Perpetual futures quoting, execution, and positions
  - name: V2 - Bridge
    description: Cross-chain bridge quoting and intent status (Alpha Preview)
  - name: V2 - DeFi
    description: Bonding pools and pulse data
  - name: V2 - Search
    description: Universal fast search
  - name: V2 - Blockchains
    description: System metadata and chain listings
  - name: V1 - Market Data
    description: Market prices, history, sparklines, pairs, and multi-data
  - name: V1 - Wallet
    description: Wallet portfolio, transactions, history, and NFTs
  - name: V1 - Token
    description: First buyers
  - name: V1 - Trades
    description: Market trades by pair
  - name: V1 - Metadata
    description: Token metadata, categories, trendings, and news
  - name: V1 - Assets
    description: List all assets
  - name: V1 - Search
    description: Search for assets, tokens, and pairs
  - name: V1 - DeFi
    description: Bonding pool pulse data
  - name: V1 - Blockchains
    description: Blockchain listings, pairs, and stats
  - name: V1 - Webhooks
    description: Webhook management
  - name: V1 - Feed
    description: Custom feed creation
paths:
  /1/market/cefi/funding-rate:
    get:
      tags:
        - V1 - Market Data
      summary: Get funding rate
      parameters:
        - schema:
            type: string
          required: true
          name: symbol
          in: query
        - schema:
            type: string
          required: false
          name: quote
          in: query
        - schema:
            type: string
          required: false
          name: exchange
          in: query
        - schema:
            type: string
            enum:
              - xyz
              - flx
              - vntl
              - hyna
              - km
              - cash
          required: false
          name: protocol
          in: query
      responses:
        '200':
          description: Funding rate response
          content:
            application/json:
              schema:
                type: object
                properties:
                  binanceFundingRate:
                    type: object
                    properties:
                      symbol:
                        type: string
                      fundingTime:
                        type: number
                      fundingRate:
                        type: number
                      marketPrice:
                        type: string
                      epochDurationMs:
                        type: number
                    required:
                      - symbol
                      - fundingTime
                      - fundingRate
                      - marketPrice
                      - epochDurationMs
                  deribitFundingRate:
                    type: object
                    properties:
                      symbol:
                        type: string
                      fundingTime:
                        type: number
                      fundingRate:
                        type: number
                      marketPrice:
                        type: number
                      epochDurationMs:
                        type: number
                    required:
                      - symbol
                      - fundingTime
                      - fundingRate
                      - marketPrice
                      - epochDurationMs
                  bybitFundingRate:
                    type: object
                    properties:
                      symbol:
                        type: string
                      fundingTime:
                        type: number
                      fundingRate:
                        type: number
                      epochDurationMs:
                        type: number
                    required:
                      - symbol
                      - fundingTime
                      - fundingRate
                      - epochDurationMs
                  okxFundingRate:
                    type: object
                    properties:
                      symbol:
                        type: string
                      fundingTime:
                        type: number
                      fundingRate:
                        type: number
                      epochDurationMs:
                        type: number
                    required:
                      - symbol
                      - fundingTime
                      - fundingRate
                      - epochDurationMs
                  hyperliquidFundingRate:
                    anyOf:
                      - type: object
                        properties:
                          symbol:
                            type: string
                          fundingTime:
                            type: number
                          fundingRate:
                            type: number
                          epochDurationMs:
                            type: number
                        required:
                          - symbol
                          - fundingTime
                          - fundingRate
                          - epochDurationMs
                      - type: array
                        items:
                          type: object
                          properties:
                            symbol:
                              type: string
                            fundingTime:
                              type: number
                            fundingRate:
                              type: number
                            marketPrice:
                              type: number
                              nullable: true
                            epochDurationMs:
                              type: number
                          required:
                            - symbol
                            - fundingTime
                            - fundingRate
                            - epochDurationMs
                  gateFundingRate:
                    type: object
                    properties:
                      symbol:
                        type: string
                      fundingTime:
                        type: number
                      fundingRate:
                        type: number
                      epochDurationMs:
                        type: number
                    required:
                      - symbol
                      - fundingTime
                      - fundingRate
                      - epochDurationMs
                  lighterFundingRate:
                    type: object
                    properties:
                      symbol:
                        type: string
                      fundingTime:
                        type: number
                      fundingRate:
                        type: number
                      epochDurationMs:
                        type: number
                    required:
                      - symbol
                      - fundingTime
                      - fundingRate
                      - epochDurationMs
                  queryDetails:
                    type: object
                    properties:
                      base:
                        type: string
                      quote:
                        type: string
                        nullable: true
                    required:
                      - base
                      - quote
                required:
                  - queryDetails

````