@@ -37,20 +37,17 @@ class PythPriceStatus(Enum):
3737class PythPriceType (Enum ):
3838 UNKNOWN = 0
3939 PRICE = 1
40- # TWAP/VOL removed after V2
41- TWAP = 2
42- VOLATILITY = 3
4340
4441
45- # Join time-weighted exponential moving average for TWAP and TWAC
46- class TwEmaType (Enum ):
42+ # Join exponential moving average for EMA price and EMA confidence
43+ class EmaType (Enum ):
4744 UNKNOWN = 0
48- TWAPVALUE = 1
49- TWAPNUMERATOR = 2
50- TWAPDENOMINATOR = 3
51- TWACVALUE = 4
52- TWACNUMERATOR = 5
53- TWACDENOMINATOR = 6
45+ EMA_PRICE_VALUE = 1
46+ EMA_PRICE_NUMERATOR = 2
47+ EMA_PRICE_DENOMINATOR = 3
48+ EMA_CONFIDENCE_VALUE = 4
49+ EMA_CONFIDENCE_NUMERATOR = 5
50+ EMA_CONFIDENCE_DENOMINATOR = 6
5451
5552
5653def _check_base64 (format : str ):
@@ -489,7 +486,7 @@ def __init__(self, key: SolanaPublicKey, solana: SolanaClient, *, product: Optio
489486 self .next_price_account_key : Optional [SolanaPublicKey ] = None
490487 self .aggregate_price_info : Optional [PythPriceInfo ] = None
491488 self .price_components : List [PythPriceComponent ] = []
492- self .derivations : Dict [TwEmaType , int ] = {}
489+ self .derivations : Dict [EmaType , int ] = {}
493490 self .min_publishers : Optional [int ] = None
494491
495492 @property
@@ -557,7 +554,7 @@ def update_from(self, buffer: bytes, *, version: int, offset: int = 0) -> None:
557554 last_slot , valid_slot = struct .unpack_from ("<QQ" , buffer , offset )
558555 offset += 16 # QQ
559556 derivations = list (struct .unpack_from ("<6q" , buffer , offset ))
560- self .derivations = dict ((type_ , derivations [type_ .value - 1 ]) for type_ in [TwEmaType . TWACVALUE , TwEmaType . TWAPVALUE ])
557+ self .derivations = dict ((type_ , derivations [type_ .value - 1 ]) for type_ in [EmaType . EMA_CONFIDENCE_VALUE , EmaType . EMA_PRICE_VALUE ])
561558 offset += 48 # 6q
562559 # All drv*_ fields sans min_publishers are currently unused
563560 _ , min_publishers = struct .unpack_from ("<qQ" , buffer , offset )
0 commit comments