Files
ai-exchange/scripts/run_reports.py
T
2026-04-24 13:39:01 +08:00

49 lines
1.8 KiB
Python

from pathlib import Path
import sys
ROOT = Path(__file__).resolve().parents[1]
if str(ROOT) not in sys.path:
sys.path.insert(0, str(ROOT))
from src.services.reports import (
BacktestReportService,
IntradayReportService,
PostTradeReviewService,
PreMarketReportService,
)
def main() -> None:
pre_market = PreMarketReportService().build_report(
bias_snapshot={
"daily_bias": "bullish",
"draw_side": "buy_side",
"execution_intensity": "high",
"reason_codes": ["latest_mss", "active_range_available"],
},
dealing_range={"id": 1, "high": 110.0, "low": 90.0, "equilibrium": 100.0},
current_price=98.0,
session_code="LONDON",
)
intraday = IntradayReportService().build_report(
sweep_event={"side_swept": "buy_side", "close_back_inside": True},
structure_event={"event_type": "MSS", "direction": "bullish", "accepted": True},
fvg_zone={"direction": "bullish", "status": "open", "fill_pct": 0.0, "meta": {}},
trade_signal={"status": "awaiting_confirmation", "side": "buy", "session_code": "LONDON", "invalidations": []},
)
review = PostTradeReviewService().build_report(
trade_execution={"status": "open", "meta": {"risk_checks": []}},
trade_signal={"status": "awaiting_confirmation", "invalidations": []},
backtest_result={"outcome": "win", "invalidated_before_entry": False, "error_tags": []},
)
backtest_summary = BacktestReportService().build_summary([])
print(f"Pre-market permission: {pre_market['execution_permission']}")
print(f"Intraday valid: {intraday['signal']['is_valid']}")
print(f"Post-trade aligned: {review['rule_aligned']}")
print(f"Backtest total signals: {backtest_summary['total_signals']}")
if __name__ == "__main__":
main()