#!/bin/bash

echo "๐Ÿ—‘๏ธ Resetting Hyperliquid Trading Bot Data"
echo "========================================="

# Confirm with user
read -p "โš ๏ธ  This will delete ALL trading data, stats, and logs. Are you sure? (yes/no): " confirm

if [ "$confirm" != "yes" ]; then
    echo "โŒ Reset cancelled."
    exit 1
fi

echo "๐Ÿงน Clearing data files..."

# Remove trading statistics
if [ -f "trading_stats.json" ]; then
    rm trading_stats.json
    echo "โœ… Removed trading_stats.json"
fi

# Remove backup stats
rm -f trading_stats.json.backup*
echo "โœ… Removed stats backups"

# Remove alarm data
rm -f alarms.json alarms.db
echo "โœ… Removed alarm data"

# Remove log files
rm -f *.log trading_bot.log*
rm -rf logs/
echo "โœ… Removed log files"

# Remove any temporary files
rm -f *.tmp *.temp
echo "โœ… Removed temporary files"

# Remove any Python cache
rm -rf __pycache__/
rm -rf src/__pycache__/
rm -rf tests/__pycache__/
echo "โœ… Removed Python cache"

echo ""
echo "๐ŸŽ‰ Data reset complete!"
echo ""
echo "๐Ÿ“ What was cleared:"
echo "   โ€ข Trading statistics and P&L history"
echo "   โ€ข All completed trade records"
echo "   โ€ข Daily/weekly/monthly performance data"
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"
echo "   โ€ข All stats will start from zero"
echo "   โ€ข Position tracking will reinitialize"
echo ""
echo "๐Ÿ’ก Next steps:"
echo "   1. Run your bot: python src/telegram_bot.py"
echo "   2. Check /balance to set initial balance"
echo "   3. Start trading to build new statistics"