The Reality Check: You Don't Need All 4 APIs
Look, Alpaca has 4 different APIs, but here's what they actually are:
- Trading API: Buy/sell stocks, get basic market data. This is what you want.
- Market Data API: Fancy real-time data feeds. Only pay for this if IEX data isn't good enough.
- Broker API: Build the next Robinhood. Unless you have lawyers and $50M, skip it.
- Connect API: OAuth bullshit for third-party integrations. Most people don't need it.
Authentication Setup
Authentication is simple - just two headers:
APCA-API-KEY-ID
: Your key IDAPCA-API-SECRET-KEY
: Your secret (don't commit this to GitHub)
Paper trading: https://paper-api.alpaca.markets
- Test here first or you'll lose money
Live trading: https://api.alpaca.markets
- Only touch this when your bot actually works
I've seen developers accidentally use live trading URLs in development. Shit gets expensive fast.
WebSocket Streams: They Will Break
WebSocket streaming connects to wss://data.alpaca.markets
. Pretty stable, but will randomly disconnect. Had it drop connections during market close on long weekends and my bot sat there silent for 3 days.
Weird auth issue: Market data WebSockets sometimes act up with auth. Had some problem where trading worked fine but market data kept failing. Took way too long to figure out it was different endpoints or something. The streaming docs could be clearer about this.
SDK Wars: Use alpaca-py or Die
Skip the legacy Python SDK - it's deprecated and full of bugs. The new alpaca-py SDK is way better:
- Actually handles async properly (the old one was garbage at this)
- Better error messages when shit goes wrong
- Doesn't randomly crash when the API hiccups
Version gotcha: Make sure you're using the current stable version v0.42.0 (released July 4, 2025). If you're upgrading from older versions, the client initialization might have changed. Check the releases or you'll spend time debugging import errors.
Rate Limits Are Actually Annoying
You get 200 requests per minute. Hit the limit and you're locked out for a full minute. WebSocket streams don't count against this limit, so use them for real-time data instead of polling the REST API constantly.
Pro tip: I've seen production bots get rate limited during market open because they poll account balance every 5 seconds. Use WebSocket account updates instead.
Data Feeds: Free vs. Paid
IEX (Free): Real-time quotes from IEX exchange only. Good enough for most stuff, but you'll miss some trades happening on other exchanges.
SIP ($49/month): All exchanges, better data quality, no API limits. Worth it if you're doing anything serious.
Start with free IEX and upgrade when it becomes a problem.
Multi-Asset Trading: Each One Has Gotchas
- Stocks: Works great, no surprises
- Options: Level 3 approval required, complex order types, Greeks calculations
- Crypto: 24/7 trading, different fee structure, no fractional shares
My options bot kept getting weird rejections until I realized I needed different account permissions. The error messages didn't help much.
Production Scaling: What Actually Breaks
The API is pretty solid, but here's what goes wrong at scale:
- Connection pooling: The default SDK settings don't handle high-volume trading well
- Order validation: Complex orders fail validation in mysterious ways
- Market holidays: Your bot will crash on MLK Day if you don't handle market schedule
Bot worked for months, then completely died on Presidents' Day or something. Kept retrying orders and hitting rate limits because I assumed markets were always open weekdays. Should've checked the market schedule but who thinks about that until it breaks?
The account activities API is useful for debugging what actually happened when your orders get weird fills or rejections.
Now that you know what you're dealing with, let's look at the actual implementation. The next section covers setting up your environment, handling the inevitable authentication gotchas, and writing code that doesn't break when the market gets weird.
Additional Resources That Don't Suck:
- Stack Overflow Alpaca discussions - Real developer problems and solutions
- Alpaca GitHub issues - Bug reports and feature requests for the SDK
- WebSocket troubleshooting thread - Common connection issues and fixes
- Market data WebSocket errors - HTTP 404 and other streaming problems
- Production deployment guide - Real-world bot architecture with CI/CD
- Trading bot examples repository - Working momentum strategy implementation