Hyperliquid Funding Rate History API: Complete Guide
Funding rates are one of the core pricing mechanisms in perpetual futures markets. They directly affect the cost of holding long or short positions. For quant researchers, funding arbitrage traders, and risk teams, being able to pull historical funding rate data quickly and in bulk is a basic requirement.
github.com docs provides open market data endpoints that do not require an API key. This guide explains how to use the official Hyperliquid API to retrieve funding rate history, with Python examples you can adapt for research, backtesting, and monitoring.
Key comparison table
Why historical funding rate data matters
Historical funding rates are useful for several common workflows:
- Identifying markets that have been structurally long- or short-biased over time
- Estimating the historical expected return of funding arbitrage strategies
- Building funding-rate factors for quantitative asset selection or position sizing
- Backtesting spot-perp hedge strategies across different funding environments
Hyperliquid is built around an on-chain order book architecture, with trading and settlement data verifiable on-chain. That gives historical market data a relatively high level of transparency compared with opaque off-chain venues.
Hyperliquid API basics
Hyperliquid provides two main categories of endpoints:
- Info Endpoint: read-only queries for market data, account state, and historical records. No signature required.
- Exchange Endpoint: write operations such as placing or cancelling orders. These require wallet signatures.
Funding rate history is a read-only query, so it uses the Info Endpoint:
POST https://api.hyperliquid.xyz/info
All requests are sent as POST requests with a JSON body and Content-Type: application/json.
Request format for funding rate history
To retrieve funding rate history for a specific market, use the fundingHistory request type:
{
"type": "fundingHistory",
"coin": "BTC",
"startTime": 1700000000000,
"endTime": 1700086400000
}
Field notes:
coin: the market symbol, such asBTC,ETH, orSOLstartTime: Unix timestamp in millisecondsendTime: Unix timestamp in milliseconds
Timestamps must be in milliseconds. If endTime is omitted, the API returns data from startTime until the present, subject to the endpoint’s response limits.
Response format
The endpoint returns an array of records. Each record typically includes:
[
{
"coin": "BTC",
"fundingRate": "0.0001",
"premium": "0.00012",
"time": 1700000000000
}
]
Hyperliquid funding is settled hourly. For the exact mechanism, refer to the Perpetuals section of the official Hyperliquid docs.
Full Python example
The following example pulls the last 30 days of BTC funding rate history and calculates a simple annualized funding rate:
import requests
import time
import pandas as pd
ENDPOINT = "https://api.hyperliquid.xyz/info"
def get_funding_history(coin: str, days: int = 30) -> pd.DataFrame:
end_ms = int(time.time() * 1000)
start_ms = end_ms - days * 24 * 3600 * 1000
payload = {
"type": "fundingHistory",
"coin": coin,
"startTime": start_ms,
"endTime": end_ms,
}
resp = requests.post(ENDPOINT, json=payload, timeout=15)
resp.raise_for_status()
data = resp.json()
df = pd.DataFrame(data)
df["time"] = pd.to_datetime(df["time"], unit="ms", utc=True)
df["fundingRate"] = df["fundingRate"].astype(float)
df["annualized"] = df["fundingRate"] * 24 * 365 # hourly settlement
return df.sort_values("time")
if __name__ == "__main__":
df = get_funding_history("BTC", days=30)
print(df.tail(10).to_string(index=False))
print(f"\n30-day average annualized funding rate: {df['annualized'].mean():.2%}")
Note: this annualization is a simple linear extrapolation. Real results can differ due to compounding, execution price, slippage, borrow costs, margin requirements, and changes in funding behavior.
Pulling funding rates for multiple markets
If you need funding data across multiple coins, you can call the endpoint concurrently:
import concurrent.futures
import pandas as pd
COINS = ["BTC", "ETH", "SOL", "ARB", "DOGE"]
with concurrent.futures.ThreadPoolExecutor(max_workers=5) as executor:
futures = {executor.submit(get_funding_history, c, 7): c for c in COINS}
results = {}
for future in concurrent.futures.as_completed(futures):
coin = futures[future]
results[coin] = future.result()
combined = pd.concat(results.values(), ignore_index=True)
pivot = combined.pivot_table(
index="time",
columns="coin",
values="fundingRate",
aggfunc="mean",
)
This gives you a time-series matrix that can be useful for ranking markets by funding, comparing regimes, or building a funding dashboard.
Data storage recommendations
For frequent research or production use, cache the data locally instead of repeatedly requesting the same historical ranges. SQLite is enough for lightweight workflows, while TimescaleDB or another time-series database may be better for larger datasets.
Example with SQLite:
import sqlite3
conn = sqlite3.connect("funding_rates.db")
df.to_sql("funding_history", conn, if_exists="append", index=False)
conn.close()
Hyperliquid also provides an official Python SDK on GitHub. It is especially useful if your application needs both market-data queries and signed trading operations.
Managing Hyperliquid assets with OneKey
Data analysis is only one part of the workflow. If you trade perps or manage collateral, wallet security matters just as much as strategy design.
OneKey hardware wallets support connecting to Hyperliquid while keeping private keys stored offline on the device. This helps reduce the risk of asset loss from leaked API keys, phishing pages, or compromised browser environments.
When your analysis points to a potential funding arbitrage or spot-perp hedge setup, you can use OneKey Perps as a practical workflow for accessing Hyperliquid with hardware-level private key protection and a smoother perpetuals trading experience.
Download OneKey and try OneKey Perps to build a safer, data-driven perps workflow.
FAQ
Q1: Do I need a Hyperliquid account to use the funding rate API?
No. The Info Endpoint is public and does not require an API key, account registration, or wallet signature. Anyone can query historical funding rate data directly.
Q2: How many records can one request return?
The official Hyperliquid docs does not clearly specify a fixed maximum for this query. In practice, requests over long time ranges may be truncated. It is safer to query in smaller windows, such as seven days at a time, and implement pagination or range-splitting logic in your code.
Q3: What does a positive or negative funding rate mean?
When funding is positive, longs pay shorts. When funding is negative, shorts pay longs. In bullish or high-risk-appetite markets, positive funding tends to be more common because perp prices often trade at a premium to spot or index prices.
Q4: How can historical funding rates help evaluate arbitrage opportunities?
A common approach is to calculate the historical mean, standard deviation, and percentiles of funding rates. If the current funding rate is significantly above its historical average, for example more than one standard deviation higher, a hedged short-perp and long-spot strategy may appear attractive in theory. This is not financial advice, and real execution costs and risks can materially change the outcome.
Q5: What is the difference between premium and fundingRate?
premium reflects the real-time premium between the mark price and the spot index price. It is one of the key inputs used to calculate the next funding rate.
fundingRate is the settled funding rate for the period. It is determined by the premium component and the interest-rate baseline used by the protocol.
Risk warning
This article is for technical education only and does not constitute investment, trading, legal, or financial advice. Perpetual futures are high-risk products. Historical funding rates do not predict or guarantee future returns. Always understand the risks, test carefully, and make independent decisions.



