- show-latest-report.sh: Auto-finds and displays latest MT5 report - parse-report.py: Python parser for HTML reports with full stats - Updated UTILS.md with documentation - No browser needed - prevents VM crashes - Shows account info, P&L, trade stats, performance assessment
56 lines
1.6 KiB
Bash
Executable File
56 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
# show-latest-report.sh - Display the latest MT5 trading report
|
|
# Usage: ./show-latest-report.sh [--save]
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
REPORT_DIR="${HOME}/mt5-docker/config/.wine/drive_c/users/abc/Desktop"
|
|
|
|
# Colors
|
|
BLUE='\033[0;34m'
|
|
GREEN='\033[0;32m'
|
|
NC='\033[0m'
|
|
|
|
echo -e "${BLUE}=== MT5 Latest Report Finder ===${NC}"
|
|
echo ""
|
|
|
|
# Find latest report
|
|
LATEST_REPORT=$(find "${REPORT_DIR}" -name "ReportHistory-*.html" -type f -printf '%T@ %p\n' 2>/dev/null | sort -n | tail -1 | cut -d' ' -f2-)
|
|
|
|
if [ -z "${LATEST_REPORT}" ]; then
|
|
echo "❌ No report files found!"
|
|
echo ""
|
|
echo "To generate a report:"
|
|
echo " 1. MT5 → History tab → Right-click"
|
|
echo " 2. Select 'Save as Report'"
|
|
echo " 3. Save to Desktop"
|
|
exit 1
|
|
fi
|
|
|
|
# Get file info
|
|
FILENAME=$(basename "${LATEST_REPORT}")
|
|
FILE_DATE=$(stat -c %y "${LATEST_REPORT}" 2>/dev/null | cut -d' ' -f1)
|
|
FILE_SIZE=$(stat -c %s "${LATEST_REPORT}" 2>/dev/null | numfmt --to=iec 2>/dev/null || echo "unknown")
|
|
|
|
echo -e "${GREEN}✅ Found latest report:${NC}"
|
|
echo " File: ${FILENAME}"
|
|
echo " Date: ${FILE_DATE}"
|
|
echo " Size: ${FILE_SIZE}"
|
|
echo ""
|
|
|
|
# Parse and display
|
|
if [ -f "${SCRIPT_DIR}/parse-report.py" ]; then
|
|
python3 "${SCRIPT_DIR}/parse-report.py" "${LATEST_REPORT}"
|
|
else
|
|
echo "Error: parse-report.py not found"
|
|
exit 1
|
|
fi
|
|
|
|
# Save option
|
|
if [ "$1" = "--save" ]; then
|
|
OUTPUT="${HOME}/report-$(date +%Y%m%d-%H%M%S).txt"
|
|
echo ""
|
|
echo "💾 Saving to: ${OUTPUT}"
|
|
python3 "${SCRIPT_DIR}/parse-report.py" "${LATEST_REPORT}" > "${OUTPUT}"
|
|
echo "Saved!"
|
|
fi
|