@@ -95,6 +95,14 @@ pub struct PriceComp
95
95
latest : PriceInfo // latest contributing price (not in agg.)
96
96
}
97
97
98
+ #[ repr( C ) ]
99
+ pub struct Ema
100
+ {
101
+ pub val : i64 , // current value of ema
102
+ numer : i64 , // numerator state for next update
103
+ denom : i64 // denominator state for next update
104
+ }
105
+
98
106
// Price account structure
99
107
#[ repr( C ) ]
100
108
pub struct Price
@@ -107,19 +115,18 @@ pub struct Price
107
115
pub expo : i32 , // price exponent
108
116
pub num : u32 , // number of component prices
109
117
pub unused : u32 ,
110
- pub curr_slot : u64 , // currently accumulating price slot
118
+ pub last_slot : u64 , // slot of last valid (not unknown) aggregate price
111
119
pub valid_slot : u64 , // valid slot-time of agg. price
112
- pub twap : i64 , // time-weighted average price
113
- pub avol : u64 , // annualized price volatility
114
- pub drv0 : i64 , // space for future derived values
120
+ pub twap : Ema , // time-weighted average price
121
+ pub twac : Ema , // time-weighted average confidence interval
115
122
pub drv1 : i64 , // space for future derived values
116
123
pub drv2 : i64 , // space for future derived values
117
- pub drv3 : i64 , // space for future derived values
118
- pub drv4 : i64 , // space for future derived values
119
- pub drv5 : i64 , // space for future derived values
120
124
pub prod : AccKey , // product account key
121
125
pub next : AccKey , // next Price account in linked list
122
- pub agg_pub : AccKey , // quoter who computed last aggregate price
126
+ pub prev_slot : u64 , // valid slot of previous update
127
+ pub prev_price : i64 , // aggregate price of previous update
128
+ pub prev_conf : u64 , // confidence interval of previous update
129
+ pub drv3 : i64 , // space for future derived values
123
130
pub agg : PriceInfo , // aggregate price info
124
131
pub comp : [ PriceComp ; 32 ] // price components one per quoter
125
132
}
0 commit comments