Class MarketPriceAggregationUtil

java.lang.Object
com.bluebell.greenhouse.platform.util.market.MarketPriceAggregationUtil

public final class MarketPriceAggregationUtil extends Object
Utility class for aggregating MarketPrice collections into larger time intervals.
Version:
2.0.3
Author:
Stephen Prizio
  • Method Details

    • aggregateByDayChunk

      public static List<MarketPrice> aggregateByDayChunk(List<MarketPrice> marketPrices, MarketTimeInterval interval, int chunkSize, ZoneId dayZone)
      Aggregates intraday prices into larger interval buckets grouped by day in the provided zone.
      Parameters:
      marketPrices - source prices
      interval - target interval
      chunkSize - source bars per aggregate
      dayZone - zone used to determine day boundaries
      Returns:
      aggregated prices
    • aggregateByDayChunk

      public static List<MarketPrice> aggregateByDayChunk(List<MarketPrice> marketPrices, MarketTimeInterval interval, int chunkSize, ZoneId dayZone, DoubleUnaryOperator priceNormalizer)
      Aggregates intraday prices into larger interval buckets grouped by day in the provided zone.
      Parameters:
      marketPrices - source prices
      interval - target interval
      chunkSize - source bars per aggregate
      dayZone - zone used to determine day boundaries
      priceNormalizer - optional normalizer applied to the aggregate high and low
      Returns:
      aggregated prices
    • aggregateByDay

      public static List<MarketPrice> aggregateByDay(List<MarketPrice> marketPrices, MarketTimeInterval interval, ZoneId dayZone)
      Aggregates prices into one candle per day in the provided zone.
      Parameters:
      marketPrices - source prices
      interval - target interval
      dayZone - zone used to determine day boundaries
      Returns:
      aggregated prices
    • aggregateByDay

      public static List<MarketPrice> aggregateByDay(List<MarketPrice> marketPrices, MarketTimeInterval interval, ZoneId dayZone, DoubleUnaryOperator priceNormalizer)
      Aggregates prices into one candle per day in the provided zone.
      Parameters:
      marketPrices - source prices
      interval - target interval
      dayZone - zone used to determine day boundaries
      priceNormalizer - optional normalizer applied to the aggregate high and low
      Returns:
      aggregated prices
    • aggregateByWeek

      public static List<MarketPrice> aggregateByWeek(List<MarketPrice> marketPrices, MarketTimeInterval interval)
      Aggregates prices into weekly candles using a Monday-based bucket.
      Parameters:
      marketPrices - source prices
      interval - target interval
      Returns:
      aggregated prices
    • aggregateByWeek

      public static List<MarketPrice> aggregateByWeek(List<MarketPrice> marketPrices, MarketTimeInterval interval, DoubleUnaryOperator priceNormalizer)
      Aggregates prices into weekly candles using a Monday-based bucket.
      Parameters:
      marketPrices - source prices
      interval - target interval
      priceNormalizer - optional normalizer applied to the aggregate high and low
      Returns:
      aggregated prices
    • buildAggregate

      public static MarketPrice buildAggregate(MarketTimeInterval interval, List<MarketPrice> marketPrices, DoubleUnaryOperator priceNormalizer)
      Builds an aggregate candle from the supplied component prices.
      Parameters:
      interval - target interval
      marketPrices - component prices
      priceNormalizer - optional normalizer applied to the aggregate high and low
      Returns:
      aggregate candle