Function getPositionPartials

  • Returns the list of partial close events for the current pending signal.

    Each element represents a partial profit or loss close executed via commitPartialProfit / commitPartialLoss (or their Cost variants).

    Returns null if no pending signal exists. Returns an empty array if no partials were executed yet.

    Each entry contains:

    • type — "profit" or "loss"
    • percent — percentage of position closed at this partial
    • currentPrice — execution price of the partial close
    • costBasisAtClose — accounting cost basis at the moment of this partial
    • entryCountAtClose — number of DCA entries accumulated at this partial

    Parameters

    • symbol: string

      Trading pair symbol

    Returns Promise<
        {
            costBasisAtClose: number;
            currentPrice: number;
            entryCountAtClose: number;
            percent: number;
            timestamp: number;
            type: "profit"
            | "loss";
        }[],
    >

    Promise resolving to array of partial close records or null

    import { getPositionPartials } from "backtest-kit";

    const partials = await getPositionPartials("BTCUSDT");
    // No partials yet: []
    // After one partial profit: [{ type: "profit", percent: 50, currentPrice: 45000, ... }]