Type Alias BrokerBreakevenPayload

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

Payload for a breakeven operation broker event.

Forwarded to the registered IBroker adapter via onBreakevenCommit. Called explicitly after all validations pass, before strategyCoreService.breakeven(). newStopLossPrice equals effectivePriceOpen (entry price). newTakeProfitPrice equals _trailingPriceTakeProfit ?? priceTakeProfit (TP is unchanged).

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 at the moment breakeven is triggered

  • newStopLossPrice: number

    New stop-loss price = effectivePriceOpen (the position's effective entry price)

  • newTakeProfitPrice: number

    Effective take-profit price = _trailingPriceTakeProfit ?? priceTakeProfit (unchanged by breakeven)

  • position: "long" | "short"

    Position direction

  • symbol: string

    Trading pair symbol, e.g. "BTCUSDT"

// LONG: entry=100, currentPrice=100.5, newSL=100 (entry), newTP=110 (unchanged)
const payload: BrokerBreakevenPayload = {
symbol: "BTCUSDT",
currentPrice: 100.5,
newStopLossPrice: 100,
newTakeProfitPrice: 110,
context: { strategyName: "my-strategy", exchangeName: "binance", frameName: "1h" },
backtest: false,
};