# Bird's Eye — TradingView feed setup (one-time)

Folder: `C:\Users\Neo\Documents\Claude\BirdsEye\`
Pieces: `birdseye_feed.pine` (indicator) · `birdseye_tvfeed.py` (receiver) · `birdseye-tv.bat` (launcher) · `birdseye-dashboard-v1.12.html` (unchanged)

## 1. Stop the old feed
Close any `birdseye_feed*.py` window — only one process can own port 8765.

## 2. Start the receiver and note the token
Double-click `birdseye-tv.bat`. The console prints:

    dashboard:  http://localhost:8765/birdseye-dashboard-v1.12.html
    webhook:    http://localhost:8765/hook/<TOKEN>
    status:     http://localhost:8765/status

Copy the `<TOKEN>` (24 hex characters). It is also saved in `tv_token.txt`. The dashboard opens on the Log-only fallback until alerts arrive.

Optional self-test in a second console: `python birdseye_tvfeed.py --test` → the receiver prints two lines (`birdseye test 2 names`, `levelmaker demo 1 names`) and the dashboard shows HPE and RKLB with live geometry after a refresh.

## 3. Tunnel (TradingView must reach the PC over https)
Recommended: **Tailscale Funnel** — free, permanent hostname, no request cap.
1. Install Tailscale (tailscale.com/download), sign in.
2. In the admin console, enable **HTTPS certificates** and **Funnel** for the tailnet (Settings → DNS → HTTPS; Access controls → the `funnel` node attribute — the CLI prompts with a link the first time).
3. In a console: `tailscale funnel 8765`  (leave it running; `tailscale funnel --bg 8765` keeps it running in the background).
4. It prints the public URL, e.g. `https://neo-prime.tail1234.ts.net/`. Your webhook URL is that host plus `/hook/<TOKEN>`.
5. Check from any browser: `https://<host>/status` should return JSON.

Alternatives: Cloudflare Tunnel (free, needs a domain on Cloudflare); ngrok (free tier caps at 20k requests/month — seven 2-min alerts make ~25k — paid tier only).

## 4. Indicator in TradingView
1. Open any chart, set the timeframe to **2 minutes**.
2. Pine Editor → new indicator → paste the whole of `birdseye_feed.pine` → Save (name "Bird's Eye Feed") → Add to chart.
3. Add it **seven times** (Indicators → My scripts, or right-click the first instance → Clone), and set each instance's inputs:

| Instance | Batch name | Mode   | Symbols 1–10 |
|---|---|---|---|
| 1 | stocks-1 | stocks | AAOI AEHR AFRM ANF ASTS AVAV AXTI CART CAVA CRCL |
| 2 | stocks-2 | stocks | CRWV CTSH CVNA DAR DKS DOCN EIX ESTC FCX FLR |
| 3 | stocks-3 | stocks | FLUT FROG HNGE HOOD HPE HUT INTC KGS MCHP MP |
| 4 | stocks-4 | stocks | MRNA MSTR MXL NOW P PBF RBRK RKLB SEI SFM |
| 5 | stocks-5 | stocks | SMTC SWKS SYRE TEM TTMI TWST TXG VSAT VSXY WING |
| 6 | etf-1 | etfs | SPY QQQ IWM DIA XLK XLF XLE XLV XLY |
| 7 | etf-2 | etfs | XLP XLI XLU XLB XLRE XLC SOXX IGV XME |

Pick each symbol with the symbol search in the input (US primary listing). Each instance shows a small status box bottom-left: batch name, symbol count, "2-min chart ✓", payload size (keep under ~4,000 chars).

Claude can do steps 2–3 through the TradingView connector on the PC once the tunnel host is known — say so and it will load the script, add the instances and set the inputs.

## 5. Alerts — one per instance (7 total)
For each instance: right-click the chart → Add alert (or the clock icon):
- Condition: **Bird's Eye Feed** (the instance) → **Any alert() function call**
- Options: **Once per bar close** is implied by the script; leave the trigger as is
- Expiration: **Open-ended** (Premium)
- Notifications: tick **Webhook URL** and paste `https://<host>/hook/<TOKEN>`
- Message: leave the default `{{message}}` — the script supplies the JSON
- Name: e.g. `BirdsEye stocks-1`

Claude can create these through the connector's alert tool too.

## 6. Watch it land
- Receiver console: one line per batch at every 2-minute bar close, e.g. `10:32:03  birdseye   stocks-1   10 names  (bar 10:32)`.
- `http://localhost:8765/status` → `posts` climbing, `batches` listing all seven with the latest bar time.
- Dashboard status line: `lanes: live 50/50 @ 10:32`, no red warning. Pre-open (before 09:32) it says `lanes: Log` — expected.

## Payload contract for your own plugins
POST the same URL with `{"kind":"<plugin>","b":"<any>","t":"HH:MM","d":[{"s":"SYM", ...your fields...}]}` from any Pine `alert()`.
Fields other than the Bird's Eye ones land untouched in `quotes.json` → `quotes[SYM].ext[<plugin>]` with the bar time. Include `l o p h lo`
if the plugin also carries prices and they refresh the quote. Keep an alert under ~4 KB. Ask Claude to surface a plugin's fields on the card / detail sheet / sort menu — one small dashboard edit per plugin.

## If something is off
- 403 in TradingView's alert log → token in the URL doesn't match `tv_token.txt`.
- Nothing arrives, `/status` from outside fails → tunnel not running or Funnel not enabled.
- Arrives but a batch shows fewer than 10 names → an empty or misspelled symbol slot in that instance.
- `bad payload` in the console → paste the line to Claude.
