PQAP CLI Quick Reference

Installation

./scripts/install_cli.sh

System Management

Command Description
pqap status Show system status, capital, P&L
pqap start Start PQAP trading engine
pqap stop Stop PQAP trading engine
pqap restart Restart PQAP
pqap health Run health checks
pqap logs Show recent logs
pqap logs --lines 100 Show last 100 log lines

Positions & Trading

Command Description
pqap positions Show open positions
pqap trades Show last 20 trades
pqap trades --last 50 Show last 50 trades
pqap pnl Show P&L summary (overall, by strategy, daily)

Strategy Management

Command Description
pqap strategies List all strategies with status & performance
pqap strategy enable NAME Enable a strategy
pqap strategy disable NAME Disable a strategy
pqap strategy stats NAME Show detailed strategy statistics

Deployment

Command Description
pqap sync Sync code to EC2
pqap deploy Deploy changes to EC2 (sync + restart)

Common Workflows

Morning Check

pqap status
pqap positions
pqap pnl

Enable New Strategy

pqap strategy enable momentum_v1
pqap restart

Troubleshoot Issues

pqap health
pqap logs --lines 100

Deploy to Production

pqap health    # Verify local is healthy
pqap deploy    # Push to EC2

Strategy Names

  • dual_arb_v1 - Dual-outcome arbitrage
  • market_maker_v1 - Market making
  • mean_reversion_v1 - Mean reversion
  • momentum_v1 - Momentum trading
  • value_bet_v1 - Value betting
  • stat_arb_v1 - Statistical arbitrage
  • time_arb_v1 - Time-based arbitrage
  • ml_prediction_v1 - ML prediction

Output Colors

  • 🟢 Green: Success, positive P&L
  • 🔴 Red: Errors, negative P&L
  • 🟡 Yellow: Warnings
  • 🔵 Cyan: Info messages

Files

  • Config: configs/dev.yaml
  • Database: data/pqap_dev.db
  • Paper State: data/paper_trading_state.json
  • Logs: pqap.log

Dashboard

When running: http://localhost:8080/paper

System Overview

Polymarket API

Market data source

Data Collector

Every 5 minutes

SQLite Database

Price history + trades

Strategy Engine

Signal generation

ML Model

XGBoost (72% acc)

Execution Engine

Paper trading

Dashboard

You are here!

Telegram

Alerts & updates

Trading Strategies

Each strategy looks for different market inefficiencies:

Dual Arbitrage Active

Finds when YES + NO prices don't add to 100%. Risk-free profit.

Mean Reversion Active

Buys when price drops too far from average, sells when it recovers.

Market Maker Active

Places bid/ask orders to capture the spread.

Time Arbitrage Active

Exploits predictable price patterns at certain hours.

ML Prediction Active

Uses machine learning to predict 6-hour price direction.

Value Betting Disabled

Finds underpriced outcomes based on implied probability.

Data Storage (Single Source of Truth)

All data lives on EC2. Local machines are for development only. The EC2 instance is the authoritative source for all market data, trades, and positions.
Database Purpose Location
market_history.db Price snapshots every 5 minutes (8.2 MB) EC2 (primary)
pqap_prod.db Trades, positions, P&L history EC2 (primary)
paper_trading_state.json Current portfolio state EC2 (primary)

Environment Architecture

EC2 (Production)

  • Runs 24/7
  • All databases live here
  • Executes all trades
  • Single source of truth

Local (Development)

  • For code changes only
  • Syncs code to EC2
  • No production data
  • Can be turned off

Environment Details

Component Details
Dashboard URL https://pqap.tailwindtech.ai
Server AWS EC2 (us-east-1)
SSL Let's Encrypt via Traefik
Mode Paper Trading (simulated)

How It Works (Simple Version)

1. Data Collection: Every 5 minutes, we fetch prices from Polymarket for 50 markets and save them to our database.

2. Analysis: Our strategies analyze this data looking for patterns - like prices that moved too far from normal, or markets where the math doesn't add up.

3. Signals: When a strategy finds an opportunity, it generates a "signal" - a recommendation to buy or sell.

4. Execution: The execution engine takes these signals and simulates trades (paper trading). Eventually, this will place real orders.

5. Monitoring: This dashboard shows you what's happening. Telegram sends alerts for important events.