The 5 Guards
QWED-Finance uses Neurosymbolic AI - combining neural (LLM) outputs with symbolic (math/logic) verification.1. Compliance Guard (Z3)
Purpose: Verify KYC/AML regulatory decisions using formal boolean logic.Methods
| Method | Description |
|---|---|
verify_aml_flag() | Check CTR threshold ($10,000) |
verify_kyc_complete() | Validate KYC document requirements |
verify_transaction_limit() | Enforce daily limits |
verify_sanctions_check() | OFAC sanctions screening |
How Z3 Works
2. Calendar Guard (SymPy)
Purpose: Deterministic day count conventions for interest calculations.Supported Conventions
| Convention | Use Case |
|---|---|
ACTUAL_ACTUAL | US Treasury bonds |
ACTUAL_360 | T-Bills, Commercial paper |
ACTUAL_365 | UK Gilts |
THIRTY_360 | Corporate bonds |
THIRTY_E_360 | Eurobonds |
3. Derivatives Guard (Black-Scholes)
Purpose: Options pricing and margin verification using pure calculus.Methods
| Method | Description |
|---|---|
verify_black_scholes() | Options pricing with Greeks |
verify_delta() | Delta calculation |
verify_margin_call() | Margin call decision |
verify_put_call_parity() | Arbitrage detection |
4. Message Guard (XML Schema)
Purpose: Validate ISO 20022 and SWIFT messages before transmission.Supported Formats
| Format | Description |
|---|---|
PACS_008 | Customer Credit Transfer |
CAMT_053 | Bank Statement |
PAIN_001 | Payment Initiation |
MT103 | SWIFT Single Transfer |
MT202 | SWIFT Bank Transfer |
SWIFT MT Validation
5. ISOGuard (JSON Schema)
Purpose: Enforce ISO 20022 compliance for JSON-based Agentic Banking.Why JSON vs XML?
WhileMessageGuard handles traditional XML SWIFT messages, ISOGuard enables Modern Banking Agents to speak the same standard using lightweight JSON.
6. Query Guard (SQLGlot)
Purpose: Prevent SQL injection and unauthorized data access.Methods
| Method | Description |
|---|---|
verify_readonly_safety() | Block INSERT/UPDATE/DELETE/DROP |
verify_table_access() | Whitelist allowed tables |
verify_column_access() | Block PII columns |
verify_no_injection() | Detect injection patterns |
Why AST, Not Regex?
Cross-Guard (Multi-Layer)
Purpose: Combine multiple guards for comprehensive verification.7. Bond Guard (Yield Analytics)
Purpose: Verify fixed income calculations like Yield to Maturity (YTM) and duration using Newton-Raphson.8. FX Guard (Currency Arbitration)
Purpose: Validate cross-currency conversions and detect arbitrage opportunities.9. Risk Guard (Portfolio Metrics)
Purpose: Ensure risk metrics like Sharpe Ratio and VaR (Value at Risk) are mathematically consistent.:::tip PyPI Package All 9 guards are available via
pip install qwed-finance
:::