import { Alpaca } from "./alpaca";
import { Strategy, Signal } from "./strategy";

export class Executor {
    private alpaca: Alpaca;

    constructor(alpaca: Alpaca) {
        this.alpaca = alpaca;
    }

    async executeSignals(strategy: Strategy, signals: Signal[], totalCapital: number): Promise<void> {
        const strategyCapital = totalCapital * strategy.capitalAllocation;

        for (const signal of signals) {
            if (signal.allocation === 0) continue;

            const dollarAmount = strategyCapital * signal.allocation;
            console.log(
                `[${strategy.name}] ${signal.direction.toUpperCase()} ${signal.symbol} — $${dollarAmount.toFixed(2)}`
            );
        }
    }
}
