Connecting Alpaca
This guide walks you through connecting your Alpaca account to TradeStaq for automated stock and crypto trading.
Overview
Alpaca is a US-based commission-free broker offering:
- US Stocks - Trade all major US equities (NASDAQ, NYSE)
- Crypto Trading - Major cryptocurrencies 24/7
- Commission-Free - No trading fees on stocks or crypto
- Fractional Shares - Trade with any dollar amount
- Paper Trading API - Built-in sandbox for testing
- US Regulated - FINRA member, SEC registered
Prerequisites
Before connecting Alpaca:
- Alpaca Account - Create at alpaca.markets
- Account Verification - Complete identity verification (required for live trading)
- Funded Account - Deposit funds for live trading (optional for paper trading)
- TradeStaq Account - Sign up at tradestaq.com
Important: Stock Market Hours
US Stock Market Hours: Monday - Friday, 9:30 AM - 4:00 PM ET
- TradeStaq automatically blocks stock orders outside market hours
- Crypto trading is available 24/7
- Market holidays are automatically enforced
Step 1: Choose Trading Mode
Alpaca offers three trading modes in TradeStaq:
1. Paper Trading (Simulation)
- No API credentials needed
- Fully simulated trades in TradeStaq
- Perfect for testing strategies
- No Alpaca account required
2. Paper Trading (Alpaca Sandbox)
- Uses Alpaca's paper trading API
- Real-time Alpaca market data
- Realistic order execution
- Requires Alpaca paper API keys
3. Live Trading
- Real money trading
- Requires funded Alpaca account
- Requires live API keys
- Full regulatory compliance
Step 2: Access API Settings
For Paper Trading API Keys:
- Log in to alpaca.markets
- Navigate to Paper Trading dashboard
- Click Generate API Keys under Paper Trading section
- Or go directly: app.alpaca.markets/paper/dashboard/overview
For Live Trading API Keys:
- Log in to your Alpaca account
- Navigate to Live Trading dashboard
- Click Generate API Keys under Live Trading section
- Complete identity verification if required
- Or go directly: app.alpaca.markets/brokerage/dashboard/overview
Step 3: Create API Key
- Click Generate New Key or View API Keys
- Alpaca will show you:
- API Key ID - Your public key (starts with
PKfor paper,AKfor live) - Secret Key - Your private key (shown once only)
- API Key ID - Your public key (starts with
API Key ID: PKxxxxxxxxxxxxxxxxxx (Paper) or AKxxxxxxxxxxxxxxxxxx (Live)
Secret Key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
IMPORTANT: Save the Secret Key immediately. You cannot view it again.
Step 4: Configure Permissions
Alpaca API keys have full trading permissions by default:
Included Permissions
- ✅ View account balance and buying power
- ✅ View positions and orders
- ✅ Place market and limit orders
- ✅ Cancel orders
- ✅ View historical data
Note: Alpaca doesn't support withdrawal via API (your funds are safe)
Step 5: Connect to TradeStaq
- Go to TradeStaq Dashboard
- Click Exchanges → Add Exchange
- Select Alpaca from the list
- Configure your connection:
| Field | Value |
|---|---|
| Name | Give it a memorable name (e.g., "Alpaca Stocks") |
| Asset Type | Choose: US Stocks or Crypto |
| Paper Trading | Enable for paper trading, disable for live |
| Paper Mode | (If paper enabled) Choose: Simulation or Alpaca Sandbox |
| API Key | Paste your API Key ID (skip if using simulation mode) |
| API Secret | Paste your Secret Key (skip if using simulation mode) |
- Click Connect Exchange
Step 6: Verify Connection
After connecting:
- Check the status shows Active (green indicator)
- Verify your buying power is displayed correctly
- For stocks: Check that market hours indicator shows current status
- Test by viewing available trading pairs
Supported Features
Stock Trading
| Feature | Support |
|---|---|
| Market Orders | ✓ |
| Limit Orders | ✓ |
| Stop Orders | ✓ |
| Market Hours Enforcement | ✓ (Automatic) |
| Fractional Shares | ✓ |
| Margin Trading | ✓ (with margin account) |
| Short Selling | ✓ (with margin account) |
| Futures | ✗ |
Crypto Trading
| Feature | Support |
|---|---|
| Market Orders | ✓ |
| Limit Orders | ✓ |
| 24/7 Trading | ✓ |
| Major Pairs | ✓ (BTC, ETH, LTC, etc.) |
| Leverage | ✗ |
Asset Types
US Stocks
Trade any stock on major US exchanges:
- NASDAQ: AAPL, MSFT, GOOGL, TSLA, AMZN
- NYSE: JPM, BAC, WMT, V, MA
- Penny Stocks: Available (check minimum requirements)
Symbol Format:
- Enter as:
AAPL,TSLA,MSFT - TradeStaq auto-formats for Alpaca API
Cryptocurrencies
Supported crypto pairs:
- Bitcoin: BTC/USD
- Ethereum: ETH/USD
- Litecoin: LTC/USD
- Bitcoin Cash: BCH/USD
- Others: LINK/USD, AAVE/USD, UNI/USD, DOGE/USD, SHIB/USD
Symbol Format:
- Enter as:
BTC/USD,ETH/USD - TradeStaq auto-formats to Alpaca's format
Market Hours & Trading Rules
Stock Market Hours
Regular Hours: Monday - Friday, 9:30 AM - 4:00 PM ET
Market Holidays 2026:
- January 1 (New Year's Day)
- January 19 (MLK Day)
- February 16 (Presidents' Day)
- April 3 (Good Friday)
- May 25 (Memorial Day)
- July 3 (Independence Day observed)
- September 7 (Labor Day)
- November 26 (Thanksgiving)
- December 25 (Christmas)
Pre-Market: 4:00 AM - 9:30 AM ET (not currently supported) After-Hours: 4:00 PM - 8:00 PM ET (not currently supported)
Crypto Market Hours
- 24/7 Trading: Available every day
- No Market Hours: Trade anytime
- No Holidays: Always open
Buying Power vs Leverage
Unlike crypto exchanges, Alpaca uses "buying power" instead of leverage:
Cash Account
- Buying Power: 1x your cash balance
- No Leverage: Can only trade with available cash
- Pattern Day Trading: No restrictions
Margin Account
- Buying Power: Up to 2x your portfolio value for stocks
- Overnight: Limited to 2x
- Intraday: Up to 4x for day trades (if PDT eligible)
- Pattern Day Trading: Restricted if balance < $25,000
Note: Crypto trading is always 1x (no leverage available)
Paper Trading Modes
Simulation Mode (Recommended for Beginners)
Pros:
- No API keys required
- Instant setup
- Works offline
- Consistent with other exchanges
Cons:
- Simulated fills (not exact Alpaca behavior)
- Doesn't test API connection
Alpaca Sandbox Mode
Pros:
- Uses real Alpaca paper trading API
- Realistic order execution
- Tests API integration
- Real-time Alpaca market data
Cons:
- Requires Alpaca account
- Need to generate paper API keys
- Online only
Best Practice: Start with Simulation, then test with Sandbox before going live.
Security Best Practices
Do's
- ✅ Use separate API keys for paper and live trading
- ✅ Store API keys securely
- ✅ Review trading activity regularly
- ✅ Enable email/SMS notifications in Alpaca
- ✅ Test thoroughly in paper mode first
Don'ts
- ❌ Never share your API keys
- ❌ Never commit keys to version control
- ❌ Never use live keys for testing
- ❌ Never ignore margin call warnings
Trading Fees & Costs
Stock Trading
- Commission: $0 per trade
- SEC Fee: ~$0.00051 per $1,000 sold (regulatory)
- FINRA TAF: ~$0.000166 per share sold (regulatory)
Crypto Trading
- Trading Fee: 0.10% - 0.25% (volume-based)
- Spread: Built into pricing
- No Withdrawal Fees: Via API
Total Cost: Very competitive, especially for stocks (essentially free)
Pattern Day Trading (PDT) Rules
If you make 4+ day trades in 5 business days:
Account < $25,000
- ❌ PDT restrictions apply
- Limited to 3 day trades per 5 business days
- Violation can lock trading for 90 days
Account ≥ $25,000
- ✅ No PDT restrictions
- Unlimited day trades
- Up to 4x intraday buying power
Note: Only applies to margin accounts. Cash accounts exempt but have settlement delays.
Troubleshooting
API Key Rejected
Solutions:
- Verify key and secret are copied correctly (no extra spaces)
- Check if using paper keys (PK...) in live mode or vice versa
- Ensure API key hasn't been revoked in Alpaca dashboard
- Confirm account verification is complete for live trading
Market Closed Error
Solutions:
- Check current time is 9:30 AM - 4:00 PM ET (Mon-Fri)
- Verify not a market holiday
- Switch to crypto trading for 24/7 access
- Wait until market opens
Insufficient Buying Power
Solutions:
- Check available buying power in Alpaca dashboard
- Verify funds have settled (T+2 settlement for stocks)
- Reduce position size
- For margin accounts: Check margin requirements
Order Rejected
Solutions:
- Verify symbol is valid (use stock ticker or crypto pair)
- Check minimum order size requirements ($1 for fractional shares)
- Ensure buying power is sufficient
- For stocks: Confirm order during market hours
Symbol Not Found
Solutions:
- Stock symbols: Use ticker only (e.g.,
AAPL, notAAPL/USD) - Crypto pairs: Include quote currency (e.g.,
BTC/USD) - Verify asset type setting matches (stocks vs crypto)
- Check spelling and capitalization
Alpaca Status
Check Alpaca system status:
API Documentation
For advanced users:
- Alpaca API Docs: alpaca.markets/docs
- Market Data API: alpaca.markets/docs/market-data
Regulatory Information
FINRA Membership
- Member: FINRA
- Check broker: BrokerCheck
SIPC Protection
- Account Protection: Up to $500,000 (including $250,000 cash)
- Additional Insurance: Up to $150 million aggregate
SEC Registration
- Registered Broker-Dealer
- Regulated by SEC and FINRA
Next Steps
- Paper Trading - Practice with simulation mode
- Creating a Bot - Set up automated trading
- Stock Trading Strategies - Learn stock strategies
- Exchange Overview - Compare all exchanges