Build Your Own Exchange Connector for Barfinex
Connect any exchange, broker, or data source to your trading system. One npm package — and your data flows everywhere: strategies, AI advisor, risk engine, and dashboard.
Your Exchange. Your Data. Your Strategies.
Every trader has a favorite exchange. Maybe it's the one with the best fees, the deepest liquidity, or the local broker your fund is required to use. The problem? Most trading platforms only support a handful of exchanges, and adding a new one means waiting for months — or switching platforms entirely.
With Barfinex, you can build your own connector in a day.
What Is a Connector?
A connector is a bridge between Barfinex and an external exchange, broker, or data source. It translates the exchange's proprietary API into a standard format that the entire Barfinex system understands.
Once connected, your exchange works with everything out of the box:
- Real-time market data streams into Detector strategies — trades, orderbook, candles
- AI Advisor gets access to prices and account state for LLM-powered decisions
- Inspector monitors positions and applies risk gates before order execution
- Studio dashboard shows your exchange alongside all others — same UI, same experience
- MCP tools let AI assistants query your exchange data through natural language
No special configuration per service. Connect once — use everywhere.
How It Works
Barfinex uses a plugin architecture. Every exchange is a separate npm package that implements six standard interfaces:
| What | Why |
|---|---|
| Client Service | Manages connection lifecycle — authenticate, check readiness |
| WebSocket Manager | Streams trades, orderbook, candles, account updates |
| Account API | Reads balances, positions, account info |
| Market API | Lists instruments, fetches prices |
| Order API | Opens, closes, and tracks orders |
| Data Adapters | Translates raw exchange messages into Barfinex's normalized format |
The Provider service loads your package dynamically at runtime. No changes to core code. No recompilation. Just npm install and activate.
What You'll Need
- Node.js 18+ and TypeScript
- The exchange's API docs — REST endpoints and WebSocket streams
- API credentials — to test your integration
- ~1 day for a data-only connector (trades + orderbook)
- ~2-3 days for full integration with order execution
The Quick Version
# 1. Create the package mkdir exchange-myexchange && cd exchange-myexchange npm init -y npm install @barfinex/types @nestjs/common # 2. Implement the interfaces (see full guide) # - Client Service: connection lifecycle # - WS Manager: subscribe to trades, orderbook, candles # - Adapters: transform raw data to normalized format # 3. Export everything from index.ts # 4. Publish to npm npm publish # 5. Install in your Barfinex instance npm install @your-org/exchange-myexchange # 6. Register the loader in the factory # 7. Activate via Studio or API
That's it. Your exchange now appears in the catalog, streams data to all services, and shows up in the Studio dashboard.
Who Is This For?
Fund managers and prop traders
You use a specific prime broker or OTC desk. Without a connector, Barfinex can't see your positions. With one, your risk engine covers everything.
Regional brokers and exchanges
Your broker isn't on the list of supported exchanges? Build a connector and your team gets full platform access — strategies, AI, risk management, dashboards.
Data providers
You have a premium data feed — alternative data, on-chain metrics, sentiment scores. Package it as a connector and it flows into Detector strategies and Advisor context.
Open-source contributors
See a popular exchange that's missing? Build the connector, publish it, and the community benefits.
What's Already Supported
Barfinex ships with 58 exchange connectors across 13 categories:
- Crypto — Binance, Kraken, Coinbase, Bybit, OKX, and more
- US Brokers — Alpaca, Interactive Brokers, Robinhood
- European Brokers — eToro, DEGIRO, Saxo Bank
- Forex — OANDA, Pepperstone, IG Markets
- Futures — CME Group, Tradovate, NinjaTrader
- DEX — Uniswap/SushiSwap aggregator
- Market Data — Polygon.io, Tiingo, Glassnode
Check the full catalog in Studio > Data > Exchanges & Brokers.
Start Building
The complete step-by-step guide covers:
- Project scaffolding and directory structure
- Implementing all six interfaces with code examples
- Writing data adapters for trades, orderbook, and candles
- Creating the NestJS module and public exports
- Registering in the factory and exchange catalog
- Testing with Provider API
- Publishing to npm
One Connector, Endless Possibilities
When you add a connector, you're not just adding one data source. You're unlocking:
- Any Detector strategy can use your exchange's data
- Advisor LLM can reason about your exchange's prices and positions
- Inspector risk governor can enforce limits across all your connected exchanges
- Studio shows a unified view of all your accounts
- Market data gets stored in QuestDB for historical analysis
- MCP tools let AI assistants interact with your exchange through natural language
The platform is designed to be extended. Your connector is a first-class citizen.
Build once. Use everywhere.