Returns the cost basis in dollars of the position currently held (not closed). Correctly accounts for DCA entries between partial closes.
Automatically detects backtest/live mode from execution context.
Trading pair symbol
Promise - held cost basis in dollars
import { getTotalCostClosed } from "backtest-kit";const heldCost = await getTotalCostClosed("BTCUSDT");console.log(`Holding $${heldCost} of position`); Copy
import { getTotalCostClosed } from "backtest-kit";const heldCost = await getTotalCostClosed("BTCUSDT");console.log(`Holding $${heldCost} of position`);
Returns the cost basis in dollars of the position currently held (not closed). Correctly accounts for DCA entries between partial closes.
Automatically detects backtest/live mode from execution context.