Skip to content

Rami8612/liquidity-orchestrator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Liquidity Orchestrator

Automated Active Liquidity Management for Concentrated Liquidity Pools

Liquidity Orchestrator is a production-ready Python bot designed to actively manage concentrated liquidity positions. It automatically exits, rebalances, and reopens LP positions when price leaves the configured range, allowing strategies based on tight ranges while reducing manual intervention.

The bot is suitable for long-running execution on servers or VPS and includes full lifecycle monitoring with Telegram notifications.


✨ Key Features

  • Automatic out-of-range detection with noise filtering
  • Safe LP position closure:
    • decreaseLiquidity(100%)
    • collect() all fees and principal
  • Cooldown period before re-entry to avoid churn during volatility
  • Partial rebalance swap of the dominant token
  • Re-opens a new LP position centered on current market price
  • Optimized for narrow liquidity ranges
  • Persistent state handling across restarts
  • Telegram alerts for all lifecycle events and errors
  • EIP-1559 compatible gas handling
  • Dry-run mode for safe testing (no transactions sent)

🧠 Strategy Flow

IN_RANGE
   ↓ (price exits range + escape filter)
OUT_OF_RANGE
   ↓
CLOSE POSITION
   ↓
COOLDOWN
   ↓
REBALANCE SWAP
   ↓
OPEN NEW POSITION
   ↓
IN_RANGE

📦 Requirements

  • Python 3.8+
  • Existing concentrated liquidity position
  • RPC provider (Alchemy, Infura, QuickNode, etc.)

Dependencies

pip install web3 python-dotenv requests tenacity

🚀 Installation

git clone <repository-url>
cd liquidity-orchestrator
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
cp .env.example .env

Configure .env with your wallet, pool, and strategy parameters before running.


▶️ Usage

Dry-run (recommended first)

DRY_RUN=true python liquidity_orchestrator_v3.py

Live execution

python liquidity_orchestrator_v3.py

📬 Telegram Notifications

Telegram alerts can be enabled via .env and will notify you of:

  • Position exits and re-entries
  • Rebalance operations
  • Transaction confirmations
  • Errors and exceptions

🔐 Security Notes

  • Never commit real private keys
  • Always test strategies using DRY_RUN=true
  • Understand risks related to:
    • Impermanent loss
    • Gas costs
    • Market volatility
    • Smart contract interactions

⚠️ Risk Disclaimer

This software interacts with decentralized finance protocols and executes on-chain transactions.

Using this bot can result in partial or total loss of funds.

The code is provided for educational and experimental purposes only. You are solely responsible for reviewing, testing, and validating the strategy parameters before using it with real capital.

Use at your own risk.

About

Production-grade liquidity management engine for narrow-range strategies. Monitors active liquidity positions, detects confirmed out-of-range conditions using safety filters, closes positions when required, and reopens new re-centered ranges after a configurable cooldown with controlled rebalancing and full state recovery.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages