Type Alias BrokerAverageBuyPayload

BrokerAverageBuyPayload: {
    backtest: boolean;
    context: {
        exchangeName: ExchangeName;
        frameName?: FrameName;
        strategyName: StrategyName;
    };
    cost: number;
    currentPrice: number;
    position: "long"
    | "short";
    priceStopLoss: number;
    priceTakeProfit: number;
    symbol: string;
}

Payload for a DCA average-buy entry broker event.

Forwarded to the registered IBroker adapter via onAverageBuyCommit. Called explicitly after all validations pass, before strategyCoreService.averageBuy(). currentPrice is the market price at which the new DCA entry is added.

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

  • cost: number

    Dollar amount of the new DCA entry (default: CC_POSITION_ENTRY_COST)

  • currentPrice: number

    Market price at which the DCA entry is placed

  • position: "long" | "short"

    Position direction

  • priceStopLoss: number

    Active stop loss price at the time of the DCA entry

  • priceTakeProfit: number

    Active take profit price at the time of the DCA entry

  • symbol: string

    Trading pair symbol, e.g. "BTCUSDT"

const payload: BrokerAverageBuyPayload = {
symbol: "BTCUSDT",
currentPrice: 42000,
cost: 100,
context: { strategyName: "my-strategy", exchangeName: "binance", frameName: "1h" },
backtest: false,
};