funding-rate-arbitrage

funding-rate-arbitrage is a skill for Claude Code from Superior-Trade/superior-skills. It costs 79 tokens per session (2,100 once invoked), scanned A, original, MIT.

A cryptocurrency trading strategy that seeks funding payments from perpetual contracts. A perpetual contract is a trade that has no expiry date, and its funding rate is a recurring payment between long and short traders.

In plain words
What is it for?
Use it to write, backtest, or deploy funding-rate carry and arbitrage strategies on Superior Trade. It supports examples such as going long when shorts pay longs or short when longs pay shorts.
Why use it?
It provides rules for choosing the side that receives funding when the rate is strongly positive or negative. It also lets the strategy use funding-rate data during backtesting without requiring a separate exchange request inside the strategy.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the superior-skills plugin — 31 skills shipped together

Good fit Use it to write, backtest, or deploy funding-rate carry and arbitrage strategies on Superior Trade. It supports examples such as going long when shorts pay longs or short when longs pay shorts.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/superior-trade/superior-skills/funding-rate-arbitrage
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add Superior-Trade/superior-skills --skill funding-rate-arbitrage
Clone the repo
git clone --depth 1 https://github.com/Superior-Trade/superior-skills

Made for: Claude Code.

Or install superior-skills, the plugin that ships this one along with the rest of its 31 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for funding-rate-arbitrage

README.md
[![agentmods](https://agentmods.dev/badge/skills/superior-trade/superior-skills/funding-rate-arbitrage/github.svg)](https://agentmods.dev/skills/superior-trade/superior-skills/funding-rate-arbitrage)
Your own site
<a href="https://agentmods.dev/skills/superior-trade/superior-skills/funding-rate-arbitrage"><img src="https://agentmods.dev/badge/skills/superior-trade/superior-skills/funding-rate-arbitrage/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for funding-rate-arbitrage

Your own site · 80×15
<a href="https://agentmods.dev/skills/superior-trade/superior-skills/funding-rate-arbitrage"><img src="https://agentmods.dev/badge/skills/superior-trade/superior-skills/funding-rate-arbitrage.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 79 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,100 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00079 $0.02100
Opus 5 $0.00039 $0.01050
Sonnet 5 $0.00016 $0.00420
Haiku 4.5 $0.00008 $0.00210

Measured 13d ago against content hash 09161c4a56ce, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

funding-rate-arbitrage scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 13d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/funding-rate-arbitrage/SKILL.md · 165 lines

How it starts

The opening of the file, as written. The whole thing — 165 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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)

Window BTC/USDC:USDC 1h, 2026-01-01 → 2026-05-01 (BTC −13% over the window)
Trades 55
Win rate 58.2%
Wallet PnL +1.38% / +$13.76
Profit factor 1.57
Sharpe 1.52
Max drawdown 0.58%
Avg holding 9h 40m
Backtest ID 01kqyz3ejgy5b7tdemhb6gj9nf

~+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:

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

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

Read the full file on GitHub · 165 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 13d ago First seen · 165 lines · 79 tokens per session scan A 09161c4a56ce

Subscribe to this mod's changes

funding-rate-arbitrage is a skill published in the GitHub repository Superior-Trade/superior-skills (209 stars, last pushed 2d ago), licensed MIT. It adds 79 tokens to every session and 2,100 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.