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:

  1. Alpaca Account - Create at alpaca.markets
  2. Account Verification - Complete identity verification (required for live trading)
  3. Funded Account - Deposit funds for live trading (optional for paper trading)
  4. 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:

  1. Log in to alpaca.markets
  2. Navigate to Paper Trading dashboard
  3. Click Generate API Keys under Paper Trading section
  4. Or go directly: app.alpaca.markets/paper/dashboard/overview

For Live Trading API Keys:

  1. Log in to your Alpaca account
  2. Navigate to Live Trading dashboard
  3. Click Generate API Keys under Live Trading section
  4. Complete identity verification if required
  5. Or go directly: app.alpaca.markets/brokerage/dashboard/overview

Step 3: Create API Key

  1. Click Generate New Key or View API Keys
  2. Alpaca will show you:
    • API Key ID - Your public key (starts with PK for paper, AK for live)
    • Secret Key - Your private key (shown once only)
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

  1. Go to TradeStaq Dashboard
  2. Click ExchangesAdd Exchange
  3. Select Alpaca from the list
  4. Configure your connection:
FieldValue
NameGive it a memorable name (e.g., "Alpaca Stocks")
Asset TypeChoose: US Stocks or Crypto
Paper TradingEnable for paper trading, disable for live
Paper Mode(If paper enabled) Choose: Simulation or Alpaca Sandbox
API KeyPaste your API Key ID (skip if using simulation mode)
API SecretPaste your Secret Key (skip if using simulation mode)
  1. Click Connect Exchange

Step 6: Verify Connection

After connecting:

  1. Check the status shows Active (green indicator)
  2. Verify your buying power is displayed correctly
  3. For stocks: Check that market hours indicator shows current status
  4. Test by viewing available trading pairs

Supported Features

Stock Trading

FeatureSupport
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

FeatureSupport
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, not AAPL/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:


Regulatory Information

FINRA Membership

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