Action Center (Order Approval)
Relevant source files
The following files were used as context for generating this wiki page:
The Action Center is a centralized hub within the OpenAlgo platform designed for managing semi-automated trading orders. It acts as an approval workflow layer that sits between strategy generation (via API, Flow, or Python scripts) and broker execution. When the system is configured in "Semi-Auto" mode, all incoming orders are intercepted and held in a queue rather than being executed immediately.
This module provides traders with manual control over automated signals, allowing for human intervention to approve, reject, or delete orders based on real-time market conditions or risk assessment. It includes real-time notifications via WebSockets and visual indicators for order statistics, ensuring a comprehensive audit trail of all trading actions.
Sources: frontend/src/pages/ActionCenter.tsx:186-193, README.md:128-135
System Architecture and Execution Modes
The Action Center's behavior is governed by the global Order Execution Mode setting, which can be toggled in the API Key management interface.
Execution Modes
| Mode | Behavior | Use Case |
|---|---|---|
| Auto Mode | Orders are executed immediately by the broker upon receipt. | Fully automated strategies and personal trading. |
| Semi-Auto Mode | Orders are queued in the Action Center for manual approval. | Signal verification, risk management, and manual oversight. |
Sources: frontend/src/pages/ApiKey.tsx:162-184, README.md:128-135
Order Lifecycle Flow
The following diagram illustrates how an order moves from a strategy source to the broker depending on the active execution mode.
The flow ensures that in Semi-Auto mode, the broker is never reached without explicit user confirmation.
Sources: frontend/src/pages/ActionCenter.tsx:125-175, frontend/src/pages/ApiKey.tsx:179-195
Functional Components
Real-time Updates and Notifications
The Action Center utilizes socket.io-client to maintain a persistent connection with the backend. It listens for specific events to provide an interactive experience:
- pending_order_created: Triggered when a new order is queued. The interface plays an alert sound (if enabled in
alertStore) and displays a warning toast. - pending_order_updated: Triggered when an order's status changes (approved, rejected, or deleted), prompting a data refresh.
Sources: frontend/src/pages/ActionCenter.tsx:94-118
Order Management Actions
Users can interact with queued orders through several primary operations:
- Approve: Executes the order via the broker. The system supports individual approval and "Approve All" functionality.
- Reject: Marks the order as rejected with a reason (defaulting to "Rejected by user").
- Delete: Permanently removes an order record from the Action Center database.
- Refresh: Manually fetches the latest order data and statistics from the
/action-center/api/dataendpoint.
Sources: frontend/src/pages/ActionCenter.tsx:125-184
Data Structures and API Reference
Pending Order Schema
Orders in the Action Center contain comprehensive metadata required for execution and auditing.
| Field | Type | Description |
|---|---|---|
id | number | Internal database identifier. |
strategy | string | Name of the strategy that generated the order. |
api_type | string | Source type (e.g., placeorder, basketorder). |
symbol | string | The trading instrument (e.g., RELIANCE). |
action | BUY | SELL | MULTI | Direction of the trade. |
price_type | string | Execution type (MARKET, LIMIT, SL, SL-M). |
status | string | Current state (pending, approved, rejected). |
raw_order_data | object | The original JSON payload received by the API. |
Sources: frontend/src/pages/ActionCenter.tsx:32-46, test/test_flow_workflow_validator.py:382-395
Statistics Interface
The system tracks aggregate metrics to provide an overview of trading activity:
total_pending: Count of orders awaiting action.total_approved: Successful manual executions.total_rejected: Orders manually blocked.total_buy_orders/total_sell_orders: Volume breakdown by direction.
Sources: frontend/src/pages/ActionCenter.tsx:48-54
Implementation Details
Configuration Endpoints
The frontend interacts with the backend via the following REST API routes:
GET /action-center/api/data: Fetches orders filtered by status.POST /action-center/approve/{id}: Approves a specific order.POST /action-center/approve-all: Mass approval of all pending orders.POST /action-center/reject/{id}: Rejects an order with a reason.DELETE /action-center/delete/{id}: Removes an order record.POST /apikey/mode: Updates the global execution mode (autovssemi_auto).
Sources: frontend/src/pages/ActionCenter.tsx:75-184, frontend/src/pages/ApiKey.tsx:112-132
Technical Constraints
- Audio Alerts: The system preloads
/sounds/alert.mp3for audible notifications on new pending orders. - Audit Trail: Every order includes a
created_at_isttimestamp for precise chronological tracking in Indian Standard Time. - UI States: Buttons for approval and rejection include loading states (
isApproving,isRejecting) to prevent duplicate submissions during network latency.
Sources: frontend/src/pages/ActionCenter.tsx:95-100, frontend/src/pages/ActionCenter.tsx:125-155, CLAUDE.md:21-28
Conclusion
The Action Center (Order Approval) serves as a critical safety and management layer within OpenAlgo. By providing a bridge between automated signal generation and broker execution, it allows for high-stakes validation and manual oversight, effectively reducing the risks associated with fully autonomous algorithmic trading.