David J. Cooper
Connected

Built: PoGPM – Portfolio Manager: A Master Controller for Trading Microservices

Built: PoGPM – Portfolio Manager

Player of Games – Master Controller for PoG Trading Microservices. A real-time portfolio oversight dashboard that aggregates data from multiple trading services and exchanges.

Overview

PoGPM is the central command and control hub for the PoG trading ecosystem. It provides:

  • Real-time PnL Tracking – 1-second updates for mission-critical position monitoring
  • Multi-Exchange Aggregation – Combines data from HyperLiquid, Lighter, and manual accounts
  • Service Management – Start, stop, restart, and monitor all trading services
  • Equity Tracking – Historical equity curves with full history back to genesis
  • Risk Management – Centralized control over strategy risk parameters
  • Watchdog – Automatic service health monitoring and restart capabilities

Architecture

+------------------+
|     PoGPM        |  <- Master Controller (Port 9004)
|  (This Service)  |
+--------+---------+
         |
    +----+----+----+----+
    |         |         |
+---v---+ +---v---+ +---v---+
|PoGUCB | |Trader | |Trader |
| :9001 | |  HL   | |Lighter|
+-------+ | :9002 | | :9102 |
          +-------+ +-------+
              |         |
          +---v---+ +---v---+
          |  HL   | |Lighter|
          |  API  | |  API  |
          +-------+ +-------+

Features

Dashboard

  • Summary cards showing total equity, open PnL, positions, and orders
  • Account-level breakdowns for each trading source
  • Real-time unrealized PnL charts (1-second updates)
  • Combined equity curves with full historical data

Last Closed Trades (Real-time)

  • Fixed-height streaming window showing last 20 closed trades
  • Real-time WebSocket push when trades close
  • Risk:Reward (R:R) ratio calculation
  • PnL highlighting (green for wins)
  • Flash animation for new trade notifications

Service Management

  • Start/stop/restart individual services
  • Start/stop all services
  • Watchdog with automatic health checks and restarts
  • Service uptime and restart count tracking

Risk Management

  • View and modify strategy risk settings
  • Enable/disable strategies
  • Kill switch status and reset
  • Per-strategy PnL tracking

Tech Stack

  • Backend: Python, FastAPI, asyncio
  • Frontend: Vanilla JavaScript, Chart.js
  • Real-time: WebSocket for 1-second PnL updates
  • Database: SQLite (equity snapshots)
  • Process Management: Built-in watchdog with health checks

Quick Start

# Install dependencies
pip install -r requirements.txt

# Run the service
python run.py

The dashboard will be available at http://localhost:9004

API Endpoints

Core Data

  • GET /api/positions – All open positions
  • GET /api/orders – All open orders
  • GET /api/trades – Trade history
  • GET /api/analytics – Combined analytics

Equity

  • GET /api/equity – Equity snapshots
  • GET /api/equity/curves – Equity curves for charts
  • POST /api/equity/backfill – Import historical data

Services

  • GET /api/services – Service status
  • POST /api/services/{id}/start – Start service
  • POST /api/services/{id}/stop – Stop service
  • POST /api/services/{id}/restart – Restart service

Risk

  • GET /api/risk/strategies – All strategy risk settings
  • PUT /api/risk/{source}/{strategy}/{symbol} – Update settings

WebSocket

  • WS /ws – Real-time updates
    • realtime_pnl – 1-second PnL updates
    • trade_closed – Closed trade notifications
    • positions_update – Position changes

Configuration

Configuration is managed via backend/config.py:

# Service ports
PM_PORT = 9004
UCB_PORT = 9001
TRADER_PORT = 9002
TRADER_LIGHTER_PORT = 9102

# Watchdog
WATCHDOG_ENABLED = True
HEALTH_CHECK_INTERVAL = 30  # seconds

Design Principles

  1. Reliability First – Graceful degradation when services are unavailable
  2. Low Latency – Real-time data where it matters (PnL, positions)
  3. Fail-Safe – Watchdog ensures services stay running
  4. Memory Bounded – All caches and buffers have limits

License

Proprietary – PoG Trading Systems