Skip to content

Commit 852b991

Browse files
committed
do not update twap with last price if agg status is unknown
1 parent e869310 commit 852b991

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [2.9.1] - TBD
9+
- [pyth] do not update twap with last price if price unknown
10+
811
## [2.9] - 2021-11-02
912
- [pyth] add minimum number of publishers for price to be valid (not unknown)
1013
- [pyth] various minor code cleanup

program/src/oracle/upd_aggregate.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,6 @@ static inline void upd_aggregate( pc_price_t *ptr, uint64_t slot )
259259
ptr->num_qt_ = numa;
260260
if ( numa == 0 || numa < ptr->min_pub_ || numa * 2 <= numv ) {
261261
ptr->agg_.status_ = PC_STATUS_UNKNOWN;
262-
upd_twap( ptr, agg_diff, qs );
263262
return;
264263
}
265264

pyth/tests/twap/small_conf.result

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
price,conf,expo,nslots,twap,twac
2-
16531211500,3551850,-8,0,15964187400,3430020
3-
16531199600,3664650,-8,1,16238334300,3543462
4-
16530429200,13766600,-8,1,16271645200,4709319
5-
16533446000,5589400,-8,3,16329070800,4902362
6-
16533056100,2,-8,2,16533055800,9
7-
16498650000,2,-8,175,16515674800,5
8-
16484437900,2957400,-8,2,16515674900,6
9-
16485951200,15123300,-8,2,16515674900,7
10-
16482523300,10602450,-8,4,16515674900,8
11-
16482958000,17245100,-8,1,16515675000,10
2+
16531211500,3551850,-8,0,16531211400,3551849
3+
16531199600,3664650,-8,1,16531205700,3607371
4+
16530429200,13766600,-8,1,16531115900,4784415
5+
16533446000,5589400,-8,3,16531633400,4963176
6+
16533056100,2,-8,2,16533056100,9
7+
16498650000,2,-8,175,16515675000,5
8+
16484437900,2957400,-8,2,16515675100,6
9+
16485951200,15123300,-8,2,16515675000,7
10+
16482523300,10602450,-8,4,16515675000,8
11+
16482958000,17245100,-8,1,16515675200,10

0 commit comments

Comments
 (0)