Add MT5 helper utilities

- view-report.sh: Read HTML reports without browser
- parse-deals.py: Extract data from binary deal files
- export-history.sh: Safe export guide
- UTILS.md: Documentation for tools

Prevents VM crashes when accessing trading data.
This commit is contained in:
2026-03-21 19:09:24 -04:00
parent 32e5c6a2dd
commit 9575c5ed76
4 changed files with 193 additions and 0 deletions

42
view-report.sh Executable file
View File

@@ -0,0 +1,42 @@
#!/bin/bash
# View MT5 HTML report as text (no browser needed)
REPORT_PATH="$1"
if [ -z "$REPORT_PATH" ]; then
echo "Usage: $0 <path-to-report.htm>"
echo ""
echo "Or find reports automatically:"
find ~/mt5-docker/config/.wine/drive_c/ -name "*.htm" -type f 2>/dev/null | head -5
exit 1
fi
if [ ! -f "$REPORT_PATH" ]; then
echo "Report not found: $REPORT_PATH"
exit 1
fi
echo "=== MT5 Trading Report ==="
echo "File: $REPORT_PATH"
echo ""
# Extract key data from HTML
# Account info
echo "--- Account Info ---"
grep -oE "Account:[^<]+" "$REPORT_PATH" 2>/dev/null | head -1
grep -oE "Name:[^<]+" "$REPORT_PATH" 2>/dev/null | head -1
grep -oE "Balance:[^<]+" "$REPORT_PATH" 2>/dev/null | head -1
grep -oE "Profit:[^<]+" "$REPORT_PATH" 2>/dev/null | head -1
echo ""
echo "--- Trade Summary ---"
grep -oE "Total Net Profit:[^<]+" "$REPORT_PATH" 2>/dev/null
grep -oE "Gross Profit:[^<]+" "$REPORT_PATH" 2>/dev/null
grep -oE "Gross Loss:[^<]+" "$REPORT_PATH" 2>/dev/null
grep -oE "Total Trades:[^<]+" "$REPORT_PATH" 2>/dev/null
grep -oE "Winning Trades:[^<]+" "$REPORT_PATH" 2>/dev/null
grep -oE "Losing Trades:[^<]+" "$REPORT_PATH" 2>/dev/null
echo ""
echo "--- For full HTML, use ---"
echo "cat '$REPORT_PATH' | less"