Function getTotalPercentHeld

  • Returns the still-held share of the position as a percentage. 100 = nothing has been closed (full position), 0 = fully closed. Correctly accounts for DCA entries between partial closes.

    Automatically detects backtest/live mode from execution context.

    Parameters

    • symbol: string

      Trading pair symbol

    Returns Promise<number>

    Promise - held percentage (0–100)

    import { getTotalPercentHeld } from "backtest-kit";

    const heldPct = await getTotalPercentHeld("BTCUSDT");
    console.log(`Holding ${heldPct}% of position`);