Funding Rate Arbitrage logo

Funding Rate Arbitrage

Organization
Superior-Trade
funding-rate-arbitrage

Use when writing a funding-rate-driven perp strategy on Superior Trade — anything described as funding harvest, funding arbitrage, funding rate carry, negative funding, paid to long, paid to short, basis trade. The strategy reads Hyperliquid hourly funding via `dp.get_pair_dataframe(candle_type="funding_rate")`, which is automatically downloaded for backtests.

Overview

PublisherSuperior-Trade
Repositorysuperior-skills
Skill namefunding-rate-arbitrage
Stars
215
Forks
9
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by Superior-Trade on GitHub. Read the source before you install it.

Installation

Install the Funding Rate Arbitrage AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/Superior-Trade/superior-skills/tree/main/skills/funding-rate-arbitrage
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Superior-Trade/superior-skills.git /tmp/superior-skills
mkdir -p .claude/skills
cp -r /tmp/superior-skills/skills/funding-rate-arbitrage .claude/skills/funding-rate-arbitrage
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Funding Rate Arbitrage in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Funding Rate Arbitrage on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Funding Rate Arbitrage is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Strategy: Funding · Negative-Rate Harvest

When to use

A user wants to capture funding payments by being on the side that gets paid:

  • Long a perp when funding APR is deeply negative (shorts paying longs).
  • Short a perp when funding APR is deeply positive (longs paying shorts) — variant below.

This is the most profitable of the six standard templates in our audit and the engine supports it natively. Promote this template when a user asks "what's a strategy that actually works?".

Backtest reference (the real one)

WindowBTC/USDC:USDC 1h, 2026-01-01 → 2026-05-01 (BTC −13% over the window)
Trades55
Win rate58.2%
Wallet PnL+1.38% / +$13.76
Profit factor1.57
Sharpe1.52
Max drawdown0.58%
Avg holding9h 40m
Backtest ID01kqyz3ejgy5b7tdemhb6gj9nf

~+4% APR on a single pair through a market that fell 13%. A multi-pair scan (e.g. top 20 perps) compounds this.

The Freqtrade primitive that makes this work

The DataProvider exposes funding-rate candles directly. No Hyperliquid REST call from inside the strategy is needed for backtest — Freqtrade auto-downloads funding history when it sees a candle_type="funding_rate" request:

python
funding = self.dp.get_pair_dataframe(
    pair=metadata["pair"],
    timeframe="1h",          # Hyperliquid funds hourly
    candle_type="funding_rate",
)

The returned dataframe has the same shape as OHLCV — date, open, high, low, close, volume — but open is the funding rate at the start of that hour, expressed as a fraction (-0.0000135 = -0.0014% per hour). Annualize as funding_rate * 24 * 365.

The naive v1 (placeholder column filled with 0.0) produced 0 trades. v2 with dp.get_pair_dataframe(...) produced 55 trades and Sharpe 1.52.

Reference implementation

python
from freqtrade.strategy import IStrategy
from datetime import datetime
import pandas as pd
import talib.abstract as ta


class FundingHarvestStrategy(IStrategy):
    minimal_roi = {"0": 100.0}   # let funding work; no profit-target exit
    stoploss = -0.05
    trailing_stop = False
    timeframe = "1h"
    process_only_new_candles = True
    startup_candle_count = 30
    can_short = False

    def populate_indicators(self, dataframe: pd.DataFrame, metadata: dict) -> pd.DataFrame:
        # Hyperliquid funds hourly — request 1h funding-rate candles.
        try:
            funding = self.dp.get_pair_dataframe(
                pair=metadata["pair"],
                timeframe="1h",
                candle_type="funding_rate",
            )
        except Exception:
            funding = pd.DataFrame()

        if not funding.empty and "open" in funding.columns:
            f = funding[["date", "open"]].rename(columns={"open": "funding_rate"}).copy()
            dataframe = dataframe.merge(f, on="date", how="left")
            dataframe["funding_rate"] = dataframe["funding_rate"].ffill().fillna(0.0)
            # Annualize hourly funding: APR = rate * 24 * 365.
            dataframe["funding_apr"] = dataframe["funding_rate"] * 24 * 365
        else:
            dataframe["funding_rate"] = 0.0
            dataframe["funding_apr"] = 0.0

        dataframe["atr_24"] = ta.ATR(dataframe, timeperiod=24)
        return dataframe

    def populate_entry_trend(self, dataframe: pd.DataFrame, metadata: dict) -> pd.DataFrame:
        # Long when funding APR is deeply negative (shorts paying longs).
        dataframe.loc[
            (dataframe["funding_apr"] < -0.10) & (dataframe["volume"] > 0),
            "enter_long",
        ] = 1
        return dataframe

    def populate_exit_trend(self, dataframe: pd.DataFrame, metadata: dict) -> pd.DataFrame:
        # Exit when funding flips back to non-negative (no more carry).
        dataframe.loc[(dataframe["funding_apr"] >= 0.0), "exit_long"] = 1
        return dataframe

    def custom_exit(self, pair: str, trade, current_time: datetime,
                    current_rate: float, current_profit: float, **kwargs):
        # Hard timeout — the entry condition was wrong if we're still in
        # after 24h without an exit signal.
        elapsed_h = (current_time - trade.open_date_utc).total_seconds() / 3600.0
        if elapsed_h >= 24:
            return "timeout_24h"
        return None

Config requirements

json
{
  "exchange": { "name": "hyperliquid", "pair_whitelist": ["BTC/USDC:USDC"] },
  "stake_currency": "USDC",
  "stake_amount": 100,
  "timeframe": "1h",
  "max_open_trades": 1,
  "stoploss": -0.05,
  "minimal_roi": { "0": 100.0 },
  "trading_mode": "futures",
  "margin_mode": "cross",
  "entry_pricing": { "price_side": "same" },
  "exit_pricing": { "price_side": "same" },
  "pairlists": [{ "method": "StaticPairList" }]
}

Pair format must be <COIN>/USDC:USDC (futures). BTC/USDC (spot) won't have funding rate data.

Tunable parameters

KnobEffect
-0.10 (entry threshold APR)Stricter (-0.20) → fewer trades, only the deepest negative funding episodes. Looser (-0.05) → more trades, lower edge per trade.
>= 0.0 (exit threshold)Stricter (>= -0.05) → exit before funding fully normalizes, lock more carry.
stoplossFunding pays slowly. A tight stop (-0.02) gets shaken out by routine volatility. -0.05 is the sweet spot from the audit.
timeout_24hMax holding. Funding episodes typically last 4–12h on majors; 24h is a safety net.

Variants

  • Short variant (positive funding harvest): set can_short = True, enter_short when funding_apr > 0.30, exit_short when funding_apr <= 0.0. Profitable when alts are paying high positive funding (squeezes).
  • Multi-pair scan: replace StaticPairList with VolumePairList filtered to top 20 perps. Loop the same logic per pair. PnL compounds.
  • Combine with delta-neutral hedge: short the spot leg while long the perp to lock pure funding yield. Requires two-account setup; outside this strategy.

Common pitfalls

  1. Spot pair instead of perp. BTC/USDC returns no funding rate — the column will be all zeros and zero trades fire. Always use BTC/USDC:USDC.
  2. Non-Hyperliquid exchange. This works on Hyperliquid because dp.get_pair_dataframe(candle_type="funding_rate") is wired up for HL. Other exchanges may return empty.
  3. No fallback for missing data. The try/except plus the dataframe.empty check matters — if funding history isn't downloaded yet, the strategy must not crash. The reference above handles both.
  4. Misreading the unit. funding_rate is per-hour (HL funds hourly). Annualizing as * 365 instead of * 24 * 365 is off by 24×.
  5. Treating Sharpe 1.52 as a forward predictor. The audit window (Jan-May 2026) had unusually negative funding episodes during BTC's drawdown. Forward results will vary; always run a fresh backtest before deploying live.

Sources

Frequently asked questions

What does the Funding Rate Arbitrage AI skill do?

Use when writing a funding-rate-driven perp strategy on Superior Trade — anything described as funding harvest, funding arbitrage, funding rate carry, negative funding, paid to long, paid to short, basis trade. The strategy reads Hyperliquid hourly funding via `dp.get_pair_dataframe(candle_type="funding_rate")`, which is automatically downloaded for backtests.

Why use Funding Rate Arbitrage on TypingMind?

Because you install it once and use it with any model. Funding Rate Arbitrage is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Funding Rate Arbitrage in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/Superior-Trade/superior-skills/tree/main/skills/funding-rate-arbitrage. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Funding Rate Arbitrage?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Funding Rate Arbitrage?

As many as you like. As long as a model supports skills, you can use Funding Rate Arbitrage with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Funding Rate Arbitrage AI skill free?

Yes. It is published on GitHub by Superior-Trade under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇