Class MarketPriceAggregationUtil
java.lang.Object
com.bluebell.greenhouse.platform.util.market.MarketPriceAggregationUtil
Utility class for aggregating
MarketPrice collections into larger time intervals.- Version:
- 2.0.3
- Author:
- Stephen Prizio
-
Method Summary
Modifier and TypeMethodDescriptionstatic List<MarketPrice> aggregateByDay(List<MarketPrice> marketPrices, MarketTimeInterval interval, ZoneId dayZone) Aggregates prices into one candle per day in the provided zone.static List<MarketPrice> aggregateByDay(List<MarketPrice> marketPrices, MarketTimeInterval interval, ZoneId dayZone, DoubleUnaryOperator priceNormalizer) Aggregates prices into one candle per day in the provided zone.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.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.static List<MarketPrice> aggregateByWeek(List<MarketPrice> marketPrices, MarketTimeInterval interval) Aggregates prices into weekly candles using a Monday-based bucket.static List<MarketPrice> aggregateByWeek(List<MarketPrice> marketPrices, MarketTimeInterval interval, DoubleUnaryOperator priceNormalizer) Aggregates prices into weekly candles using a Monday-based bucket.static MarketPricebuildAggregate(MarketTimeInterval interval, List<MarketPrice> marketPrices, DoubleUnaryOperator priceNormalizer) Builds an aggregate candle from the supplied component prices.
-
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 pricesinterval- target intervalchunkSize- source bars per aggregatedayZone- 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 pricesinterval- target intervalchunkSize- source bars per aggregatedayZone- zone used to determine day boundariespriceNormalizer- 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 pricesinterval- target intervaldayZone- 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 pricesinterval- target intervaldayZone- zone used to determine day boundariespriceNormalizer- 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 pricesinterval- 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 pricesinterval- target intervalpriceNormalizer- 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 intervalmarketPrices- component pricespriceNormalizer- optional normalizer applied to the aggregate high and low- Returns:
- aggregate candle
-