Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
aa75565
(feat) improve gecko terminal
cardosofede Dec 23, 2025
0263c0d
(feat) fix scheduling vs continuous
cardosofede Dec 23, 2025
51ab700
(feat) add restore of scheduled jobs
cardosofede Dec 23, 2025
3edf5d7
(feat)improve historical
cardosofede Dec 24, 2025
fd82541
(feat) improve pmm mister menu
cardosofede Dec 24, 2025
7f350f5
(feat) handle controller start and stop
cardosofede Dec 24, 2025
3235ac1
(feat) improve bots report
cardosofede Dec 24, 2025
269e71b
(feat) imrpove bots status
cardosofede Dec 24, 2025
366c8b9
(feat) add activation bounds to grid
cardosofede Dec 24, 2025
96fb13f
(feat) skip custom markets
cardosofede Dec 24, 2025
6d4abfa
(feat) refresh balances
cardosofede Dec 24, 2025
498bfe0
(feat) fix formatting
cardosofede Dec 24, 2025
77a3d06
(feat) add bot age
cardosofede Dec 25, 2025
5373c48
(feat) add lp position monitor
cardosofede Dec 26, 2025
908ea8c
(feat) improve candles cache
cardosofede Dec 26, 2025
9473079
(feat) fix show result
cardosofede Dec 26, 2025
e141b1b
(feat) add clone controller config
cardosofede Dec 28, 2025
bf079bb
(feat) fix graph
cardosofede Dec 28, 2025
9985028
(feat) imrpove config clone
cardosofede Dec 28, 2025
cea0df5
(feat) improve pmm config
cardosofede Dec 30, 2025
23e94b1
(feat) adapt bots to use config manager
cardosofede Jan 7, 2026
13e0dbe
(feat) unify trading command
cardosofede Jan 7, 2026
525792b
(feat) improve routines
cardosofede Jan 7, 2026
2f7dece
(feat) add new config manager
cardosofede Jan 7, 2026
c83af56
(feat) add setup
cardosofede Jan 7, 2026
98c2387
(feat) adapt compose to new config
cardosofede Jan 7, 2026
a514cb7
(feat) add role systems
cardosofede Jan 7, 2026
496cdbb
(feat) remove unused servers
cardosofede Jan 7, 2026
5ffe971
(feat) adapt setup to new admin roles
cardosofede Jan 7, 2026
fd2123e
(feat) bump hummingbot-api version
cardosofede Jan 7, 2026
299551e
(feat) add hummingbto api restrictions
cardosofede Jan 7, 2026
23fc534
(feat) update config imports
cardosofede Jan 7, 2026
ccb4bf8
(feat) update imports
cardosofede Jan 7, 2026
9121c87
(feat) add api required decorator
cardosofede Jan 7, 2026
41ee324
(feat) update imports and simplify commands
cardosofede Jan 7, 2026
bbfad7d
(feat) optimize imports
cardosofede Jan 7, 2026
a03a9cc
(feat) optimize imports
cardosofede Jan 7, 2026
5868071
(feat) optimize imports
cardosofede Jan 7, 2026
54f5c96
(feat) fix server initialized
cardosofede Jan 7, 2026
ebe9dc9
(feat) improve swap trade command
cardosofede Jan 7, 2026
660695c
(feat) clean imports
cardosofede Jan 7, 2026
57cd516
(feat) improve routines module
cardosofede Jan 7, 2026
4b35afb
(feat) fix user server preference and unify config command
cardosofede Jan 7, 2026
0dfb2da
(feat) improve trade
cardosofede Jan 7, 2026
6c3dee1
(feat) adapt config to start
cardosofede Jan 7, 2026
7afe245
(feat) improve portfolio
cardosofede Jan 7, 2026
73abcef
(feat) work on lp monitor routine
cardosofede Jan 7, 2026
44e7b9e
(feat) separate audit log
cardosofede Jan 7, 2026
985e71e
(feat) improve grid strike config
cardosofede Jan 7, 2026
1114575
(feat) ofr refresh balance
cardosofede Jan 7, 2026
0c39d35
(feat) fix server access in start
cardosofede Jan 7, 2026
afec0b3
(feat) improve bots deploy command
cardosofede Jan 8, 2026
186f389
(feat) add trading pair simplification for selection
cardosofede Jan 8, 2026
cefc600
(feat) separate commands for keys servers and admin
cardosofede Jan 8, 2026
cc381d8
(feat) imrpove grid strike
cardosofede Jan 8, 2026
de41319
(feat) add helpers
cardosofede Jan 8, 2026
469f300
(feat) improve grid strike defaults
cardosofede Jan 9, 2026
94a2d91
(feat) update readme
cardosofede Jan 9, 2026
e4eb461
add check for existing .env file
david-hummingbot Jan 9, 2026
4fbc7e3
(feat) remove watchtower
cardosofede Jan 9, 2026
cec7848
(feat) ignore ds store
cardosofede Jan 12, 2026
ed4e87a
(feat) improve formatting
cardosofede Jan 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,4 @@ cython_debug/
# Telegram Bot Persistence
condor_bot_data.pickle
condor_bot_data.pickle.bak
.DS_Store
55 changes: 40 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
.PHONY: uninstall install run deploy setup stop
.PHONY: help setup install uninstall run deploy stop test lint setup-chrome

# Check if conda is available
ifeq (, $(shell which conda))
$(error "Conda is not found in PATH. Please install Conda or add it to your PATH.")
endif
help:
@echo "Condor Bot - Available Commands"
@echo ""
@echo " make setup - Interactive setup (creates .env file)"
@echo " make install - Setup + create conda environment"
@echo " make run - Run the bot locally"
@echo " make deploy - Run with Docker Compose"
@echo " make stop - Stop Docker containers"
@echo " make test - Run tests"
@echo " make lint - Run black + isort"
@echo " make uninstall - Remove conda environment"

uninstall:
conda env remove -n condor -y

stop:
docker compose down
# Interactive setup (creates .env file)
setup:
chmod +x setup-environment.sh
./setup-environment.sh

# Install conda environment
install:
Expand All @@ -19,16 +25,35 @@ install:
else \
conda env create -f environment.yml; \
fi
$(MAKE) setup-chrome

# Docker setup
setup:
chmod +x setup-environment.sh
./setup-environment.sh
# Install Chrome for Kaleido (must run after conda env is created)
setup-chrome:
@echo "Installing Chrome for Plotly image generation..."
@conda run -n condor python -c "import kaleido; kaleido.get_chrome_sync()" 2>/dev/null || \
echo "Chrome installation skipped (not required for basic usage)"

# Run locally (dev mode)
run:
run:
conda run --no-capture-output -n condor python main.py

# Deploy with Docker
deploy:
docker compose up -d

# Stop Docker containers
stop:
docker compose down

# Run tests
test:
conda run -n condor pytest

# Lint and format code
lint:
conda run -n condor black .
conda run -n condor isort .

# Remove conda environment
uninstall:
conda env remove -n condor -y
151 changes: 77 additions & 74 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,19 @@ A Telegram bot for monitoring and trading with Hummingbot via the Backend API.

## Quick Start

**Prerequisites:** Python 3.11+, Conda, Hummingbot Backend API running, Telegram Bot Token
**Prerequisites:** Python 3.12+, Conda, Hummingbot Backend API running, Telegram Bot Token

```bash
# clone repo
git clone https://github.com/hummingbot/condor.git
cd condor
# environment setup
conda env create -f environment.yml
conda activate condor

# Configure
cp .env.example .env
# Edit .env with your credentials:
# - TELEGRAM_TOKEN
# - TELEGRAM_ALLOWED_IDS
# - OPENAI_API_KEY (optional, for AI features)

# Run
python main.py

# Option 1: Local Python
make install # Interactive setup + conda environment
make run # Start the bot

# Option 2: Docker
make setup # Interactive configuration
make deploy # Start with Docker Compose
```

## Commands
Expand All @@ -40,73 +34,55 @@ python main.py
|---------|-------------|
| `/portfolio` | Portfolio dashboard with PNL indicators, holdings, and graphs |
| `/bots` | All active bots with status and metrics |
| `/bots <name>` | Specific bot details |
| `/clob_trading` | CLOB trading menu (place orders, manage positions) |
| `/dex_trading` | DEX trading menu (swaps, pools, liquidity positions) |
| `/config` | Configuration menu (servers, API keys) |
| `/trade <question>` | AI assistant (disabled, coming soon) |
| `/trade` | CEX trading menu (spot & perpetual orders, positions) |
| `/swap` | DEX swap trading (quotes, execution, history) |
| `/lp` | DEX liquidity pool management (positions, pools) |
| `/routines` | Auto-discoverable Python scripts with scheduling |
| `/config` | Configuration menu (servers, API keys, Gateway, admin) |

## Architecture

```
Telegram → Condor Bot → Hummingbot Backend API → Trading Bots
↘ Gateway → DEX Protocols
↘ GPT-4o → MCP (Docker) → Hummingbot API (future)
```

### Direct API Commands
- `/portfolio`, `/bots`, `/clob_trading`, `/dex_trading` use direct API calls via `hummingbot_api_client`
- Fast, reliable, interactive button menus

### AI Assistant (Future)
- `/trade` uses GPT-4o + MCP server with access to all Hummingbot tools
- Natural language interface for market data, portfolio queries, and more
All commands use direct API calls via `hummingbot_api_client` with interactive button menus.

## Project Structure

```
condor/
├── handlers/ # Telegram command handlers
│ ├── bots.py # /bots command
│ ├── portfolio.py # /portfolio command with dashboard
│ ├── trade_ai.py # /trade AI assistant (disabled)
│ ├── clob/ # CLOB trading module
│ │ ├── __init__.py # Main command, callback router
│ │ ├── menu.py # Trading menu with overview
│ │ ├── place_order.py # Order placement flow
│ │ ├── leverage.py # Leverage/position mode config
│ │ ├── orders.py # Order search/cancel
│ │ ├── positions.py # Position management
│ │ └── account.py # Account switching
│ ├── dex/ # DEX trading module
│ ├── bots/ # Bot monitoring module
│ │ ├── __init__.py # /bots command
│ │ ├── menu.py # Bot status display
│ │ └── controllers/ # Bot controller configs
│ ├── cex/ # CEX trading module (/trade)
│ │ ├── __init__.py # Main command, callback router
│ │ ├── menu.py # Trading menu with balances
│ │ ├── swap_quote.py # Get swap quotes
│ │ ├── swap_execute.py # Execute swaps
│ │ ├── swap_history.py # Swap history/status
│ │ └── pools.py # Pool discovery & LP management
│ └── config/ # Configuration module
│ ├── __init__.py # /config command
│ ├── servers.py # API server management
│ ├── api_keys.py # Exchange credentials
│ └── user_preferences.py # User preference storage
│ │ ├── trade.py # Order placement
│ │ ├── orders.py # Order management
│ │ └── positions.py # Position tracking
│ ├── dex/ # DEX trading module (/swap, /lp)
│ │ ├── __init__.py # Main commands, callback router
│ │ ├── swap.py # Quote, execute, history
│ │ ├── liquidity.py # LP positions management
│ │ └── pools.py # Pool info and discovery
│ ├── config/ # Configuration module (/config)
│ │ ├── __init__.py # Main command
│ │ ├── servers.py # API server management
│ │ ├── api_keys.py # Exchange credentials
│ │ └── gateway/ # Gateway configuration
│ ├── routines/ # Routines module (/routines)
│ │ └── __init__.py # Script discovery and execution
│ └── admin/ # Admin panel (via /config)
├── routines/ # User-defined automation scripts
├── utils/ # Utilities
│ ├── auth.py # @restricted decorator
│ ├── telegram_formatters.py # Message formatting
│ ├── portfolio_graphs.py # Dashboard chart generation
│ └── trading_data.py # Data aggregation helpers
├── servers/ # Server management
│ ├── server_manager.py # Server CRUD & client pool
│ └── servers.yml # Server configuration
│ ├── auth.py # @restricted, @admin_required decorators
│ └── telegram_formatters.py # Message formatting
├── config_manager.py # Unified config (servers, users, permissions)
├── hummingbot_api_client/ # API client library
├── hummingbot_mcp/ # MCP AI tools (Docker)
├── flows/ # Documentation
│ ├── bots_flow.txt # /bots command flow
│ ├── portfolio_flow.txt # /portfolio command flow
│ ├── clob_trading_flow.txt # CLOB trading flow
│ ├── dex_trading_flow.txt # DEX trading flow
│ ├── config_flow.txt # Configuration flow
│ └── common_patterns.txt # Shared patterns
└── main.py # Entry point
```

Expand All @@ -121,7 +97,7 @@ condor/
- **Dashboard** - Combined chart with value history, token distribution, account breakdown
- **Settings** - Configure time period (1d, 3d, 7d, 14d, 30d)

### CLOB Trading (`/clob_trading`)
### CEX Trading (`/trade`)
- **Overview** - Account balances, positions, orders at a glance
- **Place Orders** - Interactive menu with dual input (buttons + direct text)
- Toggle: side, order type, position mode
Expand All @@ -131,15 +107,24 @@ condor/
- **Search Orders** - View/filter/cancel orders
- **Manage Positions** - View, trade, close positions with confirmation

### DEX Trading (`/dex_trading`)
### DEX Swaps (`/swap`)
- **Gateway Balances** - Token balances across DEX wallets
- **Swap Quote** - Get quotes before executing
- **Execute Swap** - Perform swaps with slippage control
- **Quick Swap** - Repeat last swap with minimal input

### Liquidity Pools (`/lp`)
- **Pool Discovery** - Search pools by connector and token
- **Pool Info** - Detailed pool stats with liquidity charts
- **LP Positions** - Manage CLMM positions (add, close, collect fees)

### Routines (`/routines`)
- **Auto-Discovery** - Python scripts auto-discovered from `routines/` folder
- **Pydantic Config** - Type-safe configuration with descriptions
- **One-shot Scripts** - Run once, optionally schedule (interval or daily)
- **Continuous Scripts** - Long-running tasks with start/stop control
- **Multi-instance** - Run multiple instances with different configs

### Configuration (`/config`)
- **API Servers** - Add, modify, delete Hummingbot Backend API servers
- Real-time status checking (online/offline/auth error)
Expand All @@ -155,48 +140,66 @@ condor/
Preferences are automatically saved and persist across sessions:

- **Portfolio** - Graph time period (days, interval)
- **CLOB** - Active account, last order parameters
- **CEX** - Active account, last order parameters
- **DEX** - Default network/connector, last swap parameters
- **General** - Active server

## Security

- **User ID Whitelist** - Only `TELEGRAM_ALLOWED_IDS` can access
- **Admin Whitelist** - Only `ADMIN_USER_ID` has initial access
- **Role-Based Access** - Admin, User, Pending, Blocked roles
- **@restricted Decorator** - Applied to all command handlers
- **Environment Credentials** - API keys stored in `.env`
- **Secret Masking** - Passwords hidden in UI

## Configuration Files

### `.env`
```bash
TELEGRAM_TOKEN=your_bot_token
TELEGRAM_ALLOWED_IDS=123456789,987654321
ADMIN_USER_ID=123456789
OPENAI_API_KEY=sk-... # Optional, for AI features
```

### `servers.yml`
### `config.yml` (auto-created on first run)
```yaml
default_server: main
servers:
main:
host: localhost
port: 8000
username: admin
password: admin
enabled: true
default_server: main
admin_id: 123456789
users: {}
server_access: {}
chat_defaults: {}
audit_log: []
```

## Troubleshooting

| Issue | Solution |
|-------|----------|
| Bot not responding | Check `TELEGRAM_TOKEN` and `TELEGRAM_ALLOWED_IDS` |
| Bot not responding | Check `TELEGRAM_TOKEN` and `ADMIN_USER_ID` in `.env` |
| Access pending | Admin must approve user via /config > Admin Panel |
| Commands failing | Verify Hummingbot API is running |
| Connection refused | Check server host:port in `/config` |
| Auth error | Verify server credentials |
| DEX features unavailable | Ensure Gateway is configured and running |

## Docker Deployment

```bash
# Setup and run with Docker
make setup # Interactive configuration
docker compose up -d
```

Volumes mounted:
- `condor_bot_data.pickle` - User preferences and state
- `config.yml` - Server and permission configuration
- `routines/` - Custom automation scripts

## Development

### Flow Documentation
Expand Down
Loading