# AGENTS.md - Repository Guidelines for Agentic Coding ## Project Overview This is a Python blockchain trading system for Uniswap CLP (Concentrated Liquidity Pool) management and hedging on Hyperliquid. The system consists of CLP hedgers, Uniswap managers, and KPI tracking tools. ## Build/Lint/Test Commands ```bash # Install dependencies pip install -r requirements.txt # Run Python with type checking (recommended workflow) python -m mypy clp_hedger.py python -m mypy uniswap_manager.py # Lint with flake8 (optional) flake8 --max-line-length=100 *.py # Run specific modules python clp_hedger.py python uniswap_manager.py ``` ## Code Style Guidelines ### Imports - Standard library imports first, then third-party, then local imports - Use `from typing import Optional, Dict, Any, List, Union` - Import logging_utils with try/except fallback pattern ### Types & Precision - Use `Decimal` for all financial calculations with `getcontext().prec = 60` - Function signatures: `def func_name(param: Type) -> ReturnType:` - Convert to float only for SDK compatibility at the last moment ### Naming Conventions - Constants: `UPPER_SNAKE_CASE` - Functions/variables: `lower_snake_case` - Classes: `PascalCase` (rarely used) - Loggers: `logger = logging.getLogger("MODULE_NAME")` ### Error Handling - Use try/except blocks for external dependencies (web3, hyperliquid, logging_utils) - Log warnings for missing optional dependencies - Return Decimal("0") for failed conversions, not None ### Logging - Use structured logging with UnixMsLogFilter for timestamp consistency - Log to files in `logs/` directory (auto-created) - Logger names should be uppercase: "HEDGER", "UNISWAP_MANAGER", "KPI_TRACKER" ### Environment - Load `.env` files from current directory with fallback - Use absolute paths for cross-directory imports - Append project root to `sys.path` for local modules