Skip to main content

Documentation Index

Fetch the complete documentation index at: https://condor.hummingbot.org/llms.txt

Use this file to discover all available pages before exploring further.

Global routines in ~/condor/routines/ are available to all agents. Condor includes several built-in routines for common trading tasks.

Built-in Routines

RoutineTypeDescription
hello_worldOne-shotSimple example routine for testing
market_scannerOne-shotScan markets for trading opportunities
bot_reportOne-shotGenerate performance reports for running bots
arb_checkOne-shotCheck for arbitrage opportunities across exchanges
price_monitorContinuousMonitor price and alert on threshold changes

Directory Structure

~/condor/routines/
β”œβ”€β”€ __init__.py
β”œβ”€β”€ base.py              # Routine discovery and base classes
β”œβ”€β”€ hello_world.py       # Simple example routine
β”œβ”€β”€ market_scanner.py    # Market scanning routine
β”œβ”€β”€ bot_report.py        # Bot performance reports
β”œβ”€β”€ arb_check.py         # Arbitrage checking
└── price_monitor.py     # Continuous price monitoring

Hello World Example

The simplest routine to understand the structure:
# routines/hello_world.py
from pydantic import BaseModel, Field
from telegram.ext import ContextTypes


class Config(BaseModel):
    """Simple hello world example routine."""

    name: str = Field(default="World", description="Name to greet")
    repeat: int = Field(default=1, description="Number of times to repeat")
    uppercase: bool = Field(default=False, description="Use uppercase")


async def run(config: Config, context: ContextTypes.DEFAULT_TYPE) -> str:
    """Execute the routine."""
    greeting = f"Hello, {config.name}!"

    if config.uppercase:
        greeting = greeting.upper()

    return "\n".join([greeting] * config.repeat)
Run it from Telegram:
/routines β†’ hello_world β†’ Run

Output: Hello, World!

Price Monitor (Continuous)

A continuous routine that monitors price and sends alerts:
# routines/price_monitor.py
from pydantic import BaseModel, Field
from telegram.ext import ContextTypes

# Mark as continuous routine
CONTINUOUS = True


class Config(BaseModel):
    """Live price monitor with configurable alerts."""

    connector: str = Field(default="binance", description="CEX connector name")
    trading_pair: str = Field(default="BTC-USDT", description="Trading pair to monitor")
    threshold_pct: float = Field(default=1.0, description="Alert threshold in %")
    interval_sec: int = Field(default=10, description="Check interval in seconds")


async def run(config: Config, context: ContextTypes.DEFAULT_TYPE) -> str:
    """Monitor price continuously until cancelled."""
    chat_id = context._chat_id
    client = await get_client(chat_id, context=context)

    initial_price = None
    last_price = None

    try:
        while True:
            prices = await client.market_data.get_prices(
                connector_name=config.connector,
                trading_pairs=config.trading_pair
            )
            current_price = prices["prices"].get(config.trading_pair)

            if initial_price is None:
                initial_price = current_price
                last_price = current_price

            # Check threshold and alert if triggered
            change = ((current_price - last_price) / last_price) * 100
            if abs(change) >= config.threshold_pct:
                await context.bot.send_message(
                    chat_id=chat_id,
                    text=f"{'πŸ“ˆ' if change > 0 else 'πŸ“‰'} {config.trading_pair}: ${current_price:,.2f} ({change:+.2f}%)"
                )
                last_price = current_price

            await asyncio.sleep(config.interval_sec)

    except asyncio.CancelledError:
        return "Monitor stopped"

Creating Custom Global Routines

Add your own routines to ~/condor/routines/:
  1. Create a Python file with Config class and run function
  2. The routine is auto-discovered on next Condor start
  3. Access via /routines in Telegram
Global routines are shared across all agents. For agent-specific routines, place them in the agent’s routines/ folder instead.