๐ Project Structure
๐ฏ Single Command Launch
python trading_bot.py # THIS IS ALL YOU NEED TO RUN
๐ Organized Folder Structure
trader_hyperliquid/
โโโ ๐ trading_bot.py # MAIN LAUNCHER (run this!)
โโโ ๐ trading_stats.json # Your persistent statistics
โโโ ๐ .env # Your configuration (create from config/env.example)
โโโ ๐ requirements.txt # Dependencies
โโโ
โโโ ๐ Documentation/
โ โโโ README.md # Complete guide
โ โโโ SETUP_GUIDE.md # 5-minute setup
โ โโโ DEPLOYMENT_GUIDE.md # Advanced deployment
โ โโโ PROJECT_STRUCTURE.md # This file
โ
โโโ ๐ง src/ # Core bot modules
โ โโโ __init__.py
โ โโโ config.py # Configuration management
โ โโโ hyperliquid_client.py # Hyperliquid API wrapper
โ โโโ telegram_bot.py # Telegram interface
โ โโโ trading_stats.py # Statistics engine
โ
โโโ ๐ ๏ธ utils/ # Utility scripts
โ โโโ get_telegram_chat_id.py # Get your Chat ID
โ โโโ demo_stats.py # See sample statistics
โ โโโ simple_bot.py # Terminal interface
โ โโโ strategy_bot.py # Automated strategies
โ โโโ manual_trading_bot.py # Old manual launcher
โ
โโโ โ๏ธ config/
โ โโโ env.example # Configuration template
โ
โโโ ๐ logs/ # Auto-created logs
โ โโโ trading_bot_YYYYMMDD.log # Daily logs
โ โโโ bot_errors.log # Error log
โ
โโโ ๐ venv/ # Python virtual environment
๐ฏ What Each File Does
๐ Main Files (What You Use)
File |
Purpose |
When to Use |
trading_bot.py |
Main launcher |
Always - This is your bot |
trading_stats.json |
Your trading data |
Auto-created, never delete |
.env |
Your configuration |
Create from config/env.example |
๐ Documentation
File |
Purpose |
README.md |
Complete bot documentation |
SETUP_GUIDE.md |
5-minute quick setup |
DEPLOYMENT_GUIDE.md |
Advanced deployment options |
PROJECT_STRUCTURE.md |
This file - folder organization |
๐ง Core Modules (src/
)
File |
Purpose |
config.py |
Loads and validates your .env settings |
hyperliquid_client.py |
Handles all Hyperliquid API calls |
telegram_bot.py |
Your phone interface and trading commands |
trading_stats.py |
Calculates all your performance metrics |
๐ ๏ธ Utilities (utils/
)
File |
Purpose |
When to Use |
get_telegram_chat_id.py |
Find your Chat ID |
Setup only |
demo_stats.py |
See sample statistics |
Optional demo |
simple_bot.py |
Terminal interface |
Testing/debugging |
strategy_bot.py |
Automated strategies |
If you want automation |
๐ Auto-Created Files
File/Folder |
Purpose |
logs/ |
All bot logs and error tracking |
trading_stats.json |
Your persistent trading statistics |
demo_stats.json |
Sample data (can delete) |
๐ How to Use This Structure
1. Initial Setup
# 1. Get your Telegram Chat ID
python utils/get_telegram_chat_id.py
# 2. Configure the bot
cp config/env.example .env
nano .env # Add your keys and Chat ID
# 3. See what stats look like (optional)
python utils/demo_stats.py
2. Daily Usage
# Start your trading bot (ONLY command you need!)
python trading_bot.py
3. Maintenance
# Check logs
tail -f logs/trading_bot_$(date +%Y%m%d).log
# Validate configuration
python -c "import sys; sys.path.insert(0, 'src'); from config import Config; Config.validate()"
๐ก๏ธ Built-in Safety Features
๐ Persistent Statistics
- โ
Always saved to
trading_stats.json
- โ
Survives restarts - your data is never lost
- โ
Automatic backups via comprehensive logging
๐ Auto-Restart
- โ
Up to 10 restart attempts if bot crashes
- โ
Telegram error notifications sent to your phone
- โ
Exponential backoff prevents spam restarts
- โ
Graceful shutdown on Ctrl+C
๐ Comprehensive Logging
- โ
Daily log files in
logs/
folder
- โ
Error tracking with stack traces
- โ
Telegram notifications for errors
- โ
Startup/shutdown notifications
โ๏ธ Configuration Validation
- โ
Checks all required settings before starting
- โ
Clear error messages with setup instructions
- โ
Network warnings (testnet vs mainnet)
- โ
Prevents accidental real trading
๐ฑ Mobile-First Design
Phone Control
- ๐ฑ All trading via Telegram commands
- ๐ Complete statistics on your phone
- ๐ Real-time balance and P&L updates
- ๐ Professional trading metrics
Error Notifications
- ๐จ Instant error alerts to your phone
- ๐ Restart notifications
- ๐ข Startup confirmations
- ๐ Status updates
๐ฏ Key Benefits of This Structure
- ๐ Single Command:
python trading_bot.py
- that's it!
- ๐ Persistent Data: Your stats survive forever
- ๐ก๏ธ Auto-Recovery: Bot restarts itself on errors
- ๐ฑ Phone Alerts: Get notified of any issues
- ๐ Complete Logs: Full audit trail of everything
- โ๏ธ Easy Setup: Organized configuration and setup tools
- ๐ง Modular: Clean separation of concerns
๐ก Pro Tips
Keep It Simple
- Only use
trading_bot.py
for daily trading
- Let the bot handle all restarts and errors
- Check Telegram for status and error notifications
Backup Your Data
- Your
.env
file (contains your keys)
- Your
trading_stats.json
file (your performance data)
- Archive log files periodically
Monitor Performance
- Use
/stats
command in Telegram regularly
- Check daily logs for any issues
- Monitor error notifications
This structure gives you professional-grade trading infrastructure with simple phone control! ๐๐ฑ