An agent that analyzes crypto portfolio risks and automatically finds hedges via Polymarket.
OmniHedge is an intelligent risk-management companion designed for the modern crypto investor. Managing a diverse crypto portfolio is inherently volatile, with unpredictable systemic risks. OmniHedge bridges the gap between active on-chain portfolios and prediction markets to automate capital preservation.
The project works by performing a deep taxonomy decomposition of any given user wallet or portfolio into underlying risk vectors (e.g., regulatory shifts, technical smart contract risks, macroeconomic events). It then pulls live, high-liquidity binary (YES/NO) markets directly from the Polymarket API. Utilizing an advanced LLM framework, OmniHedge cross-references these portfolio risks with available prediction events, scores their time and direction relevance, and outputs a mathematically optimized, constraint-bound allocation plan. It essentially transforms prediction markets into a dynamic, automated insurance policy for your crypto assets.
OmniHedge is built with TypeScript and Node.js as a robust, type-safe backend service. We implemented a complete data fetching and evaluation pipeline structured in modular phases to guarantee predictability and "fail-fast" safety.Data Ingestion: We replaced hardcoded demo data by integrating directly with the Polymarket Gamma API, specifically hitting the /events endpoint to extract nested markets filtering for active, high-volume contracts (volume $\ge$ $5,000) to ensure executable liquidity tiers.AI Reasoning Engine: The core logic is powered by Llama 3.3 (70B) via Groq's high-TPM Dev tier API, optimized for fast inference (under 2 seconds). To ensure the model adhered strictly to a deterministic workflow, we designed an ultra-dense markdown system prompt detailing an 8-phase execution sequence.The "Hacky" Validation Layer: One major challenge with smaller 70B models is contextual drift when compressing large text prompts. To tackle this, we implemented a strict Zod runtime schema validation layer. We forced the LLM to output a single, raw JSON object with zero markdown backticks. If the model tripped on liquidity thresholds or directional flips, our custom "Sanity Check Protocol" instantly caught it at the code level, formatting data validation errors gracefully without breaking execution.

