#!/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"