123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- #!/bin/bash
- echo "🗑️ Resetting Hyperliquid Trading Bot Data"
- echo "========================================="
- # Confirm with user
- read -p "⚠️ This will delete ALL trading data, state, alarms, and logs. Are you sure? (yes/no): " confirm
- if [ "$confirm" != "yes" ]; then
- echo "❌ Reset cancelled."
- exit 1
- fi
- echo "🧹 Clearing data files..."
- DATA_DIR="data"
- # Create data directory if it doesn't exist (for idempotency, though removal is primary goal)
- # mkdir -p $DATA_DIR
- # Remove trading statistics
- if [ -f "$DATA_DIR/trading_stats.sqlite" ]; then
- rm "$DATA_DIR/trading_stats.sqlite"
- echo "✅ Removed $DATA_DIR/trading_stats.sqlite"
- fi
- # Remove legacy files (if they still exist)
- rm -f "$DATA_DIR/trading_stats.json"
- rm -f trading_stats.json.backup* # Old root backups
- rm -f "$DATA_DIR/trading_stats.json.backup*"
- echo "✅ Removed legacy stats files (if any)"
- # Remove market monitor state (legacy - now in SQLite)
- rm -f "$DATA_DIR/market_monitor_state.json"
- echo "✅ Removed legacy market monitor state (if any)"
- # Remove legacy bot state files (no longer used - all state now in SQLite)
- rm -f "$DATA_DIR/trading_engine_state.json"
- rm -f "bot_state.json"
- echo "✅ Removed legacy bot state files (if any)"
- # Remove alarm data
- if [ -f "$DATA_DIR/price_alarms.json" ]; then
- rm "$DATA_DIR/price_alarms.json"
- echo "✅ Removed $DATA_DIR/price_alarms.json"
- fi
- rm -f alarms.json alarms.db # Legacy alarm files at root
- echo "✅ Removed legacy alarm data from root (if any)"
- # Optionally, remove the entire data directory if it's now empty
- # Check if directory exists and is empty
- if [ -d "$DATA_DIR" ] && [ -z "$(ls -A $DATA_DIR)" ]; then
- rmdir "$DATA_DIR"
- echo "✅ Removed empty $DATA_DIR directory"
- elif [ -d "$DATA_DIR" ]; then
- echo "ℹ️ $DATA_DIR directory still contains other files."
- fi
- # Remove log files
- rm -f *.log # Root logs (if any)
- rm -rf logs/
- echo "✅ Removed log files and logs/ directory"
- # Remove any temporary files
- rm -f *.tmp *.temp
- echo "✅ Removed temporary files"
- # Remove any Python cache
- find . -type d -name "__pycache__" -exec rm -rf {} +
- echo "✅ Removed Python cache directories"
- echo ""
- echo "🎉 Data reset complete!"
- echo ""
- echo "📝 What was cleared:"
- echo " • Persistent data from the '$DATA_DIR/' directory (stats, state, alarms)"
- echo " • Log files from 'logs/' directory and root"
- echo " • Legacy data files from the root directory (if found)"
- echo " • Trading statistics and P&L history"
- echo " • All completed trade records"
- echo " • Daily/weekly/monthly performance data"
- echo " • Bot state persistence (pending stop losses, order tracking)"
- echo " • Price alarms and notifications"
- echo " • Log files and debugging data"
- echo " • Enhanced position tracking data"
- echo ""
- echo "🚀 Your bot is now ready for a fresh start!"
- echo " • Initial balance will be reset by the bot logic"
- echo " • All stats will start from zero"
- echo " • Position tracking will reinitialize"
- echo " • Bot state persistence will restart fresh"
- echo " • Pending stop losses will be cleared"
- echo ""
- echo "💡 Next steps:"
- echo " 1. Run your bot: python trading_bot.py (or your main script)"
- echo " 2. Check /balance for initial balance status"
- echo " 3. Start trading to build new statistics"
|