Build a complete DEX liquidity provision strategy with concentrated liquidity management, impermanent loss modeling, and automated rebalancing.
## ROLE You are a DeFi liquidity strategist and quantitative analyst who manages concentrated liquidity positions across Uniswap V3, Curve, and Balancer. You build automated position management systems and have deep expertise in impermanent loss modeling, fee optimization, and yield strategy design. ## OBJECTIVE Create a comprehensive liquidity provision strategy for [TOKEN PAIR] on [DEX: Uniswap V3/Curve/Balancer/Aerodrome] that maximizes fee revenue while managing impermanent loss risk, with automated rebalancing and detailed performance analytics for a capital deployment of [CAPITAL AMOUNT]. ## TASK Build the complete LP strategy and tooling: ### Market Analysis & Position Design - Analyze historical price data for [TOKEN PAIR] over the past [TIME PERIOD] - Calculate realized volatility, price correlation, and mean reversion characteristics - Determine optimal price range for concentrated liquidity: [LOWER TICK] to [UPPER TICK] - Model expected fee revenue at [FEE TIER: 0.01%/0.05%/0.30%/1.00%] based on historical volume - Compare full-range vs concentrated positions: capital efficiency and IL trade-off - Design multi-position strategy: split capital across [NUMBER] positions at different ranges - Factor in token yield: staking rewards, farming incentives, and bribes from [INCENTIVE SOURCE] ### Impermanent Loss Modeling - Build an IL calculator for the specific price range and token pair - Model IL scenarios: -20%, -50%, +50%, +100%, +200% price movement from entry - Calculate break-even time: fee accumulation needed to offset IL at various price trajectories - Compare IL across pool types: Uniswap V3 concentrated vs Curve StableSwap vs Balancer weighted - Implement Monte Carlo simulation with [NUMBER OF SIMULATIONS] paths using historical volatility - Generate risk/reward surface: expected return vs probability of loss across different price ranges - Factor in gas costs for position management: opening, closing, rebalancing, compounding ### Automated Position Management - Build a rebalancing bot using [LANGUAGE: TypeScript/Python] that monitors position health - Implement rebalancing triggers: - Price exits the active range (mandatory rebalance) - Position utilization drops below [UTILIZATION THRESHOLD]% - Accumulated fees exceed [COMPOUND THRESHOLD] (auto-compound) - Volatility spike detected (tighten or widen range) - Design the rebalancing strategy: close-and-reopen vs incremental adjustment - Integrate with [POSITION MANAGER: Arrakis/Gamma/Beefy/Revert Finance] for vault-based management - Calculate optimal rebalancing frequency considering gas costs vs efficiency gains - Implement MEV protection: use private RPCs and slippage guards during rebalancing swaps ### Smart Contract Integration - Write a Solidity vault contract that manages LP positions on behalf of depositors - Implement deposit/withdraw with proportional share accounting - Add permissioned keeper role for rebalancing with strategy constraints - Build fee collection and auto-compounding logic - Implement emergency withdrawal bypassing normal rebalancing logic - Add position NFT wrapping for composability with lending protocols ### Performance Analytics Dashboard - Track key metrics: total fees earned, IL incurred, net APY, capital efficiency ratio - Compare performance against benchmarks: HODLing both tokens, HODLing 100% [STABLE], lending on [AAVE/COMPOUND] - Generate daily/weekly performance reports with attribution analysis - Visualize position health: current price vs range, utilization over time, fee accumulation curve - Alert system: notify when position requires attention via [CHANNEL: Discord/Telegram/email] Provide the complete strategy document, simulation code, rebalancing bot, and vault contract.
Or press ⌘C to copy
Replace these placeholders with your own content before using the prompt.
[TOKEN PAIR][CAPITAL AMOUNT][TIME PERIOD][LOWER TICK][UPPER TICK][NUMBER][INCENTIVE SOURCE][NUMBER OF SIMULATIONS][UTILIZATION THRESHOLD][COMPOUND THRESHOLD][STABLE]