The Broker Connector
The Broker Connector is Datafye's execution infrastructure that bridges your algorithmic trading strategies with brokerage firms. It provides unified access to multiple brokers through a consistent API, handling order management, position tracking, and execution reporting. This section covers everything related to broker connectivity and trade execution.
What You'll Learn
Learn how to configure broker connectivity using BrokerSpecs, including broker credentials, account configuration, and execution settings.
Key Concepts
The Broker Connector abstracts away broker-specific complexity, providing a unified interface for trade execution regardless of which brokerage you use:
Broker Connector provides unified access to multiple brokerage firms through a single, consistent API that works the same whether you're trading with Alpaca, Interactive Brokers, or any other supported broker
Order Management handles the complete order lifecycle—submission, modification, cancellation, and tracking—ensuring your orders are executed reliably
Position Management tracks current positions and portfolio state in real-time, giving you accurate visibility into your holdings and exposure
Execution Reporting delivers real-time updates on order status and fills through WebSocket streams, keeping you informed of every execution event
Paper Trading enables risk-free strategy validation with simulated execution that mirrors live trading behavior without risking capital
Live Trading executes real trades with actual capital, bridging your validated strategy with real market execution
When to Use
The Broker Connector is the execution component in Trading scenarios, taking your strategy signals and turning them into actual market orders:
Trading: Data Cloud + Broker - Execute trades from your own algo containers, giving you full control over strategy logic while leveraging Datafye's broker integration
Trading: Full Stack - Execute trades from Datafye-managed algo containers with seamless integration between strategy signals and order execution
In Foundry scenarios (Data Cloud Only, Full Stack), the Broker Connector is not included since these environments focus on data access and development/backtesting rather than live execution. You validate your strategies in the Foundry, then move to a Trading environment when you're ready to execute.
Supported Brokers
Datafye integrates with multiple brokerage platforms:
US Equities
Alpaca - Commission-free trading with modern API
Interactive Brokers - Professional trading platform with global reach
Additional brokers in development
Future Support
Cryptocurrencies - Coinbase, Kraken, Binance
Futures - CME, ICE
Forex - OANDA, Interactive Brokers
Execution Modes
The Broker Connector supports two execution modes, allowing you to validate your strategy without risk before committing real capital:
Paper Trading
Simulated execution with no real capital at risk
Real market data for realistic price simulation
Full order lifecycle including fills, partial fills, rejections
Position tracking identical to live trading
Risk-free validation of strategy behavior
Paper trading is essential for:
Validating strategy logic before deploying capital
Testing order management and execution flow
Verifying risk management and position sizing
Gaining confidence in algo behavior
Live Trading
Real execution with actual brokerage accounts
Real capital at risk
Market impact from your orders
Regulatory compliance through broker infrastructure
Live trading requires:
Funded brokerage account
Proper risk management
Thorough backtesting and paper trading validation
Understanding of market mechanics and execution risks
Access Modes
The Broker Connector provides different access patterns depending on whether you're using your own containers or Datafye's Algo Container:
Own-Container Scenarios (Data Cloud + Broker)
Access broker functionality via REST and WebSocket APIs:
REST API - Order management and queries
WebSocket API - Real-time execution updates
Datafye Container Scenarios (Full Stack Trading)
Access broker functionality via Algo Container SDK:
Order Types
The Broker Connector supports all standard order types used in professional trading, giving you the flexibility to implement sophisticated execution strategies:
Market Orders
Execute immediately at best available price
Guaranteed fill (for liquid securities)
No price control
Limit Orders
Execute only at specified price or better
Price control
May not fill if price not reached
Stop Orders
Trigger when price reaches stop level
Becomes market order when triggered
Used for stop losses
Stop-Limit Orders
Trigger when price reaches stop level
Becomes limit order when triggered
Combines stop and limit functionality
Time-in-Force Options
Day - Order active until market close
GTC (Good-Till-Canceled) - Order active until filled or canceled
IOC (Immediate-Or-Cancel) - Fill immediately or cancel
FOK (Fill-Or-Kill) - Fill entire order immediately or cancel
Risk Management
The Broker Connector includes multiple layers of risk controls to protect your capital and prevent catastrophic losses from algo errors or market events:
Account-Level Controls
Maximum position size - Limit size of any single position
Maximum order value - Limit notional value of orders
Daily loss limit - Stop trading if losses exceed threshold
Buying power checks - Ensure sufficient capital before execution
Order-Level Controls
Pre-trade validation - Verify order parameters before submission
Duplicate order detection - Prevent accidental double submissions
Price collar checks - Reject orders with unreasonable limit prices
Portfolio-Level Controls
Concentration limits - Prevent over-concentration in single security
Sector exposure limits - Manage diversification across sectors
Net exposure limits - Control overall market exposure
Broker Credentials
You provide your own broker credentials for execution:
Important: Datafye uses your broker credentials to execute trades on your behalf. You maintain direct control over your brokerage accounts, and Datafye never has custody of your funds.
See Broker Descriptors for how to configure broker credentials in your deployment.
Best Practices
Always Paper Trade First
Validate strategy behavior with paper trading
Ensure order management works as expected
Verify position tracking and PnL calculations
Gain confidence before risking capital
Start Small with Live Trading
Begin with small position sizes
Monitor closely during initial live trading
Gradually increase size as confidence builds
Always maintain risk limits
Monitor Execution Quality
Track fill prices vs expected prices
Monitor slippage and market impact
Analyze execution timing
Optimize order types and parameters
Implement Proper Risk Management
Set maximum position sizes
Use stop losses appropriately
Diversify across securities
Never risk more than you can afford to lose
Related Building Blocks
The Broker Connector is the final link in the chain from market data to executed trades, working alongside other Datafye components:
Data Cloud - Provides the real-time market data that informs your trading decisions, feeding your algos the information they need to generate signals
Algo Container - Generates the trading signals that the Broker Connector executes, turning strategy logic into concrete buy and sell orders
Backtesting Engine - Validates strategies using historical data before you commit to live trading, ensuring your algo is ready for real capital
Next Steps
Ready to start trading? These resources will help you get started with the Broker Connector:
Broker Descriptors - Learn how to configure broker connectivity with credentials, risk limits, and execution settings
Trading: Data Cloud + Broker Quickstart - Get started with own-container trading, perfect if you have existing algo infrastructure
Trading: Full Stack Quickstart - Get started with SDK-based trading for a complete managed solution
Last updated: 2025-10-14
Last updated

