Function getBreakeven

  • Checks if breakeven threshold has been reached for the current pending signal.

    Returns true if price has moved far enough in profit direction to cover transaction costs. Threshold is calculated as: (CC_PERCENT_SLIPPAGE + CC_PERCENT_FEE) * 2

    Automatically detects backtest/live mode from execution context.

    Parameters

    • symbol: string

      Trading pair symbol

    • currentPrice: number

      Current market price to check against threshold

    Returns Promise<boolean>

    Promise - true if breakeven threshold reached, false otherwise

    import { getBreakeven, getAveragePrice } from "backtest-kit";

    const price = await getAveragePrice("BTCUSDT");
    const canBreakeven = await getBreakeven("BTCUSDT", price);
    if (canBreakeven) {
    console.log("Breakeven available");
    }