from pathlib import Path from okx_codex_trader.report import render_report_html def test_render_report_html_contains_metrics_trade_table_and_plot_frame(): html = render_report_html( symbol="BTC-USDT-SWAP", bar="1H", leverage=2, stats={ "Return [%]": 12.5, "Win Rate [%]": 66.7, "Max. Drawdown [%]": -8.2, "# Trades": 3, }, trades=[ { "side": "Long", "entry_time": "2026-04-01 00:00", "exit_time": "2026-04-02 00:00", "entry_price": 70000.0, "exit_price": 72000.0, "pnl": 200.0, "return_pct": 2.8, } ], plot_filename="report.plot.html", ) assert "BTC-USDT-SWAP" in html assert "1H" in html assert "Leverage" in html assert "Return [%]" in html assert "Trade Journal" in html assert "report.plot.html" in html assert "2026-04-01 00:00" in html assert "Long" in html