• mergeBars(bars?: Bar[]): Bar
  • Helper than merges multiple bars into one. The t field will be the earliest of the t fields of the bars.

    Remarks

    The vw value will be the sum of the vw values of the bars divided by the number of bars (don't trust it).

    Example

    const args: BarsBetweenArgs = {
    symbol: 'BTC/USD',
    start: new Date('2022-01-01'),
    end: new Date('2022-07-31'),
    timeframe: '1Hour',
    }

    const bars: Bar[] = []

    for await (const bar of getBarsBetween(cryptoSource, args)) {
    bars.push(bar)
    }

    const singleBar = mergeBars(bars)

    Parameters

    • bars: Bar[] = []

    Returns Bar

Generated using TypeDoc