Metadata-Version: 2.4
Name: fahali-guard
Version: 1.0.0
Summary: 3-line cryptographic pre-trade risk clearance guard (FRCT v1) for CCXT, Alpaca, Hyperliquid, and autonomous Python AI trading agents.
License-Expression: MIT
Project-URL: Homepage, https://fahaliai.com/developer
Project-URL: Documentation, https://mcp.fahaliai.com/llms.txt
Project-URL: Repository, https://github.com/BobMain-2025/spectra-mobile
Keywords: fahali,mcp,frct,ai-agents,risk-management,ccxt,hyperliquid,alpaca
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# `fahali-guard` — 3-Line Pre-Trade Execution Guard (FRCT v1) for Python AI Agents

Zero-dependency fail-closed risk clearance guard for autonomous AI trading agents across **CCXT**, **Hyperliquid Python SDK**, **Alpaca**, **LangGraph**, and **CrewAI**.

## Install

```bash
pip install fahali-guard
```

## Zero-Signup Quickstart (< 10 Seconds)

```python
import ccxt
from fahali_guard import FahaliGuard, guard_ccxt

trial = FahaliGuard.mint_sandbox_key("my-autonomous-bot")
guard = FahaliGuard(api_key=trial["apiKey"], auto_resize_parameter_breaches=True)
exchange = guard_ccxt(ccxt.binance(), guard)

# Automatically checks Fahali FRCT before any order packet leaves your process:
# - CLEAR -> attaches clientOrderId receipt tag and executes
# - CLEAR_WITH_CONSTRAINTS -> scales size down (e.g. 50% stress haircut) & enforces TWAP_ONLY
# - BLOCK_ESCALATE -> raises FahaliClearanceBlockedError BEFORE hitting the exchange
exchange.create_order("SOL/USDT", "limit", "buy", 50, 180.0)
```

## Hyperliquid Perpetuals Wrapper

```python
from fahali_guard import FahaliGuard, guard_hyperliquid

guard = FahaliGuard(api_key="sk_live_...", auto_resize_parameter_breaches=True)
hl = guard_hyperliquid(hl_exchange, guard)
hl.order("SOL", True, 100.0, 180.0, {"limit": {"tif": "Gtc"}})
```

Observation and pre-trade attestation only — Fahali holds zero custody and routes no orders.
