Files
mymt5opp/scripts/check_first_trades.py
gavindiaz 63a829cc46 phase 7-8 完成 + warmup 修复 + 产物结构化重组
主要内容:
- Phase 8 PROMOTE: finalist #1 (trial #324) registry 条目,自动生成
- Optuna objective warmup bug 修复 (shared/optimizer/objective.py)
- studies/ 目录按用途重组为 optuna/ + finalists/ + features/ 三层
- reports/ 加入 Optuna 中文 dashboard (5 主图 + 18 slice + 15 contour)
- 新增 PROJECT_GUIDE.md 项目说明文档
- 新增 build_registry_entry.py / build_optuna_dashboard.py / build_feature_datasets.py
- .gitignore: 允许提交 studies/*.db (Optuna DB) 和 reports/*.html (MT5 + dashboard)
2026-06-27 00:28:07 +08:00

34 lines
1.4 KiB
Python

"""Dump first/last trade rows from each MT5 report to confirm test window."""
from pathlib import Path
from lxml import html
for label, fn in [("IS", "IS-ReportTester-52845377.html"), ("OOS", "OOS-ReportTester-52845377.html")]:
p = Path("reports") / fn
raw = p.read_bytes()
text = raw.decode("utf-16") if raw[:2] in (b"\xff\xfe", b"\xfe\xff") else raw.decode("utf-8", errors="replace")
tree = html.fromstring(text)
print(f"=== {label} ({fn}) ===")
# Trade rows have 13 cells (Time, Deal, Symbol, Type, Direction, Volume,
# Price, Order, Commission, Fee, Swap, Profit, Balance, Comment)
trade_rows = []
for row in tree.iter("tr"):
cells = row.findall("td")
if len(cells) != 13:
continue
# First cell is a timestamp like '2025.01.02 15:50:00'
first = (cells[0].text_content() or "").strip()
if "20" in first and ":" in first:
trade_rows.append([c.text_content().strip()[:30] for c in cells])
print(f" total trade rows: {len(trade_rows)}")
if trade_rows:
print(f" first 3 trades:")
for r in trade_rows[:3]:
print(f" {r[0]:<22} {r[3]:<5} {r[4]:<4} lots={r[5]:<6} price={r[6]:<10} pnl={r[10]:<8} bal={r[11]}")
print(f" last 3 trades:")
for r in trade_rows[-3:]:
print(f" {r[0]:<22} {r[3]:<5} {r[4]:<4} lots={r[5]:<6} price={r[6]:<10} pnl={r[10]:<8} bal={r[11]}")
print()