Function commitAverageBuy

  • Adds a new DCA entry to the active pending signal.

    Adds a new averaging entry at the current market price to the position's entry history. Updates effectivePriceOpen (mean of all entries) and emits an average-buy commit event.

    Automatically detects backtest/live mode from execution context. Automatically fetches current price via getAveragePrice.

    Parameters

    • symbol: string

      Trading pair symbol

    • Optionalcost: number

    Returns Promise<boolean>

    Promise - true if entry added, false if rejected

    import { commitAverageBuy } from "backtest-kit";

    // Add DCA entry at current market price
    const success = await commitAverageBuy("BTCUSDT");
    if (success) {
    console.log("DCA entry added");
    }