$npx -y skills add SKE-Labs/agent-trading-skills --skill arbitrage-tradingScreen execution-sensitive price differences across exchanges, pairs, spot, and derivatives. Use when evaluating synchronized spreads, triangular conversion paths, or basis trades after fees, depth, settlement, counterparty, and inventory risk.
| 1 | # Arbitrage Trading |
| 2 | |
| 3 | Identify executable price differences while assuming that every apparent spread may compensate for latency, liquidity, settlement, or venue risk. |
| 4 | |
| 5 | > **Note:** Agent can identify arbitrage opportunities via price comparison but cannot execute cross-exchange trades directly. Use this skill to detect and report opportunities. |
| 6 | |
| 7 | ## Arbitrage Types |
| 8 | |
| 9 | | Type | Mechanism | Key Cost Factor | |
| 10 | | ---------------- | ------------------------------------------ | ----------------- | |
| 11 | | Cross-Exchange | Same asset priced differently on two venues | Transfer fees | |
| 12 | | Triangular | Three-pair cycle (BTC->ETH->USDT->BTC) | Trading fees x3 | |
| 13 | | Futures-Spot | Premium between spot and perp/futures | Funding rate | |
| 14 | | DEX-CEX | Price gap between decentralized and centralized | Gas fees | |
| 15 | |
| 16 | ## Profitability Check |
| 17 | |
| 18 | **Cross-Exchange:** |
| 19 | - Gross P&L = executable sell proceeds − executable buy cost for the same quantity |
| 20 | - Net P&L = Gross P&L − fees − slippage − funding/borrow − transfer/gas − hedge and rebalancing costs |
| 21 | |
| 22 | **Triangular:** |
| 23 | - Expected cross rate = Price_A / Price_B |
| 24 | - Actual cross rate = observed market rate |
| 25 | - Spread % = (Actual - Expected) / Expected x 100 |
| 26 | |
| 27 | Require a positive buffer above estimated costs and model error; `Net Profit > 0` on stale top-of-book quotes is not sufficient. |
| 28 | |
| 29 | ## Workflow |
| 30 | |
| 31 | 1. **Fetch synchronized executable quotes** from every leg. Candle closes are a coarse screening proxy only; do not call the result actionable without bid/ask, depth, size, timestamp, and venue status. |
| 32 | ``` |
| 33 | get_candles(symbol="BTC/USD", exchange="binance", interval="5m", count=1) |
| 34 | get_candles(symbol="ETH/USD", exchange="binance", interval="5m", count=1) |
| 35 | get_candles(symbol="ETH/BTC", exchange="binance", interval="5m", count=1) |
| 36 | ``` |
| 37 | |
| 38 | 2. **Simulate the exact path** using the correct bid or ask at each leg, lot/tick rules, rounding, and available depth. |
| 39 | |
| 40 | 3. **Check carry and convergence terms** from the venue's contract specification, funding history, margin rules, and settlement index—not a news summary alone: |
| 41 | ``` |
| 42 | get_financial_news(topic="BTC funding rate perpetual futures premium") |
| 43 | ``` |
| 44 | |
| 45 | 4. **Stress all costs and failures**: one-leg fill, reject, latency, transfer halt, depeg, funding flip, liquidation, borrow recall, and exchange default. |
| 46 | |
| 47 | 5. **Report opportunity** with: pair(s), spread %, estimated fees, net profit, and time sensitivity. |
| 48 | |
| 49 | ## Triangular Arbitrage Example |
| 50 | |
| 51 | ``` |
| 52 | BTC/USDT: 50,000 | ETH/USDT: 2,000 | ETH/BTC: 0.041 |
| 53 | Expected ETH/BTC: 2000/50000 = 0.040 |
| 54 | Actual: 0.041 → ~2.5% spread (before fees) |
| 55 | Path: USDT → BTC → ETH → USDT |
| 56 | ``` |
| 57 | |
| 58 | ## Evidence and Validation |
| 59 | |
| 60 | - Treat the setup as a testable hypothesis, not a prediction. Define thresholds, entry, invalidation, and exit before evaluating outcomes. |
| 61 | - Calibrate on the same instrument, venue, session, and timeframe. Use closed candles and a held-out or walk-forward sample; record every variant tried. |
| 62 | - Include spread, fees, slippage, borrow or funding, partial fills, and latency. Reject the setup when net expectancy is not positive or depends on one narrow parameter. |
| 63 | - Return observed inputs, missing data, cost assumptions, entry, invalidation, exit, and a valid, watch, or no-trade status. |
| 64 | - Research basis: [John, Li & Liu](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=4816710) and [Vidal-Tomás](https://www.sciencedirect.com/science/article/pii/S154461232401393X) show that observed crypto spreads reflect liquidity, settlement, fees, and exchange-default risk—not risk-free profit. |
| 65 | |
| 66 | ## Key Rules |
| 67 | |
| 68 | - NEVER report an opportunity without deducting all fees (trading, transfer, gas, slippage) |
| 69 | - NEVER assume execution is instant -- note that cross-exchange opportunities decay in seconds |
| 70 | - Pre-funded accounts on both sides are required for cross-exchange arb; transfers kill the edge |
| 71 | - Use a venue-, size-, and latency-specific minimum edge; no universal spread floor is valid |
| 72 | - Check order book depth: thin liquidity means slippage will eat the spread |
| 73 | |
| 74 | ## Related Skills |
| 75 | |
| 76 | - **funding-rate-trading** -- funding rate arb (spot + perp) is a specific delta-neutral strategy |
| 77 | - **altcoin-rotation** -- cross-pair price analysis overlaps with rotation screening |