Skip to content

LeoYeAI/agent-master-skills / skills/arbiscan-skill

arbiscan

Verified

Comprehensive crypto market scanner across Binance, OKX, Bybit, and Bitget. 12 scan types covering arbitrage (funding rate, basis, spot spread, futures spread), market monitoring (open interest, price movers, volume anomaly, stablecoin depeg, funding extreme), and trading signals (funding trend, long/short ratio, new listing detection). Read-only — no trading, no API keys needed.

scripts/funding_history.py

View on GitHub
"""资金费率历史趋势 — 找持续同方向费率的稳定套利机会"""

from config import TOP_SYMBOLS, EXCHANGES
from fetcher import fetch_funding_history
from formatter import format_output


def scan_funding_history(symbols: list = None, min_streak: int = 5) -> tuple:
    """扫描资金费率历史趋势,找连续同方向的币种"""
    if symbols is None:
        symbols = TOP_SYMBOLS[:30]  # 历史费率查询较慢,默认 Top 30

    headers = ["Symbol", "Exchange", "Streak", "Direction", "Avg Rate", "Est. APY%", "Stability"]
    rows = []

    print(f"[Funding History] 扫描 {len(symbols)} 个交易对...")
    for symbol in symbols:
        for exchange in ["binance", "bybit", "okx"]:
            rates = fetch_funding_history(exchange, symbol, limit=20)
            if len(rates) < min_streak:
                continue

            # 计算连续同方向的长度
            streak = 1
            direction = "POSITIVE" if rates[0] > 0 else "NEGATIVE"
            for i in range(1, len(rates)):
                if (rates[i] > 0) == (rates[0] > 0):
                    streak += 1
                else:
                    break

            if streak < min_streak:
                continue

            avg_rate = sum(rates[:streak]) / streak
            interval = EXCHANGES[exchange]["funding_interval_hours"]
            apy = avg_rate * (365 * 24 / interval) * 100

            if streak >= 15:
                stability = "VERY STABLE"
            elif streak >= 10:
                stability = "STABLE"
            else:
                stability = "EMERGING"

            rows.append([
                f"{symbol}USDT",
                EXCHANGES[exchange]["name"],
                f"{streak} periods",
                direction,
                f"{avg_rate*100:.4f}%",
                f"{apy:.1f}%",
                stability,
            ])

    rows.sort(key=lambda r: int(r[2].split()[0]), reverse=True)
    return rows, headers


def main():
    import argparse
    parser = argparse.ArgumentParser(description="Funding Rate History Trend")
    parser.add_argument("--format", choices=["table", "markdown", "json"], default="table")
    parser.add_argument("--min-streak", type=int, default=5, help="最小连续期数")
    args = parser.parse_args()

    rows, headers = scan_funding_history(min_streak=args.min_streak)
    print(f"\n{'='*80}")
    print("  Funding Rate History Trend")
    print(f"{'='*80}")
    print(format_output(rows, headers, args.format))
    print(f"\nFound {len(rows)} trending symbols")


if __name__ == "__main__":
    main()
receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementationStars: 322kUpdated Claude CodeCodexVerifiedInstall
requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirementsStars: 322kUpdated Claude CodeCodexVerifiedInstall
using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallbackStars: 322kUpdated Claude CodeCodexVerifiedInstall
verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions alwaysStars: 322kUpdated Claude CodeCodexVerifiedInstall