From 79fcd4480e94b8b32db3f8c27d90e4482fbc4d93 Mon Sep 17 00:00:00 2001 From: Daniel Chew Date: Thu, 3 Mar 2022 23:19:59 +0800 Subject: [PATCH 1/2] change twap/twac to emap/emac --- pythclient/pythaccounts.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/pythclient/pythaccounts.py b/pythclient/pythaccounts.py index 2adaba4..84e2657 100644 --- a/pythclient/pythaccounts.py +++ b/pythclient/pythaccounts.py @@ -37,20 +37,20 @@ class PythPriceStatus(Enum): class PythPriceType(Enum): UNKNOWN = 0 PRICE = 1 - # TWAP/VOL removed after V2 - TWAP = 2 + # EMAP/VOL removed after V2 + EMAP = 2 VOLATILITY = 3 -# Join time-weighted exponential moving average for TWAP and TWAC +# Join time-weighted exponential moving average for EMAP and EMAC class TwEmaType(Enum): UNKNOWN = 0 - TWAPVALUE = 1 - TWAPNUMERATOR = 2 - TWAPDENOMINATOR = 3 - TWACVALUE = 4 - TWACNUMERATOR = 5 - TWACDENOMINATOR = 6 + EMAPVALUE = 1 + EMAPNUMERATOR = 2 + EMAPDENOMINATOR = 3 + EMACVALUE = 4 + EMACNUMERATOR = 5 + EMACDENOMINATOR = 6 def _check_base64(format: str): @@ -557,7 +557,7 @@ def update_from(self, buffer: bytes, *, version: int, offset: int = 0) -> None: last_slot, valid_slot = struct.unpack_from(" Date: Fri, 4 Mar 2022 00:09:46 +0800 Subject: [PATCH 2/2] use ema price and ema confidence for the enums --- pythclient/pythaccounts.py | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/pythclient/pythaccounts.py b/pythclient/pythaccounts.py index 84e2657..34b4944 100644 --- a/pythclient/pythaccounts.py +++ b/pythclient/pythaccounts.py @@ -37,20 +37,17 @@ class PythPriceStatus(Enum): class PythPriceType(Enum): UNKNOWN = 0 PRICE = 1 - # EMAP/VOL removed after V2 - EMAP = 2 - VOLATILITY = 3 -# Join time-weighted exponential moving average for EMAP and EMAC -class TwEmaType(Enum): +# Join exponential moving average for EMA price and EMA confidence +class EmaType(Enum): UNKNOWN = 0 - EMAPVALUE = 1 - EMAPNUMERATOR = 2 - EMAPDENOMINATOR = 3 - EMACVALUE = 4 - EMACNUMERATOR = 5 - EMACDENOMINATOR = 6 + EMA_PRICE_VALUE = 1 + EMA_PRICE_NUMERATOR = 2 + EMA_PRICE_DENOMINATOR = 3 + EMA_CONFIDENCE_VALUE = 4 + EMA_CONFIDENCE_NUMERATOR = 5 + EMA_CONFIDENCE_DENOMINATOR = 6 def _check_base64(format: str): @@ -489,7 +486,7 @@ def __init__(self, key: SolanaPublicKey, solana: SolanaClient, *, product: Optio self.next_price_account_key: Optional[SolanaPublicKey] = None self.aggregate_price_info: Optional[PythPriceInfo] = None self.price_components: List[PythPriceComponent] = [] - self.derivations: Dict[TwEmaType, int] = {} + self.derivations: Dict[EmaType, int] = {} self.min_publishers: Optional[int] = None @property @@ -557,7 +554,7 @@ def update_from(self, buffer: bytes, *, version: int, offset: int = 0) -> None: last_slot, valid_slot = struct.unpack_from("