import argparse
from .config import RunConfig, DataConfig
from .pipeline import run_pipeline


def build_arg_parser() -> argparse.ArgumentParser:
    p = argparse.ArgumentParser(description="OHLCV Predictor Pipeline")
    p.add_argument("--csv", dest="csv_path", required=False, default="../data/btcusd_1-min_data.csv")
    p.add_argument("--min-date", dest="min_date", required=False, default="2017-06-01")
    p.add_argument("--max-date", dest="max_date", required=False, default=None)
    return p


def main() -> None:
    parser = build_arg_parser()
    args = parser.parse_args()
    run_cfg = RunConfig(
        data=DataConfig(csv_path=args.csv_path, min_date=args.min_date, max_date=args.max_date)
    )
    metrics = run_pipeline(run_cfg)
    print(
        f"RMSE={metrics['rmse']:.6f}, MAPE={metrics['mape']:.4f}%, R2={metrics['r2']:.6f}, DirAcc={metrics['directional_accuracy']:.4f}"
    )


if __name__ == "__main__":
    main()


