---
title: "Broker SDK: Connect Your Broker to Your AI Safely"
description: "Give Claude, ChatGPT, or any agent read-only sight of your real brokerage accounts. Free and open source, 22 brokers and exchanges supported, and your keys never leave your machine."
canonical: https://www.luxalgo.com/broker-sdk/
---

# Broker SDK: Connect Your Broker to Your AI Safely

> Give Claude, ChatGPT, or any agent read-only sight of your real brokerage accounts. Free and open source, 22 brokers and exchanges supported, and your keys never leave your machine.

## Your broker, safely connected to your agent.

The free, open-source bridge between your real brokerage and exchange accounts and any assistant or app. Read-only by default: your agent can see your portfolio and can never touch it. Your keys stay on your machine.

```bash
npm install @luxalgo/broker-sdk
```

## The safe bridge from your broker to your agent.

Claude, ChatGPT, Cursor, or anything you build on one side. Your real accounts on the other. The bridge between them is built read-only from the first line of code, so your agent gets perfect, live sight of your portfolio while your accounts and your keys stay entirely, provably yours.

## Ask your portfolio anything.

Once your accounts are connected, your agent stops guessing about your money and starts answering from it. Real balances, real positions, real fills, across every broker and exchange you use, in plain language.

- “What am I actually holding right now, across every account?” Every open position from every connected broker and exchange, in one answer.
- “How did I really trade this month?” Win rate and realized P&L computed from your real fills, not your memory.
- “Which of my accounts is sitting in cash?” Balances and equity per account, compared for you.
- “Summarize this week for my trading journal.” Your trade history, newest first, ready to reflect on.
- “Anything unusual in my portfolio this morning?” A fresh snapshot on demand; the cache refreshes when you ask.
- “Build me a dashboard of all my accounts.” The same SDK powers real apps, so your agent can code against it directly.

## 22 brokers and exchanges. One connection.

Stocks, options, futures, and crypto accounts all speak the same language once they’re connected. Twelve return full trade history today, and any broker that can export a CSV statement works from day one.

- Including trade history: Alpaca, Charles Schwab, E*TRADE, Hyperliquid, Interactive Brokers, KuCoin, Public.com, Questrade, Robinhood Crypto, tastytrade, Topstep, Tradier.
- Also supported: Binance, Bybit, Coinbase, Crypto.com Exchange, Gemini, Kraken, OKX, TradeStation, Trading212, Webull.
- Yours, via CSV import.

## Safety

- Read-only by default: The root export reads accounts, balances, positions, and history. Nothing in it can place an order.
- Keys stay local: It runs where your code runs: no hosted service, no telemetry, and your keys never touch anyone else’s servers.
- Sanctioned APIs only: Each broker’s own official API: no scraping, no reverse-engineered private endpoints, ever.

Order placement exists, deliberately quarantined in a separate module, paper and sandbox first, where live trading requires an exact acknowledgement sentence typed by you. Nothing in the root export can move money.

## One schema under everything.

One npm package, zero runtime dependencies, strict TypeScript. Every broker returns the same normalized snapshot (accounts, balances, positions, trades), so code written once works against all twenty-two. Every adapter is gated by a committed golden test vector, live canaries run real read-only accounts on schedule, and an API watch files an issue the day a broker’s docs drift.

- Portfolio sweep: Every account fetched at once; one broker failing never blanks the rest.
- Stats engine: Win rate and realized P&L from real fills, FIFO-matched, deterministic.
- CSV statement import: Any broker that can export a statement is supported the same day.
- Sync daemon + webhooks: Polls, spots what changed, and notifies your systems with signed webhooks.
- Drop-in connect UI: A React component renders every broker’s exact credential form.
- Credential rotation: Rotating tokens handled first-class; replacements handed back to persist.

## Your agent, reading your accounts.

Six read-only tools in the local LuxAlgo MCP server give Claude, Cursor, or any assistant live sight of your real portfolio. They run only on your machine, with your own keys, and nothing in them can place a trade. That is the deal, and it is enforced in code.

- `broker_setup`: Supported brokers, their env vars (set or unset, never values), read-only key guides.
- `broker_accounts`: Connected accounts: broker, currency, equity, cash.
- `broker_positions`: Open positions with market values, asset class, entry price; negative quantity means short.
- `broker_trades`: Trade history, newest first; filter by broker or symbol.
- `broker_stats`: Total equity, equity by broker, top positions, FIFO win rate and realized PnL.
- `broker_refresh`: Bypass the 5-minute cache and re-fetch now.

Local MCP server (your keys stay in your env, never on a server): `claude mcp add luxalgo -- npx -y @luxalgo/mcp`

## Your keys. Your machine. Your data.

MIT. Zero dependencies. Forever. ESM and CJS, strict TypeScript, nothing phoning home. Built for the apps and agents you ship.

- GitHub: https://github.com/LuxAlgo/broker-sdk

This software reports what your broker reports. It is not investment advice, and nothing in it recommends any trade. Use at your own risk; verify important numbers against your broker’s own statements.

"TradingView" and "Pine Script" are trademarks or registered trademarks
of TradingView, Inc. LuxAlgo is not affiliated with, sponsored by, or
endorsed by TradingView, Inc.

Sitemap: https://www.luxalgo.com/sitemap.xml · Machine-readable index: https://www.luxalgo.com/llms.txt
