Skip to content

[feat]: Added pre-trade risk guardrails with hard order gates - #74

Merged
Official-Krish merged 7 commits into
mainfrom
feat/Memory,Guardrails,Multi-Agent
Aug 8, 2026
Merged

[feat]: Added pre-trade risk guardrails with hard order gates#74
Official-Krish merged 7 commits into
mainfrom
feat/Memory,Guardrails,Multi-Agent

Conversation

@Official-Krish

Copy link
Copy Markdown
Owner

Add a cross-broker Pre-Trade Risk Shield that hard-blocks orders before they are placed, covering Zerodha, Groww, Lighter, and Solana swap nodes.

  • Add RiskLimits type + metadata fields (packages/types, node-registry, WorkflowSchema) and persist via workflow create/update routes
  • New RiskGuardService: resolves node∩workflow limits (min-wins), computes order notional (live price for Indian symbols), enforces maxQty / maxOrderAmount / maxSlippageBps / maxDailyExposure
  • Redis INCRBY daily-exposure ledger keyed by user + date (TTL 48h)
  • Hard approval gate (handleBrokerApprovalGate): creates approval, pauses workflow, and throws so the order is never placed
  • Non-retryable RiskLimitExceededError; enforcement inserted before executeTrade in base.handler and executeSwap in solana handler
  • Close OpenClaw bypass: pre-flight risk check before OpenClaw dispatch
  • Best-effort Resend email alerts for blocked / approval-required orders
  • Frontend: RiskGuardSection in trading + solana swap forms, RiskBadge on broker nodes, workflow-level risk panel in the save dialog

@Official-Krish
Official-Krish merged commit 6976b5e into main Aug 8, 2026
5 checks passed
@Official-Krish
Official-Krish deleted the feat/Memory,Guardrails,Multi-Agent branch August 8, 2026 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant