summaryrefslogtreecommitdiff
path: root/cli/src/trading_cli/commands/backtest.py
blob: 40617b6bec8a4e8e205359d9b61fc625f6b34ffa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import click


@click.group()
def backtest():
    """Backtesting commands."""
    pass


@backtest.command()
@click.option("--strategy", required=True, help="Strategy name to backtest")
@click.option("--symbol", required=True, help="Trading symbol (e.g. BTCUSDT)")
@click.option("--from", "from_date", required=True, help="Start date (ISO format)")
@click.option("--to", "to_date", default=None, help="End date (ISO format, defaults to now)")
@click.option("--balance", default=10000.0, show_default=True, help="Initial balance in USDT")
def run(strategy, symbol, from_date, to_date, balance):
    """Run a backtest for a strategy."""
    to_label = to_date or "now"
    click.echo(f"Running backtest: strategy={strategy}, symbol={symbol}, {from_date} → {to_label}, balance={balance}...")


@backtest.command()
@click.option("--id", "backtest_id", required=True, help="Backtest run ID")
def report(backtest_id):
    """Show a backtest report by ID."""
    click.echo(f"Showing backtest report for ID: {backtest_id}...")