58 lines
2.5 KiB
Bash
Executable File
58 lines
2.5 KiB
Bash
Executable File
#!/bin/bash
|
|
# Simple MEV Bot Opportunity Monitor
|
|
# Shows only arbitrage opportunities detected
|
|
|
|
echo "════════════════════════════════════════════════════════════"
|
|
echo "🎯 MEV Bot Opportunity Monitor"
|
|
echo "════════════════════════════════════════════════════════════"
|
|
echo ""
|
|
echo "Watching: logs/mev-bot.log"
|
|
echo "Press Ctrl+C to stop"
|
|
echo "════════════════════════════════════════════════════════════"
|
|
echo ""
|
|
|
|
# Color codes
|
|
GREEN='\033[0;32m'
|
|
RED='\033[0;31m'
|
|
YELLOW='\033[1;33m'
|
|
NC='\033[0m'
|
|
|
|
COUNT=0
|
|
|
|
tail -f logs/mev-bot.log | grep --line-buffered "OPPORTUNITY DETECTED" | while read line; do
|
|
COUNT=$((COUNT + 1))
|
|
TIMESTAMP=$(echo "$line" | grep -oP '\d{4}/\d{2}/\d{2} \d{2}:\d{2}:\d{2}')
|
|
|
|
# Check if executable
|
|
if echo "$line" | grep -q "isExecutable:true"; then
|
|
echo -e "${GREEN}[$TIMESTAMP] ✅ #$COUNT - EXECUTABLE OPPORTUNITY!${NC}"
|
|
|
|
# Extract profit
|
|
PROFIT=$(echo "$line" | grep -oP 'netProfitETH:[0-9.-]+' | cut -d: -f2)
|
|
echo -e "${GREEN} 💰 Net Profit: $PROFIT ETH${NC}"
|
|
else
|
|
echo -e "${YELLOW}[$TIMESTAMP] 🎯 #$COUNT - Opportunity (not profitable)${NC}"
|
|
|
|
# Extract net profit
|
|
PROFIT=$(echo "$line" | grep -oP 'netProfitETH:-?[0-9.]+' | cut -d: -f2)
|
|
if [[ -n "$PROFIT" ]]; then
|
|
echo -e "${RED} ❌ Net Profit: $PROFIT ETH (loss)${NC}"
|
|
fi
|
|
|
|
# Extract reason
|
|
REASON=$(echo "$line" | grep -oP 'rejectReason:[^}]+' | cut -d: -f2 | head -c 60)
|
|
if [[ -n "$REASON" ]]; then
|
|
echo -e "${RED} ⚠️ Reason: $REASON${NC}"
|
|
fi
|
|
fi
|
|
echo ""
|
|
|
|
# Show stats every 10 opportunities
|
|
if [ $((COUNT % 10)) -eq 0 ]; then
|
|
echo -e "${YELLOW}────────────────────────────────────────────────────────────${NC}"
|
|
echo -e "${YELLOW}📊 Total opportunities detected: $COUNT${NC}"
|
|
echo -e "${YELLOW}────────────────────────────────────────────────────────────${NC}"
|
|
echo ""
|
|
fi
|
|
done
|