Complete directory structure and file organization for the Hyperliquid Trading Bot
trader_hyperliquid/
โโโ ๐ src/ # Source code
โ โโโ ๐ telegram_bot.py # Main Telegram bot
โ โโโ ๐ hyperliquid_client.py # Hyperliquid API client
โ โโโ โ๏ธ config.py # Configuration management
โ โโโ ๐ trading_stats.py # Statistics tracking
โโโ ๐ tests/ # Test suite
โ โโโ ๐ README.md # Test documentation
โ โโโ ๐ run_all_tests.py # Test runner
โ โโโ ๐งช test_config.py # Configuration tests
โ โโโ ๐ฐ test_balance.py # Balance tests
โ โโโ ๐ test_perps_commands.py # Trading tests
โ โโโ ๐ช test_exit_command.py # Exit command tests
โ โโโ ๐ test_order_management.py # Order management tests
โโโ ๐ docs/ # Documentation
โ โโโ ๐ README.md # Documentation index
โ โโโ ๐ commands.md # Command reference
โ โโโ ๐ setup.md # Setup guide
โ โโโ ๐๏ธ project-structure.md # This file
โ โโโ ๐ deployment.md # Deployment guide
โโโ ๐ config/ # Configuration files
โ โโโ ๐ .env.example # Environment template
โโโ ๐ logs/ # Log files
โโโ ๐ utils/ # Utility scripts
โโโ ๐ __pycache__/ # Python cache
โโโ ๐ venv/ # Virtual environment
โโโ ๐ README.md # Main project README
โโโ ๐ requirements.txt # Python dependencies
โโโ ๐ .gitignore # Git ignore rules
โโโ ๐ telegram_bot.py # Bot entry point (legacy)
โโโ ๐ trading_bot.py # Trading bot (legacy)
โโโ ๐ demo_stats.py # Demo statistics
Main Telegram bot implementation
Key Classes:
TelegramTradingBot
- Main bot classKey Methods:
start_command()
- Bot startuplong_command()
- Long positionshort_command()
- Short positionexit_command()
- Close positionsorders_command()
- Order managementcoo_command()
- Cancel ordersHyperliquid API client using CCXT
Key Classes:
HyperliquidClient
- API wrapperKey Methods:
get_balance()
- Fetch account balanceget_positions()
- Get open positionsget_open_orders()
- Fetch ordersplace_market_order()
- Market ordersplace_limit_order()
- Limit orderscancel_order()
- Cancel ordersConfiguration management
Key Classes:
Config
- Configuration managerKey Methods:
validate()
- Validate settingsget_hyperliquid_config()
- CCXT configTrading statistics and performance tracking
Key Classes:
TradingStats
- Statistics managerKey Methods:
record_trade()
- Log tradesget_basic_stats()
- Basic metricsformat_stats_message()
- Telegram formattingTest runner for all test modules
Documentation index and navigation
Complete command reference
Quick setup guide
This file - complete project organization
Production deployment guide
Environment variable template
# Hyperliquid API
HYPERLIQUID_PRIVATE_KEY=0x...
HYPERLIQUID_TESTNET=true
# Telegram Bot
TELEGRAM_BOT_TOKEN=...
TELEGRAM_CHAT_ID=...
TELEGRAM_ENABLED=true
# Trading Settings
DEFAULT_TRADING_SYMBOL=BTC/USDC:USDC
DEFAULT_TRADE_AMOUNT=100
LOG_LEVEL=INFO
Demo statistics generator for testing
Sample statistics data
Application log files (created at runtime)
Legacy bot entry point - use src/telegram_bot.py
instead
Legacy trading bot - functionality moved to src/
# Main bot
python src/telegram_bot.py
# Tests
python tests/run_all_tests.py
# Main bot
python -m src.telegram_bot
# Individual tests
python tests/test_config.py
ccxt>=4.2.0
python-telegram-bot>=20.0
python-dotenv>=1.0.0
requests>=2.31.0
python -m venv venv
source venv/bin/activate # Linux/Mac
venv\Scripts\activate # Windows
pip install -r requirements.txt
.env
docs/setup.md
tests/run_all_tests.py
src/
docs/
docs/deployment.md
Happy coding! ๐๐ฑ