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/spot_spread.py

View on GitHub
"""跨所现货价差扫描 — best_bid vs best_ask 跨交易所比较"""

from itertools import combinations
from config import TOP_SYMBOLS, EXCHANGES
from fetcher import fetch_all_spot_tickers
from formatter import format_output, risk_level


def scan_spot_spread(symbols: list = None, min_spread_pct: float = 0.02) -> tuple:
    """
    扫描跨所现货价差套利机会
    返回 (rows, headers)
    """
    if symbols is None:
        symbols = TOP_SYMBOLS

    headers = ["Symbol", "Buy From", "Sell To", "Buy Ask", "Sell Bid", "Spread%", "Risk"]
    rows = []

    print(f"[Spot Spread] 扫描 {len(symbols)} 个交易对...")
    for symbol in symbols:
        tickers = fetch_all_spot_tickers(symbol)
        if len(tickers) < 2:
            continue

        # 两两比较
        for ex_a, ex_b in combinations(tickers.keys(), 2):
            a, b = tickers[ex_a], tickers[ex_b]

            # 方向1: 在 A 买(ask),在 B 卖(bid)
            if b["bid"] > a["ask"] and a["ask"] > 0:
                spread_pct = (b["bid"] - a["ask"]) / a["ask"] * 100
                if spread_pct >= min_spread_pct:
                    risk = risk_level(spread_pct * 365, symbol)
                    rows.append([
                        f"{symbol}USDT",
                        f"{EXCHANGES[ex_a]['name']} ${a['ask']:.4f}",
                        f"{EXCHANGES[ex_b]['name']} ${b['bid']:.4f}",
                        f"${a['ask']:.4f}",
                        f"${b['bid']:.4f}",
                        f"{spread_pct:.4f}%",
                        risk,
                    ])

            # 方向2: 在 B 买(ask),在 A 卖(bid)
            if a["bid"] > b["ask"] and b["ask"] > 0:
                spread_pct = (a["bid"] - b["ask"]) / b["ask"] * 100
                if spread_pct >= min_spread_pct:
                    risk = risk_level(spread_pct * 365, symbol)
                    rows.append([
                        f"{symbol}USDT",
                        f"{EXCHANGES[ex_b]['name']} ${b['ask']:.4f}",
                        f"{EXCHANGES[ex_a]['name']} ${a['bid']:.4f}",
                        f"${b['ask']:.4f}",
                        f"${a['bid']:.4f}",
                        f"{spread_pct:.4f}%",
                        risk,
                    ])

    rows.sort(key=lambda r: float(r[5].rstrip('%')), reverse=True)
    return rows, headers


def main():
    import argparse
    parser = argparse.ArgumentParser(description="Cross-Exchange Spot Spread Scanner")
    parser.add_argument("--format", choices=["table", "markdown", "json"], default="table")
    args = parser.parse_args()

    rows, headers = scan_spot_spread()
    print(f"\n{'='*80}")
    print("  Cross-Exchange Spot Spread")
    print(f"{'='*80}")
    print(format_output(rows, headers, args.format))
    print(f"\nFound {len(rows)} opportunities")


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