Nija

NIJA Control Center

The NIJA Control Center is a unified operational dashboard that provides comprehensive monitoring and control of the NIJA trading bot. It offers both a CLI launcher and a web-based dashboard for maximum flexibility.

Overview

The Control Center consolidates all NIJA data, alerts, balances, and actions into a single interface, making it the operational command center for managing your trading infrastructure.

Features

📊 Live Data & Monitoring

🚨 Alerts & Notifications

⚡ Quick Actions

📈 Snapshot Capabilities

Installation

The Control Center is already included in your NIJA installation. No additional dependencies are required.

Usage

CLI Control Center

The CLI provides an interactive terminal-based dashboard with auto-refresh capabilities.

Basic Usage

# Start the interactive CLI dashboard
python nija_control_center.py

# Custom refresh interval (5 seconds)
python nija_control_center.py --refresh-interval 5

# Show detailed information
python nija_control_center.py --detailed

# One-time snapshot (no loop)
python nija_control_center.py --snapshot

CLI Features

The CLI dashboard displays:

CLI Keyboard Commands

While the dashboard is running:

CLI Output Example

====================================================================================================
NIJA CONTROL CENTER - Live Trading Dashboard
====================================================================================================
Last Updated: 2026-02-07 14:30:15

📊 PLATFORM OVERVIEW
----------------------------------------------------------------------------------------------------
  Total Users: 5 | Active: 4 | Trading: 🟢 ENABLED
  Database: ✅ Healthy
  Total Positions: 12
  Unrealized P&L: +$1,234.56

👥 USER STATUS
----------------------------------------------------------------------------------------------------
  ✅ 🟢 📈 john_doe (pro)
      Balance: $25,000.00 | Positions: 4 | P&L: +$456.78
  
  ✅ 🟢 📈 jane_smith (investor)
      Balance: $50,000.00 | Positions: 5 | P&L: +$789.01

🚨 RECENT ALERTS
----------------------------------------------------------------------------------------------------
  [INFO] 14:25:10 - Trading resumed
  [WARNING] 14:15:32 - High volatility detected on BTC-USD

⚡ QUICK ACTIONS
----------------------------------------------------------------------------------------------------
  [R] Refresh Now    [E] Emergency Stop    [P] Pause Trading
  [S] Start Trading  [U] User Status       [Q] Quit
----------------------------------------------------------------------------------------------------

Auto-refresh: 10s | Press a key for action or wait for auto-refresh...

Web Dashboard

The web dashboard provides a modern, responsive interface accessible from any browser.

Starting the Dashboard

# Start the dashboard server (includes Control Center)
python bot/dashboard_server.py

The server will start on port 5001. You can then access:

Web Dashboard Features

The web dashboard displays:

  1. Platform Overview Card
    • Total users and active users
    • Trading status (enabled/disabled)
    • Total capital across all accounts
    • Open positions count
    • Unrealized P&L
    • Daily P&L
  2. Quick Actions Card
    • Resume Trading button
    • Pause Trading button
    • Emergency Stop button
    • Refresh Now button
  3. System Health Card
    • Database status
    • Controls system status
    • Risk Manager status
    • Overall system health
  4. Active Users Panel
    • User cards with status indicators
    • Balance per user
    • Position counts
    • P&L tracking
    • Trading readiness status
  5. Recent Alerts Panel
    • Alert severity levels (error, warning, info)
    • Timestamps
    • Alert messages
    • Color-coded by severity
  6. Open Positions Table
    • Symbol and side
    • Position size
    • Entry and current prices
    • Unrealized P&L
    • Broker information

Auto-Refresh

The web dashboard automatically refreshes every 10 seconds to display the latest data. You can also click “Refresh Now” for immediate updates.

API Endpoints

The Control Center provides a RESTful API for programmatic access:

Overview

Users

Positions & Trades

Alerts

Actions

Metrics

API Response Format

All API endpoints return JSON in this format:

{
  "success": true,
  "data": { ... },
  "timestamp": "2026-02-07T14:30:15.123Z"
}

Error responses:

{
  "success": false,
  "error": "Error message here"
}

Integration with Existing Tools

The Control Center integrates seamlessly with existing NIJA tools:

Architecture

CLI Component

API Component

Web Component

Security Considerations

Access Control

Emergency Actions

Troubleshooting

CLI Not Showing Data

If the CLI shows “No users found” or empty data:

  1. Check database connection: python -c "from database.db_connection import check_database_health; print(check_database_health())"
  2. Verify database is initialized: python init_database.py
  3. Check user records exist in database

Web Dashboard Not Loading

If the web dashboard shows errors:

  1. Check the Flask server is running: python bot/dashboard_server.py
  2. Verify port 5001 is not in use: lsof -i :5001 (Unix) or netstat -ano | findstr :5001 (Windows)
  3. Check browser console for JavaScript errors
  4. Verify API endpoints are accessible: curl http://localhost:5001/api/control-center/health

Action Buttons Not Working

If quick action buttons don’t work:

  1. Verify controls are available: Check logs for “Controls not available” warning
  2. Ensure you have proper permissions
  3. Check alert system is working
  4. Review server logs for errors

Auto-Refresh Not Working

If data doesn’t auto-refresh:

  1. Check browser JavaScript console for errors
  2. Verify API endpoints are responding
  3. Check network tab in browser dev tools
  4. Try manual refresh button

Performance Considerations

CLI Performance

Web Dashboard Performance

Database Load

Future Enhancements

Potential future additions:

Support

For issues or questions:

  1. Check the logs: CLI outputs to console, web server logs to standard output
  2. Review error messages in browser console (F12)
  3. Check database connectivity
  4. Verify all required modules are imported successfully

Version History