Blog
How Barfinex Works: The Five-Service Architecture
Provider, Detector, Advisor, Inspector, Studio — five services that cover the full trading cycle. Here's how they connect and what each one does for you.
The Core Idea
Each stage of trading gets its own service. Services talk through typed events. Every decision is traceable.
This means you can update a strategy without restarting the data feed. Adjust risk rules without touching the AI. Trace any trade back to the signal, AI reasoning, and risk check that produced it.
The Five Services
Provider — Your Data Foundation
Provider is the single source of truth for all market data. No other service talks to exchanges directly.
What it does for you:
- Connects to exchanges (Binance, Alpaca, more via plugins)
- Normalizes data into clean OHLCV candles
- Detects and repairs data gaps automatically
- Exposes one unified API — the only endpoint you need
Detector — Your Strategy Engine
This is where your trading logic lives. You define rules, weights, and thresholds as a TypeScript config.
- Evaluates rules on every new candle
- Scores conditions and emits signals only when the threshold is met
- Shows exactly which rules fired and why (full attribution)
- Multiple strategies run in parallel, isolated from each other
Advisor — Your AI Decision Maker
Takes each signal through an 8-stage pipeline:
- Fetches market context
- Checks data quality
- Scores the signal independently
- Calculates conviction (0-1)
- Calibrates against current market regime
- Synthesizes with LLM (with hallucination detection)
- Validates spread and risk/reward
- Emits execution intent
Every stage is logged. 28+ event types for full traceability.
Inspector — Your Risk Manager
No order reaches the exchange without Inspector's approval. It checks:
- Position size limits
- Portfolio exposure caps
- Drawdown thresholds
- Loss streak limits
- Cooldown periods
Also manages stop-loss and take-profit orders automatically.
Studio — Your Dashboard
Real-time view of the entire pipeline:
- Live charts with signal overlays
- AI decision logs with reasoning traces
- Risk dashboard with active positions
- Capital efficiency metrics
Studio is read-only — it observes but doesn't control.
How Data Flows
Exchange → Provider → Detector → Advisor → Inspector → Exchange
↓
Studio (observes everything)
Every arrow is a typed event with a timestamp and audit record.
Deployment
docker-compose up starts the full stack locally. Each service can also run on separate infrastructure as you scale.