Risk Monitoring Workflow (Cron: every 5 minutes)
Workflow Execution Steps
Step 1: portfolio-scan
Query active positions from exchange backend.
Tool: emerald_exchange_get_positions()
Step 2: drawdown-check
Check portfolio drawdown against configured limits.
Tool: emerald_risk_drawdown_check()
Step 3: daily-loss-check
Check daily P&L against loss limits.
Tool: emerald_risk_daily_loss_check(daily_pnl=...)
Step 4: regime-check
Check for regime shifts using KS-test.
Tool: emerald_signals_regime()
Step 5: circuit-breaker
If ANY threshold is breached, halt trading immediately.
Tool: emerald_orders_halt() if risk score >= 1.0
Step 6: kg-persist
Store RiskSnapshot node in KG with timestamp and metrics.
Tool: graph_write(action="add_node", node_type="RiskSnapshot", ...)
Execution
Run this workflow as a dependency-ordered DAG. Steps with no unmet depends_on run in parallel; dependents run after their prerequisites complete.
- Run first (in parallel): Step 1 — portfolio-scan; Step 2 — drawdown-check; Step 3 — daily-loss-check; Step 4 — regime-check; Step 5 — circuit-breaker; Step 6 — kg-persist
Execution: If arbora is reachable, offload the whole DAG via graph_orchestrate action=execute_workflow (or the kg-delegate skill) for true parallel/swarm execution. Otherwise execute the steps natively in dependency order: run steps with no unmet depends_on in parallel, then their dependents.