@@ -37,20 +37,17 @@ class PythPriceStatus(Enum):
37
37
class PythPriceType (Enum ):
38
38
UNKNOWN = 0
39
39
PRICE = 1
40
- # TWAP/VOL removed after V2
41
- TWAP = 2
42
- VOLATILITY = 3
43
40
44
41
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 ):
47
44
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
54
51
55
52
56
53
def _check_base64 (format : str ):
@@ -489,7 +486,7 @@ def __init__(self, key: SolanaPublicKey, solana: SolanaClient, *, product: Optio
489
486
self .next_price_account_key : Optional [SolanaPublicKey ] = None
490
487
self .aggregate_price_info : Optional [PythPriceInfo ] = None
491
488
self .price_components : List [PythPriceComponent ] = []
492
- self .derivations : Dict [TwEmaType , int ] = {}
489
+ self .derivations : Dict [EmaType , int ] = {}
493
490
self .min_publishers : Optional [int ] = None
494
491
495
492
@property
@@ -557,7 +554,7 @@ def update_from(self, buffer: bytes, *, version: int, offset: int = 0) -> None:
557
554
last_slot , valid_slot = struct .unpack_from ("<QQ" , buffer , offset )
558
555
offset += 16 # QQ
559
556
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 ])
561
558
offset += 48 # 6q
562
559
# All drv*_ fields sans min_publishers are currently unused
563
560
_ , min_publishers = struct .unpack_from ("<qQ" , buffer , offset )
0 commit comments