Test suite for the Hyperliquid Manual Trading Bot
test_config.py
- Validates configuration and environment setuptest_balance.py
- Tests balance fetching with CCXT integrationtest_perps_commands.py
- Tests perps trading logic (/long, /short)test_exit_command.py
- Tests position closing functionality (/exit)test_order_management.py
- Tests enhanced order management (/orders, /coo)test_risk_management.py
- Tests stop loss and take profit commands (/sl, /tp)test_order_monitoring.py
- Tests automatic order monitoring and notificationscd tests
python run_all_tests.py
cd tests
python test_config.py # Test configuration
python test_balance.py # Test balance fetching
python test_perps_commands.py # Test trading commands
python test_exit_command.py # Test exit functionality
python test_order_management.py # Test order management
python test_risk_management.py # Test risk management
python tests/run_all_tests.py # All tests
python tests/test_config.py # Individual test
Each test file follows the same pattern:
#!/usr/bin/env python3
"""
Test description
"""
import sys
from pathlib import Path
# Add project paths
project_root = Path(__file__).parent.parent
sys.path.insert(0, str(project_root))
sys.path.insert(0, str(project_root / 'src'))
# Import modules to test
from hyperliquid_client import HyperliquidClient
from config import Config
def test_function_name():
"""Main test function."""
# Test implementation
return True # or False
if __name__ == "__main__":
success = test_function_name()
sys.exit(0 if success else 1)
Each test provides:
Example output:
🧪 Testing Configuration Setup
==================================================
✅ Configuration valid
🌐 Network: Testnet
🔑 Private Key: 0x1234567890...
🎉 Config test PASSED!
test_new_feature.py
test_<feature_name>.py
After tests pass, verify on Telegram:
# Start bot
python src/telegram_bot.py
# Test commands
/start
/balance
/long BTC 10
/sl BTC 9000
/tp BTC 11000
/orders
/coo BTC
Happy testing! 🧪🚀