Alpaca
ActiveUS Brokers
connectorType: "alpaca"Alpaca is an API-first stock brokerage that offers commission-free trading of US equities. Barfinex integrates with Alpaca for automated stock trading strategies, real-time market data, and portfolio management.
Connection Architecture
Alpaca
WebSocket / REST→
Connector
libs/exchange-alpaca→
Provider
:8081/api→
Detector
Advisor
Studio
The connector receives data from the exchange and feeds it to Provider (port 8081). From there — to Detector, Advisor, and Studio.
Technologies
Transport
WebSocketREST
Authentication
API Key + SecretData Format
JSONFeatures
Paper TradingTestnet
Best for
- Ideal for quant developers and systematic traders running momentum, mean-reversion, or breakout strategies on US equities.
- Paper trading mode allows safe strategy validation without risking capital.
- Crypto support (BTC, ETH and majors) enables cross-asset strategies from a single account.
- Perfect entry point for any team building automated stock trading on top of Barfinex.
Integration Features
Spot TradingYes
Futures TradingNo
Margin TradingNo
Orderbook StreamingYes
Trade StreamingYes
Candle StreamingYes
Historical DataYes
Order ExecutionYes
Testnet AvailableYes
Connect via code
1Environment variables (.env)
ALPACA_API_KEY=your_key_here ALPACA_API_SECRET=your_secret_here ALPACA_PAPER=your_paper_here
2Connector configuration
// config/config.provider.json
{
"provider": {
"connectors": [
{
"connectorType": "alpaca",
"enabled": true,
"key": "${ALPACA_API_KEY}",
"secret": "${ALPACA_API_SECRET}",
"markets": [
{ "marketType": "spot", "symbols": [{ "name": "BTCUSDT" }] }
],
"subscriptions": [
{ "type": "PROVIDER_MARKETDATA_CANDLE", "symbols": ["BTCUSDT"], "intervals": ["min1", "h1"], "active": true },
{ "type": "PROVIDER_MARKETDATA_TRADE", "symbols": ["BTCUSDT"], "active": true },
{ "type": "PROVIDER_MARKETDATA_ORDERBOOK", "symbols": ["BTCUSDT"], "active": true }
]
}
]
}
}3Verify and query data
# Verify connection curl -H "Authorization: Bearer $PROVIDER_API_TOKEN" \ https://localhost:8081/api/exchanges/runtime-proof # Candles (last 7 days) curl -H "Authorization: Bearer $PROVIDER_API_TOKEN" \ "https://localhost:8081/api/candles/alpaca/spot/BTCUSDT/h1?days=7"
Available via Barfinex API
/api/candles/alpaca/...
/api/trades/alpaca/...
/api/orderbook/alpaca/...
/api/account/alpaca/...
/api/symbols/alpaca/...
/api/assets/alpaca/...
Studio graphical setup — in development, coming in the next release.
Important
Trading permissions must be enabled in your Alpaca account dashboard before order execution will work.
Set ALPACA_PAPER=true to activate paper trading — all orders are simulated and no real money is at risk.
US equities trade during NYSE/NASDAQ regular session hours (09:30–16:00 ET, Mon–Fri); extended hours require an explicit flag.
Crypto trading is available 24/7 on Alpaca.
Rate limits: 200 requests/min on the REST API; WebSocket streaming is recommended for real-time data to avoid polling overhead.
Supported Markets
Spot
Founded2015
HeadquartersSan Mateo, USA
Websitealpaca.markets
API DocumentationOpen