What is Apex Automated Trade Systems?
Apex Automated Trade Systems is a self-hosted automated trading system that runs on a cloud server you own. It connects to your Alpaca brokerage account and executes a systematic trading strategy every trading day — no manual intervention required.
The system is made up of independent modules (screener, position monitor, sector rotation engine, etc.) that run as background services and communicate through a shared PostgreSQL database. A web dashboard lets you monitor positions, view performance analytics, and adjust configuration.
System Requirements
Installation Guide
The setup wizard on the success page walks you through every step after purchase. For manual setup:
1. Provision a server
Create a Ubuntu 22.04+ droplet on DigitalOcean (or any VPS). Enable IPv4. Note the IP address.
2. SSH in and install dependencies
ssh root@YOUR_SERVER_IP
apt update && apt upgrade -y
apt install -y nodejs npm postgresql postgresql-contrib git curl
npm install -g pm23. Clone and install
git clone https://github.com/Apex-Ai-Trading/apex-ai-trade.git /opt/apex
cd /opt/apex
npm install4. Configure environment
cp .env.example .env
nano .env # fill in ALPACA_KEY, ALPACA_SECRET, LICENSE_KEY, DB_URL5. Initialize the database
npm run db:migrate
npm run db:seed6. Start all services
pm2 start ecosystem.config.js
pm2 save
pm2 startup # follow the printed command to auto-start on reboothttp://YOUR_SERVER_IP:3000 once services are running.Connecting Alpaca
Apex Automated Trade Systems uses the Alpaca Markets API for order routing. Paper and live accounts use different key sets.
Getting your API keys
Log in to app.alpaca.markets → Your Account → API Keys → Generate New Key. Store both the key ID and secret immediately — the secret is only shown once.
ALPACA_PAPER=true). Switching to live trading puts real money at risk — do this only after validating paper performance.Multi-Broker Setup
Apex supports Alpaca Markets and Tradier simultaneously. You designate one as your Primary broker — all new buy signals route there. The other runs in monitor-only mode, winding down existing positions without opening new ones. You can switch primary at any time from the dashboard.
Connecting a broker
Go to Account Settings in your dashboard. Each broker has its own credentials section:
- Alpaca — enter your Key ID and Secret Key from app.alpaca.markets → API Keys. Select Paper or Live.
- Tradier — enter your Access Token and Account Number from tradier.com → API Access. Select Sandbox or Live.
Click Save and Test Connection for each broker, then restart the service to activate.
Switching your primary broker
In the Active Broker card, click Set as Primary on the broker you want to switch to. This will:
- Cancel all open orders on the outgoing broker
- Set the outgoing broker to monitor-only (existing positions wind down naturally)
- Route all new buy signals to the new primary broker
Resetting Account State
If you're switching to a new brokerage account, use Reset Account State in the Danger Zone on the Account page to clear out everything tied to the old one, so nothing carries over.
What gets cleared
- All trade history
- Exit rules and tracked positions (stop-loss / trailing-stop settings)
- Weekly goal, performance stats, equity history, and benchmark comparison
Not affected: your risk profile, module toggles, license, dashboard login, and notification settings. This also does not change your API keys or close any positions at the broker — it only clears Apex's own records.
How to do it
- Click Reset Account State… and review the preview — it shows exactly what will be cleared before anything happens
- Enter your new broker API keys elsewhere on the Account page (this can be done before or after the reset — order doesn't matter)
- Type the confirmation phrase and re-enter your dashboard password
- Restart the trading service once, after both the reset and the new keys are in place
Modules
Position Monitor
The position monitor runs continuously during market hours, tracking all open positions against configured stop-loss levels. It fires hard stops, trailing stops, and time-based exits based on your configuration.
Morning Screener
Runs at 09:00 ET, before market open. Scans the full universe of US equities for trade candidates using pre-market data from Alpaca. Outputs a ranked candidate list based on the system's proprietary scoring model.
Results are stored in the screener_results table and visible on the dashboard Screener tab.
Sector Rotation
ProAnalyzes ETF flows and relative strength across 11 GICS sectors (XLK, XLF, XLE, XLV, etc.) to determine which sectors are in regime. The strategy engine uses sector data to weight and filter the candidate list.
Early Mover
ProPre-market module (08:00–09:25 ET) that identifies high-conviction gap candidates before the screener runs. Sends a Telegram alert with top picks and their key metrics so you can review before the session starts.
Strategy Engine
The core execution module. After the screener runs, the strategy engine processes the ranked list, applies configured filters, determines position sizes, and submits orders to Alpaca at your configured entry time.
Options Strategy
EliteThe options strategy layer adds options trading on top of the core equity strategy. It screens for qualified opportunities, selects contracts based on your configured parameters, and manages exits automatically.
Crypto Strategy
EliteThe crypto module extends the strategy engine to cover crypto assets available on Alpaca (BTC, ETH, and others). It runs a parallel screener for crypto pairs and applies the system's trading logic adapted for 24/7 markets — with configurable weekend behavior.
Risk Management
Risk circuit breakers halt all new entries if daily drawdown limits are hit, preventing the system from compounding losses during bad market conditions.
Analytics & Reports
ProThe analytics module generates end-of-day performance summaries: equity curve, win rate, average win/loss ratio, expectancy, drawdown metrics, and sector performance breakdown. Reports are stored in the database and accessible from the Analytics tab.
REPORT_CHANNEL in your .env.Configuration
.env Reference
All configuration lives in /opt/apex/.env. After editing, restart services with pm2 restart all.
# ── License ─────────────────────────────────────────
LICENSE_KEY=apex_xxxxxxxxxxxxxxxxxxxx
# ── Alpaca ───────────────────────────────────────────
ALPACA_KEY_ID=PKxxxxxxxxxxxxxxxx
ALPACA_SECRET_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
ALPACA_PAPER=true
ALPACA_BASE_URL=https://paper-api.alpaca.markets
# ── Database ─────────────────────────────────────────
DATABASE_URL=postgresql://apex:password@localhost:5432/apex
# ── Strategy (configured at install) ─────────────────
MAX_POSITIONS=
POSITION_SIZE_PCT=
ENTRY_TIME=
MIN_GAP_PCT=
MIN_RVOL=
# ── Risk (configured at install) ─────────────────────
MAX_DAILY_LOSS_PCT=
HARD_STOP_PCT=
TRAIL_PCT=
# ── Notifications ─────────────────────────────────────
TELEGRAM_TOKEN=
TELEGRAM_CHAT_ID=
EMAIL_FROM=
EMAIL_TO=Stop Categories
Four stop types are applied in priority order:
Risk Parameters
Each position is sized at POSITION_SIZE_PCT × account_equity. Your specific sizing parameters are set during installation and can be adjusted in .env at any time.
Telegram Notifications
Set up a Telegram bot to receive trade alerts, daily summaries, and circuit breaker notifications.
1. Create a bot
Message @BotFather on Telegram → /newbot → follow prompts → copy the token.
2. Get your chat ID
Send any message to your new bot, then visit:
https://api.telegram.org/bot<YOUR_TOKEN>/getUpdatesCopy the chat.id from the JSON response.
3. Add to .env
TELEGRAM_TOKEN=1234567890:ABCDefghIJKlmnoPQRstuvwXYZ
TELEGRAM_CHAT_ID=987654321Troubleshooting
Common Errors
Restarting the Service
# Restart all services
pm2 restart all
# Restart a single module
pm2 restart apex-screener
# View running processes
pm2 list
# Full stop and start
pm2 stop all && pm2 start ecosystem.config.jsChecking Logs
# Tail all logs
pm2 logs
# Tail a specific service
pm2 logs apex-strategy
# View last 200 lines
pm2 logs --lines 200
# Logs are also stored in
~/.pm2/logs/Account & Billing
Managing Your License
Your license key is delivered to your email immediately after purchase and shown on the success page. It is tied to one server (by machine ID) and validates every 23 hours.
To move your license to a new server: deactivate from the old server's dashboard → activate on the new server using the same key. You can do this once per 24-hour period.
Upgrading Tiers
Upgrades take effect immediately and are prorated for the remainder of the billing period. To upgrade:
Email [email protected] with your license key and desired tier — we'll send a Stripe upgrade link. Self-service upgrade portal coming soon.
Cancellation
Cancel any time via the Stripe customer portal (link in your receipt email). Your license remains active until the end of the current billing period. No partial refunds.
After cancellation, the software will stop running when the license next attempts validation. Your server, database, and trade history remain intact — you just can't run new trades.