We develop an automatic system for collecting funding rate of perpetual futures from leading crypto exchanges. Consider the situation: your bot misses signals due to delays in obtaining funding rate. Or you spend hours manually collecting data from different exchanges. Funding rate is a balancing mechanism: every 8 hours (on CEX) or continuously (on DEX) traders with long positions pay shorts or vice versa. For quant strategies, funding rate arbitrage, and risk management, historical funding rates and real-time data are critical — this is one of the main signals of market sentiment. Time savings on manual data collection — up to 15 hours per week, which at an average rate of $50/hour gives $750 per week, and arbitrage opportunities can yield up to 30% per annum, which in monetary terms can be up to $2000 per month. Contact us for a consultation — we will evaluate your project within one day.
Why Funding Rate Is Critical for Strategies
The annualized funding rate allows assessing the profitability of cash-and-carry arbitrage. If the annual rate exceeds 30%, the "long spot + short perp" strategy is potentially profitable after deducting fees. Our clients use this data to build arbitrage bots and monitor market anomalies. For example, during the LUNA crash, the funding rate reached -0.5% over 8 hours, signaling massive short positions. We preserve such extremes but flag them.
Typical funding rate values depending on market conditions:
| Market Condition | Typical Funding Rate (8h) |
|---|---|
| Neutral market | 0.01% – 0.05% |
| Bullish trend | 0.05% – 0.2% |
| Bearish trend | -0.05% – -0.2% |
| Extreme volatility | >0.3% or < -0.3% |
Source: Binance API documentation for perpetual futures
Which Exchanges and APIs We Use
For funding rate API access, we support the following exchanges:
| Exchange | API Type | Endpoint | Limitations | Data Period |
|---|---|---|---|---|
| Binance | REST | /fapi/v1/fundingRate |
2400 weight/min, 1000 records | Full history since listing |
| Bybit | REST | /v5/market/funding/history |
200 records per call, cursor pagination | Since exchange launch |
| OKX | REST | /api/v5/public/funding-rate-history |
100 records, time-based pagination | Full history |
| Hyperliquid | RPC | /info (POST) |
No limit | Full history |
For real-time data, we use WebSocket funding rate streams:
// Binance: current funding rate and next settlement time const ws = new WebSocket("wss://fstream.binance.com/ws/btcusdt@markPrice@1s"); ws.onmessage = (e) => { const data = JSON.parse(e.data); // data.r — current funding rate, data.T — next settlement time }; Ensuring Data Collection Continuity
To guarantee no gaps, we implement a gap detection mechanism: every N minutes we check the last record in the DB and compare it with the expected time. If the gap exceeds a threshold (e.g., 10 minutes for an 8-hour interval), a retry request is triggered. Additionally, we set up Telegram alerts when gaps are detected. This maintains the consistency of the historical archive even during temporary exchange outages. When developing the collector, we focus on gas optimization of requests to minimize API load.
How to Deploy a Collector in 4 Steps
- Analytics: determine the list of exchanges, symbols, and required history depth. Typically 5–6 exchanges and 20–30 symbols.
- Design: choose the stack — TypeScript, axios-retry, p-limit, TimescaleDB. Compared to a Python asyncio solution, our TypeScript funding rate collector with p-limit performs 2–3 times better in throughput due to concurrent requests.
- Implementation: write the collector core with retry and rate limiting using the template below.
- Testing and deployment: run historical backfill, verify data continuity, set up freshness monitoring and gap detection.
Example collector core:
import pLimit from "p-limit"; import axiosRetry from "axios-retry"; class FundingRateCollector { private readonly limit = pLimit(5); constructor(private readonly config: ExchangeConfig) { axiosRetry(this.http, { retries: 3, retryDelay: axiosRetry.exponentialDelay, retryCondition: (err) => axiosRetry.isNetworkError(err) || err.response?.status === 429 || err.response?.status >= 500, }); } async fetchHistorical(symbol: string, from: Date, to: Date): Promise<FundingRateRecord[]> { const results: FundingRateRecord[] = []; let cursor = from.getTime(); while (cursor < to.getTime()) { const batch = await this.limit(() => this.fetchBatch(symbol, cursor, to.getTime())); if (batch.length === 0) break; results.push(...batch); cursor = batch[batch.length - 1].timestamp + 1; await delay(this.config.requestDelayMs); } return results; } } Additional Configurations
For aggressive rate limiting, use p-limit with a queue: limit(() => request()). Also, you can configure retries on 429 with a delay from the Retry-After header.
Stability Guarantees
We guarantee stable operation under load. Our experience — 5+ years in crypto development and over 30 DeFi projects. Each collected record undergoes validation: funding rate rarely exceeds ±0.3% over 8 hours. Extreme values are flagged. Get a consultation — we will evaluate your project within one day.
What Is Included in the Result
- TypeScript collector source code with comments
- Docker container for deployment
- Database schema (TimescaleDB) with time-based partitioning
- Documentation for each exchange's API
- Monitoring setup (alerts on data delays)
- Training for your team on working with the system
Handling Anomalous Values
We check values exceeding ±1% — such data is flagged for manual verification. Extreme events (like the LUNA crash) are preserved as they may be significant for analysis. Additionally, we use a moving average to detect outliers.
Timelines and Cost
A typical project to integrate the collector for 6 exchanges with historical backfill takes 4 to 6 weeks. The cost is calculated individually after analyzing your requirements. Request a project assessment — get a consultation within a day.







