Function getAggregatedTrades

  • Fetches aggregated trades for a trading pair from the registered exchange.

    Trades are fetched backwards from the current execution context time. If limit is not specified, returns all trades within one CC_AGGREGATED_TRADES_MAX_MINUTES window. If limit is specified, paginates backwards until at least limit trades are collected.

    Parameters

    • symbol: string

      Trading pair symbol (e.g., "BTCUSDT")

    • Optionallimit: number

      Optional maximum number of trades to fetch

    Returns Promise<IAggregatedTradeData[]>

    Promise resolving to array of aggregated trade data

    Error if execution or method context is missing

    // Fetch last hour of trades
    const trades = await getAggregatedTrades("BTCUSDT");

    // Fetch last 500 trades
    const lastTrades = await getAggregatedTrades("BTCUSDT", 500);
    console.log(lastTrades[0]); // { id, price, qty, timestamp, isBuyerMaker }