# Skill: rh-arb-scanner

# Robinhood Arbitrage Scanner

## Overview

This skill scans two venues simultaneously and computes the spread between real equity prices and their tokenized counterparts on Robinhood Chain. When a spread exceeds the fee threshold, it flags the opportunity and proposes an execution plan.

## Two Venues

1. **Real equities (app side)** — priced in USD, traded via the Robinhood brokerage app using the `rhagent-trader` skill's MCP tools (`getequityquotes`, `placeequityorder`). Uses real-time exchange quotes.
2. **Tokenized stocks (chain side)** — priced in USDG, traded on Robinhood Chain via 0x RFQ market makers. Uses the `robinhood-stocks-autopilot` skill for price lookup and swap execution.

## Scan Procedure

### Step 1: Define the ticker list

Default ticker list (tickers available on both venues):
- AAPL, NVDA, TSLA, AMZN, META, GOOGL, SPY, QQQ, GME, AMD

User can override with a custom list at any time.

### Step 2: Pull quotes from both venues

For each ticker in the ticker list:

1. **App price** — call `getequityquotes` via the `robinhood-agentic` MCP server for the real equity last-traded price.
2. **Tokenized price** — use the robinhood-stocks-autopilot lookup flow to get the tokenized stock's current price on Robinhood Chain (CoinGecko last-known or RFQ quote if available).

### Step 3: Compute the spread

For each ticker:

```
spread_pct = ((tokenized_price - app_price) / app_price) * 100
```

- Positive spread = tokenized is MORE EXPENSIVE (premium)
- Negative spread = tokenized is CHEAPER (discount)

### Step 4: Classify opportunities

| Condition | Direction | Action |
|-----------|-----------|--------|
| spread < -0.5% | tokenized DISCOUNT | Buy tokenized on-chain, sell real on app |
| spread > +0.5% | tokenized PREMIUM | Buy real on app, sell tokenized on-chain (only if already holding tokenized shares) |
| -0.5% ≤ spread ≤ +0.5% | NEUTRAL | No action — fees eat the spread |

### Step 5: Report results

Output a table with columns:
- Ticker
- App Price
- Tokenized Price
- Spread %
- Direction (DISCOUNT / PREMIUM / NEUTRAL)
- Actionable (YES / NO)

Rank actionable deals by absolute spread size, largest first.

## Execution Rules

- **Scan-only by default** — the scanner does NOT execute trades automatically. It reports findings and waits for user confirmation.
- **Fee threshold** — default 0.5% (covers estimated app spread + on-chain router fees + gas). User can adjust.
- **Sanity check** — if tokenized price diverges >5% from app price, flag as SUSPECT (likely stale quote or low liquidity) and do NOT recommend execution.
- **Liquidity check** — check tokenized stock market cap / 24h volume. If market cap < $50K, flag as ILLIQUID and warn that fills may move the price significantly.
- **Geo-gate** — tokenized stocks on Robinhood Chain are geo-blocked. Verify the user's eligibility before recommending any on-chain execution.

## Arb Direction Notes

- **Tokenized discount (buy on-chain, sell on app)**: the cleaner arb direction. Buy the cheaper tokenized stock on-chain, simultaneously sell the real shares on the app. Capital recycles fast since tokenized settles instantly.
- **Tokenized premium (buy on app, sell on-chain)**: only works if you already hold tokenized shares to sell. You CANNOT short tokenized stocks on Robinhood Chain. If you don't hold tokenized shares, this direction is not executable.
- **Extended hours edge**: tokenized stocks trade 24/7 on-chain. The Robinhood app has 24-hour trading for some tickers but not all. Pricing gaps widen outside regular market hours when RFQ market makers reprice less frequently — this is where the best spreads tend to appear.
- **RFQ lag**: on-chain market makers reprice less frequently than real exchanges. During fast moves, the tokenized version can lag — that's the window. But always verify the quote is live, not stale.

## Capital Requirements

- App side: USD buying power in the Robinhood brokerage account
- Chain side: USDG or ETH on Robinhood Chain (USDG at 0x5fc5360d0400a0fd4f2af552add042d716f1d168)
- Both legs need capital deployed simultaneously to capture the spread before it closes.

## Automation (optional)

Can be wired as a scheduled automation that:
1. Runs the scan at a defined interval (e.g. every 10 minutes during market hours, every 30 minutes off-hours)
2. Alerts the user via Telegram when a spread exceeds the threshold
3. Includes the ticker, spread, direction, and suggested execution plan in the alert

Use `automate_agent_command` to set up the recurring scan. The automation should be read-only (scan + alert), NOT auto-execute.

## Dependencies

- `rhagent-trader` skill — for real equity quotes and order execution on the Robinhood app
- `robinhood-stocks-autopilot` skill — for tokenized stock price lookup and swap execution on Robinhood Chain
- `robinhood-agentic` MCP server — for the underlying MCP tools (getequityquotes, placeequityorder, etc.)

## Usage Examples

- "scan for arb deals" — run a one-time scan across the default ticker list
- "scan AAPL and TSLA for arb" — scan specific tickers
- "set up arb alerts every 10 minutes" — create an automation that scans and alerts via Telegram
- "scan with 1% threshold" — run the scan with a custom fee threshold