Javi
09/12/2023, 3:48 PMenv.fromElements(
Tuple4.of("BRENT_FUTURE", "BOM", QuotationPriceType.ASK, 10.0),
Tuple4.of("RBOB_FUTURE", "BOM", QuotationPriceType.ASK, 10.0),
Tuple4.of("BRENT_FUTURE", "BOM", QuotationPriceType.BID, 20.0),
Tuple4.of("BRENT_FUTURE", "BOM", QuotationPriceType.ASK, 15.0),
Tuple4.of("BRENT_FUTURE", "BOM", QuotationPriceType.ASK, 20.0),
Tuple4.of("RBOB_FUTURE", "BOM", QuotationPriceType.BID, 10.0));
I want to operate (BID/ASK)/2, grouping by the first field of the tuple, and do it every time I can calculate a new value, ending up with something like:
env.fromElements(
Tuple4.of("A", "BOM", QuotationPriceType.VALUE, 15.0),
Tuple4.of("A", "BOM", QuotationPriceType.VALUE, 17.5),
Tuple4.of("A", "BOM", QuotationPriceType.VALUE, 20.0),
Tuple4.of("B", "BOM", QuotationPriceType.VALUE, 10.0));
any advice? thank you!Javi
09/19/2023, 9:48 AMFlaviu Cicio
09/19/2023, 10:06 AMKeyedProcessFunction
to implement a function that takes the first parameter of the tuple as key, use the keyed state to keep track of the latest values, and finally output a tuple2 with the key and the new valueJavi
09/25/2023, 1:45 PM