Type Alias BrokerTrailingTakePayload

BrokerTrailingTakePayload: {
    backtest: boolean;
    context: {
        exchangeName: ExchangeName;
        frameName?: FrameName;
        strategyName: StrategyName;
    };
    currentPrice: number;
    newTakeProfitPrice: number;
    percentShift: number;
    position: "long"
    | "short";
    symbol: string;
    takeProfitPrice: number;
}

Payload for a trailing take-profit update broker event.

Forwarded to the registered IBroker adapter via onTrailingTakeCommit. Called explicitly after all validations pass, before strategyCoreService.trailingTake(). newTakeProfitPrice is the absolute TP price computed from percentShift + original TP + effectivePriceOpen.

Type declaration

  • backtest: boolean

    true when called during a backtest run — adapter should skip exchange calls

  • context: {
        exchangeName: ExchangeName;
        frameName?: FrameName;
        strategyName: StrategyName;
    }

    Strategy/exchange/frame routing context

  • currentPrice: number

    Current market price used for intrusion validation

  • newTakeProfitPrice: number

    Absolute take-profit price after applying percentShift

  • percentShift: number

    Percentage shift applied to the ORIGINAL TP distance (-100 to 100)

  • position: "long" | "short"

    Position direction

  • symbol: string

    Trading pair symbol, e.g. "BTCUSDT"

  • takeProfitPrice: number

    Active take profit price at the time of the trailing update

// LONG: entry=100, originalTP=110, percentShift=-3 → newTP=107
const payload: BrokerTrailingTakePayload = {
symbol: "BTCUSDT",
percentShift: -3,
currentPrice: 102,
newTakeProfitPrice: 107,
context: { strategyName: "my-strategy", exchangeName: "binance", frameName: "1h" },
backtest: false,
};