@@ -224,49 +224,49 @@ pub struct Ema
224224pub struct Price
225225{
226226 /// pyth magic number
227- pub magic : u32 ,
227+ pub magic : u32 ,
228228 /// program version
229- pub ver : u32 ,
229+ pub ver : u32 ,
230230 /// account type
231- pub atype : u32 ,
231+ pub atype : u32 ,
232232 /// price account size
233- pub size : u32 ,
233+ pub size : u32 ,
234234 /// price or calculation type
235- pub ptype : PriceType ,
235+ pub ptype : PriceType ,
236236 /// price exponent
237- pub expo : i32 ,
237+ pub expo : i32 ,
238238 /// number of component prices
239- pub num : u32 ,
239+ pub num : u32 ,
240240 /// number of quoters that make up aggregate
241- pub num_qt : u32 ,
241+ pub num_qt : u32 ,
242242 /// slot of last valid (not unknown) aggregate price
243- pub last_slot : u64 ,
243+ pub last_slot : u64 ,
244244 /// valid slot-time of agg. price
245- pub valid_slot : u64 ,
246- /// time-weighted average price
247- pub twap : Ema ,
248- /// time-weighted average confidence interval
249- pub twac : Ema ,
245+ pub valid_slot : u64 ,
246+ /// exponential moving average price
247+ pub ema_price : Ema ,
248+ /// exponential moving average confidence interval
249+ pub ema_confidence : Ema ,
250250 /// space for future derived values
251- pub drv1 : i64 ,
251+ pub drv1 : i64 ,
252252 /// space for future derived values
253- pub drv2 : i64 ,
253+ pub drv2 : i64 ,
254254 /// product account key
255- pub prod : AccKey ,
255+ pub prod : AccKey ,
256256 /// next Price account in linked list
257- pub next : AccKey ,
257+ pub next : AccKey ,
258258 /// valid slot of previous update
259- pub prev_slot : u64 ,
259+ pub prev_slot : u64 ,
260260 /// aggregate price of previous update
261- pub prev_price : i64 ,
261+ pub prev_price : i64 ,
262262 /// confidence interval of previous update
263- pub prev_conf : u64 ,
263+ pub prev_conf : u64 ,
264264 /// space for future derived values
265- pub drv3 : i64 ,
265+ pub drv3 : i64 ,
266266 /// aggregate price info
267- pub agg : PriceInfo ,
267+ pub agg : PriceInfo ,
268268 /// price components one per quoter
269- pub comp : [ PriceComp ; 32 ]
269+ pub comp : [ PriceComp ; 32 ]
270270}
271271
272272#[ cfg( target_endian = "little" ) ]
@@ -307,16 +307,16 @@ impl Price {
307307 }
308308
309309 /**
310- * Get the time-weighted average price (TWAP ) and a confidence interval on the result.
311- * Returns `None` if the twap is currently unavailable.
310+ * Get the exponential moving average price (ema_price ) and a confidence interval on the result.
311+ * Returns `None` if the ema_price is currently unavailable.
312312 *
313313 * At the moment, the confidence interval returned by this method is computed in
314314 * a somewhat questionable way, so we do not recommend using it for high-value applications.
315315 */
316- pub fn get_twap ( & self ) -> Option < PriceConf > {
316+ pub fn get_ema_price ( & self ) -> Option < PriceConf > {
317317 // This method currently cannot return None, but may do so in the future.
318- // Note that the twac is a positive number in i64, so safe to cast to u64.
319- Some ( PriceConf { price : self . twap . val , conf : self . twac . val as u64 , expo : self . expo } )
318+ // Note that the ema_confidence is a positive number in i64, so safe to cast to u64.
319+ Some ( PriceConf { price : self . ema_price . val , conf : self . ema_confidence . val as u64 , expo : self . expo } )
320320 }
321321
322322 /**
0 commit comments