# Crypto Funding Rate API - Binance/Bybit/OKX Perpetuals (`gochujang/cex-funding-aggregator`) Actor

Aggregate USDT perpetual funding rates across Binance, Bybit, and OKX. Annualized APR per venue, cross-venue spread for carry-trade signals, top-N by volume auto-detect. Telegram alerts on funding extremes.

- **URL**: https://apify.com/gochujang/cex-funding-aggregator.md
- **Developed by:** [Hojun Lee](https://apify.com/gochujang) (community)
- **Categories:** Developer tools, Automation, Other
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

$2.00 / 1,000 symbol trackeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## CEX Funding Rate Aggregator

> Aggregate perpetual swap funding rates across **Binance**, **Bybit**, and **OKX** in one call. Spot funding extremes, cross-venue spreads, and carry-trade signals. No API key required.

---

### What It Does

Pulls live funding rates for USDT perpetual swaps from the three largest crypto derivatives venues and normalizes them to annualized percentages (APR). Use it to:

- Find symbols with extreme funding (over-leveraged longs or shorts)
- Detect cross-venue funding spreads (cash-and-carry arbitrage)
- Time market-tops/bottoms — extreme positive funding often precedes squeezes
- Get Telegram alerts when any symbol's |funding APR| crosses your threshold

---

### Why Funding Rates Matter

Perpetual futures don't expire — instead they use **funding** to anchor the perp price to the spot index. Every 8 hours, one side pays the other:

- **Positive funding** → longs pay shorts → market is long-skewed (often bullish-positioned, sometimes overextended)
- **Negative funding** → shorts pay longs → market is short-skewed (often fear-driven, contrarian buy signals)

Extreme funding rates (|APR| > 50%) often signal late-stage trends or capitulation. Cross-venue spreads create cash-and-carry opportunities — long the cheaper-funded venue, short the more expensive one, collect the spread.

---

### Input

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `symbols` | string[] | `[]` | Base symbols to track (e.g. `BTC`, `ETH`). Empty = use `autoDetectTop` |
| `autoDetectTop` | integer | `50` | When `symbols` is empty, fetch top N by Binance 24h volume |
| `includeBinance` | boolean | `true` | Include Binance USDT-M perps |
| `includeBybit` | boolean | `true` | Include Bybit linear perps |
| `includeOkx` | boolean | `true` | Include OKX USDT-SWAP |
| `minAbsFundingApr` | number | `0` | Only return symbols with |funding APR| above this % |
| `sortBy` | string | `abs_funding_desc` | `abs_funding_desc`, `funding_asc`, `funding_desc`, `symbol_asc` |
| `alertAbsApr` | number | `0` | Send Telegram alert when |APR| crosses this. 0 = disabled |
| `telegramBotToken` | string (secret) | — | Telegram bot token for alerts |
| `telegramChatId` | string | — | Chat ID to receive alerts |

#### Example: Hunt for funding extremes
```json
{
  "autoDetectTop": 100,
  "minAbsFundingApr": 30,
  "sortBy": "abs_funding_desc"
}
````

#### Example: Daily Telegram alert when any major coin funding exceeds 50% APR

```json
{
  "symbols": ["BTC", "ETH", "SOL", "DOGE"],
  "alertAbsApr": 50,
  "telegramBotToken": "<bot_token>",
  "telegramChatId": "<chat_id>"
}
```

***

### Output

Each record represents one symbol across all enabled venues:

```json
{
  "symbol": "BTC",
  "binance_funding_apr_pct": 10.95,
  "bybit_funding_apr_pct": 11.20,
  "okx_funding_apr_pct": 9.80,
  "max_abs_funding_apr_pct": 11.20,
  "venue_spread_apr_pct": 1.40,
  "binance_mark_price": 95423.5,
  "bybit_mark_price": 95420.1,
  "next_funding_time": "2026-06-02T16:00:00+00:00",
  "exchanges_present": 3,
  "timestamp": "2026-06-02T11:42:18+00:00"
}
```

| Field | Description |
|-------|-------------|
| `*_funding_apr_pct` | Funding rate annualized (`rate × 3 × 365 × 100`) |
| `max_abs_funding_apr_pct` | Largest |APR| across all venues — main filter/sort key |
| `venue_spread_apr_pct` | Highest-APR venue minus lowest-APR venue — carry-trade spread |
| `exchanges_present` | How many venues returned data for this symbol (1–3) |
| `next_funding_time` | UTC ISO of next 8h funding settlement |

***

### Pricing

Pay-Per-Event (PPE):

- **$0.002 per symbol returned**

Examples:

- Top 50 symbols: **$0.10**
- Full top-300 sweep: **$0.60**

***

### Use Cases

**Carry-trade scanner** — Run hourly to find the largest cross-venue funding spreads:

```bash
curl -X POST "https://api.apify.com/v2/acts/gochujang~cex-funding-aggregator/runs?token=YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"autoDetectTop": 200, "minAbsFundingApr": 20}'
```

**Squeeze early warning** — Alert when funding goes parabolic on any major:

```json
{
  "symbols": ["BTC", "ETH", "SOL"],
  "alertAbsApr": 80,
  "telegramBotToken": "<token>",
  "telegramChatId": "<chat>"
}
```

***

### Data Sources

- Binance USDT-M Futures: `/fapi/v1/premiumIndex`
- Bybit Linear: `/v5/market/tickers?category=linear`
- OKX SWAP: `/api/v5/public/funding-rate`

All endpoints are public, no API keys required, no rate-limit risk at single-actor scale.

***

### Related Actors

Build a complete crypto edge with these actors from the same author:

- **[Smart Money Wallet Tracker](https://apify.com/gochujang/smart-money-tracker)** — Track 238 smart wallets to see what they're buying before APYs spike.
- **[Kimchi Premium Tracker](https://apify.com/gochujang/kimchi-premium-tracker)** — Korean exchange arbitrage signals across Upbit, Bithumb, Coinone, Korbit.
- **[DeFi Yield Scanner](https://apify.com/gochujang/defi-yield-scanner)** — Best APY across 17,000+ DeFi pools.

***

### Feedback

If this Actor saves you time, a quick review helps others find it: [Leave a review on Apify Store](https://apify.com/gochujang/cex-funding-aggregator#reviews)

# Actor input Schema

## `symbols` (type: `array`):

Base symbols to track (e.g., BTC, ETH, SOL). Leave empty to auto-detect top tokens by Binance volume.

## `autoDetectTop` (type: `integer`):

If symbols list is empty, fetch this many top-volume Binance perps. Set 0 to require explicit symbols.

## `includeBinance` (type: `boolean`):

Include Binance USDT-M perpetual funding rates.

## `includeBybit` (type: `boolean`):

Include Bybit linear perpetual funding rates.

## `includeOkx` (type: `boolean`):

Include OKX USDT-SWAP funding rates (one API call per symbol — slower).

## `includeBitget` (type: `boolean`):

Include Bitget USDT-FUTURES funding (bulk; some symbols use 4h intervals — APR auto-normalized).

## `includeBingx` (type: `boolean`):

Include Bingx perpetual funding (per-symbol; slower).

## `includeOpenInterest` (type: `boolean`):

Add OKX open interest in USD per symbol — useful for crowdedness context.

## `includeLongShortRatio` (type: `boolean`):

Add OKX top-trader long/short account ratio (1H period).

## `minAbsFundingApr` (type: `number`):

Only return symbols whose max abs funding rate (annualized) is above this. 0 = include all.

## `sortBy` (type: `string`):

Sort order for results.

## `alertAbsApr` (type: `number`):

Send Telegram alert when any symbol's |funding APR| exceeds this %. 0 = disabled. Requires telegramBotToken + telegramChatId.

## `telegramBotToken` (type: `string`):

Telegram bot token for funding alerts. Leave empty to disable.

## `telegramChatId` (type: `string`):

Chat ID (user or group) to receive funding alerts.

## Actor input object example

```json
{
  "symbols": [
    "BTC",
    "ETH",
    "SOL",
    "DOGE",
    "XRP"
  ],
  "autoDetectTop": 50,
  "includeBinance": true,
  "includeBybit": true,
  "includeOkx": true,
  "includeBitget": true,
  "includeBingx": true,
  "includeOpenInterest": true,
  "includeLongShortRatio": true,
  "minAbsFundingApr": 0,
  "sortBy": "abs_funding_desc",
  "alertAbsApr": 0,
  "telegramChatId": ""
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "symbols": [
        "BTC",
        "ETH",
        "SOL",
        "DOGE",
        "XRP"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("gochujang/cex-funding-aggregator").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "symbols": [
        "BTC",
        "ETH",
        "SOL",
        "DOGE",
        "XRP",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("gochujang/cex-funding-aggregator").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "symbols": [
    "BTC",
    "ETH",
    "SOL",
    "DOGE",
    "XRP"
  ]
}' |
apify call gochujang/cex-funding-aggregator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=gochujang/cex-funding-aggregator",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Crypto Funding Rate API - Binance/Bybit/OKX Perpetuals",
        "description": "Aggregate USDT perpetual funding rates across Binance, Bybit, and OKX. Annualized APR per venue, cross-venue spread for carry-trade signals, top-N by volume auto-detect. Telegram alerts on funding extremes.",
        "version": "0.1",
        "x-build-id": "4fIkFsxHBoG27vjd9"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/gochujang~cex-funding-aggregator/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-gochujang-cex-funding-aggregator",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/gochujang~cex-funding-aggregator/runs": {
            "post": {
                "operationId": "runs-sync-gochujang-cex-funding-aggregator",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/gochujang~cex-funding-aggregator/run-sync": {
            "post": {
                "operationId": "run-sync-gochujang-cex-funding-aggregator",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "symbols": {
                        "title": "Symbols",
                        "type": "array",
                        "description": "Base symbols to track (e.g., BTC, ETH, SOL). Leave empty to auto-detect top tokens by Binance volume.",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "autoDetectTop": {
                        "title": "Auto-detect Top N by Volume",
                        "minimum": 0,
                        "maximum": 300,
                        "type": "integer",
                        "description": "If symbols list is empty, fetch this many top-volume Binance perps. Set 0 to require explicit symbols.",
                        "default": 50
                    },
                    "includeBinance": {
                        "title": "Include Binance",
                        "type": "boolean",
                        "description": "Include Binance USDT-M perpetual funding rates.",
                        "default": true
                    },
                    "includeBybit": {
                        "title": "Include Bybit",
                        "type": "boolean",
                        "description": "Include Bybit linear perpetual funding rates.",
                        "default": true
                    },
                    "includeOkx": {
                        "title": "Include OKX",
                        "type": "boolean",
                        "description": "Include OKX USDT-SWAP funding rates (one API call per symbol — slower).",
                        "default": true
                    },
                    "includeBitget": {
                        "title": "Include Bitget",
                        "type": "boolean",
                        "description": "Include Bitget USDT-FUTURES funding (bulk; some symbols use 4h intervals — APR auto-normalized).",
                        "default": true
                    },
                    "includeBingx": {
                        "title": "Include Bingx",
                        "type": "boolean",
                        "description": "Include Bingx perpetual funding (per-symbol; slower).",
                        "default": true
                    },
                    "includeOpenInterest": {
                        "title": "Include Open Interest (OKX)",
                        "type": "boolean",
                        "description": "Add OKX open interest in USD per symbol — useful for crowdedness context.",
                        "default": true
                    },
                    "includeLongShortRatio": {
                        "title": "Include Long/Short Ratio (OKX)",
                        "type": "boolean",
                        "description": "Add OKX top-trader long/short account ratio (1H period).",
                        "default": true
                    },
                    "minAbsFundingApr": {
                        "title": "Min Absolute Funding APR (%)",
                        "minimum": 0,
                        "type": "number",
                        "description": "Only return symbols whose max abs funding rate (annualized) is above this. 0 = include all.",
                        "default": 0
                    },
                    "sortBy": {
                        "title": "Sort By",
                        "enum": [
                            "abs_funding_desc",
                            "funding_asc",
                            "funding_desc",
                            "oi_desc",
                            "symbol_asc"
                        ],
                        "type": "string",
                        "description": "Sort order for results.",
                        "default": "abs_funding_desc"
                    },
                    "alertAbsApr": {
                        "title": "Telegram Alert |APR| Threshold (%)",
                        "minimum": 0,
                        "type": "number",
                        "description": "Send Telegram alert when any symbol's |funding APR| exceeds this %. 0 = disabled. Requires telegramBotToken + telegramChatId.",
                        "default": 0
                    },
                    "telegramBotToken": {
                        "title": "Telegram Bot Token",
                        "type": "string",
                        "description": "Telegram bot token for funding alerts. Leave empty to disable."
                    },
                    "telegramChatId": {
                        "title": "Telegram Chat ID",
                        "type": "string",
                        "description": "Chat ID (user or group) to receive funding alerts.",
                        "default": ""
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
