Add live report export utilities
- export-live-report.py: Export from binary deal files - create-live-report.sh: Create report from screenshot/terminal data - Allows creating browser-viewable reports with current live data - Uses ,935 profit from March 21 screenshot
This commit is contained in:
196
create-live-report.sh
Executable file
196
create-live-report.sh
Executable file
@@ -0,0 +1,196 @@
|
||||
#!/bin/bash
|
||||
# create-live-report.sh - Create HTML report from live MT5 data (screenshot/terminal)
|
||||
# Usage: ./create-live-report.sh [profit_amount] [balance] [trades]
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
# Colors
|
||||
GREEN='\033[0;32m'
|
||||
BLUE='\033[0;34m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m'
|
||||
|
||||
echo -e "${BLUE}=== Create Live Trading Report ===${NC}"
|
||||
echo ""
|
||||
|
||||
# Get current data from screenshot or user input
|
||||
if [ -z "$1" ]; then
|
||||
echo "Enter current trading data from your MT5 terminal:"
|
||||
echo ""
|
||||
read -p "Current Profit (e.g., 6935.12): " PROFIT
|
||||
read -p "Current Balance (e.g., 106935.12): " BALANCE
|
||||
read -p "Total Trades (e.g., 45): " TRADES
|
||||
read -p "Account Number (default: 104125640): " ACCOUNT
|
||||
ACCOUNT=${ACCOUNT:-104125640}
|
||||
else
|
||||
PROFIT=$1
|
||||
BALANCE=${2:-$((100000 + PROFIT))}
|
||||
TRADES=${3:-45}
|
||||
ACCOUNT=${4:-104125640}
|
||||
fi
|
||||
|
||||
# Validate
|
||||
if [ -z "$PROFIT" ] || [ -z "$BALANCE" ]; then
|
||||
echo "❌ Error: Profit and Balance are required"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create Python script to generate report
|
||||
python3 << EOFPY
|
||||
import os
|
||||
from datetime import datetime
|
||||
|
||||
profit = float("${PROFIT}")
|
||||
balance = float("${BALANCE}")
|
||||
trades = int("${TRADES}")
|
||||
account = "${ACCOUNT}"
|
||||
starting = 100000.00
|
||||
return_pct = (profit / starting) * 100
|
||||
|
||||
html_content = f'''<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>MT5 Live Trading Report - Account {account}</title>
|
||||
<style>
|
||||
* {{ margin: 0; padding: 0; box-sizing: border-box; }}
|
||||
body {{
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
min-height: 100vh;
|
||||
padding: 20px;
|
||||
}}
|
||||
.container {{
|
||||
max-width: 900px;
|
||||
margin: 0 auto;
|
||||
background: white;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 20px 60px rgba(0,0,0,0.3);
|
||||
overflow: hidden;
|
||||
}}
|
||||
.header {{
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
color: white;
|
||||
padding: 30px;
|
||||
text-align: center;
|
||||
}}
|
||||
.header h1 {{ font-size: 28px; margin-bottom: 10px; }}
|
||||
.live-badge {{
|
||||
display: inline-block;
|
||||
background: #28a745;
|
||||
color: white;
|
||||
padding: 5px 15px;
|
||||
border-radius: 20px;
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
margin-top: 10px;
|
||||
}}
|
||||
.content {{ padding: 30px; }}
|
||||
.metric-box {{
|
||||
background: linear-gradient(135deg, {'#28a745' if profit > 0 else '#dc3545'} 0%, {'#20c997' if profit > 0 else '#c82333'} 100%);
|
||||
color: white;
|
||||
padding: 40px;
|
||||
border-radius: 12px;
|
||||
text-align: center;
|
||||
margin: 20px 0;
|
||||
}}
|
||||
.metric-value {{
|
||||
font-size: 56px;
|
||||
font-weight: bold;
|
||||
margin-bottom: 5px;
|
||||
}}
|
||||
.metric-label {{ font-size: 14px; opacity: 0.9; }}
|
||||
.stats-grid {{
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
||||
gap: 20px;
|
||||
margin-top: 30px;
|
||||
}}
|
||||
.stat-card {{
|
||||
background: #f8f9fa;
|
||||
padding: 25px;
|
||||
border-radius: 10px;
|
||||
text-align: center;
|
||||
}}
|
||||
.stat-value {{
|
||||
font-size: 32px;
|
||||
font-weight: bold;
|
||||
color: #667eea;
|
||||
margin-bottom: 5px;
|
||||
}}
|
||||
.stat-label {{
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
text-transform: uppercase;
|
||||
}}
|
||||
.profit {{ color: #28a745; }}
|
||||
.footer {{
|
||||
background: #f8f9fa;
|
||||
padding: 20px;
|
||||
text-align: center;
|
||||
color: #666;
|
||||
font-size: 12px;
|
||||
}}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="header">
|
||||
<h1>📊 MT5 LIVE Trading Report</h1>
|
||||
<p>Account {account} | Generated: {datetime.now().strftime('%Y-%m-%d %H:%M')}</p>
|
||||
<div class="live-badge">● LIVE DATA FROM TERMINAL</div>
|
||||
</div>
|
||||
|
||||
<div class="content">
|
||||
<div class="metric-box">
|
||||
<div class="metric-value">{'+' if profit > 0 else ''}${profit:,.2f}</div>
|
||||
<div class="metric-label">Current Profit</div>
|
||||
</div>
|
||||
|
||||
<div class="stats-grid">
|
||||
<div class="stat-card">
|
||||
<div class="stat-value">${starting:,.2f}</div>
|
||||
<div class="stat-label">Starting Balance</div>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<div class="stat-value profit">${balance:,.2f}</div>
|
||||
<div class="stat-label">Current Balance</div>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<div class="stat-value" style="color: {'#28a745' if return_pct > 0 else '#dc3545'};">{return_pct:.2f}%</div>
|
||||
<div class="stat-label">Total Return</div>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<div class="stat-value">{trades}</div>
|
||||
<div class="stat-label">Total Trades</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="footer">
|
||||
<p>Live data from MT5 Terminal Screenshot | Strategy: MultiSignal Confluence EA</p>
|
||||
<p>Report generated: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>'''
|
||||
|
||||
timestamp = datetime.now().strftime('%Y%m%d-%H%M%S')
|
||||
output_file = os.path.expanduser(f"~/mt5-live-report-{account}-{timestamp}.html")
|
||||
|
||||
with open(output_file, 'w', encoding='utf-8') as f:
|
||||
f.write(html_content)
|
||||
|
||||
print(f"✅ Live report created: {output_file}")
|
||||
EOFPY
|
||||
|
||||
echo ""
|
||||
echo -e "${GREEN}✅ Report created successfully!${NC}"
|
||||
echo ""
|
||||
echo "To view in browser:"
|
||||
echo " 1. Copy the HTML file to your local machine"
|
||||
echo " 2. Open in any web browser"
|
||||
echo ""
|
||||
ls -la ~/mt5-live-report-*.html 2>/dev/null | tail -1
|
||||
|
||||
Reference in New Issue
Block a user