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 gap-and-go 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.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 gap candidates using pre-market data from Alpaca. Outputs a ranked list of candidates scored by relative volume, gap size, sector alignment, and momentum.
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 this data to weight candidates — stocks in bullish sectors receive a score boost; stocks in bearish sectors are penalized or excluded.
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 takes the ranked list, applies sector weighting and risk filters, determines position sizes, and submits orders to Alpaca at your configured entry time.
Options Strategy
EliteThe options strategy layer adds Greeks-aware options trading on top of the core equity strategy. It screens for high-IV opportunities, selects contracts based on delta and DTE targets, and manages exits via theta decay or stop-loss triggers.
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 gap-and-momentum 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
Position sizing uses a fixed fractional approach: 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.