Skip to content

Store value of previous price aggregate if the status is trading #152

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 5, 2022

Conversation

tompntn
Copy link
Contributor

@tompntn tompntn commented Apr 5, 2022

This PR changes the semantics of the pc_price.prev_slot_, pc_price.prev_price_ and pc_price.prev_conf_ fields to only store the value of the previous price aggregate if the previous price aggregate had a status of TRADING. We also store a new piece of data, the Solana unix timestamp of this previous aggregate, for convenience.

tompntn added 5 commits April 5, 2022 14:29
This is always 1 for all currently deployed price accounts which have had upd_ema
ran once, which covers all accounts. Therefore the condition inside upd_ema will always
be true. We can therefore remove the usage of drv1_, freeing it up to be used for
other 64-bit data in the future.
for consistency.

This effectively makes prev_slot_, prev_price_ and prev_conf_ a cache of the
ptr->agg_ fields.
@tompntn tompntn requested a review from jayantk April 5, 2022 16:01
jayantk
jayantk previously approved these changes Apr 5, 2022
Copy link
Contributor

@jayantk jayantk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@tompntn tompntn merged commit b49f73a into main Apr 5, 2022
@tompntn tompntn deleted the oracle-prev-price branch April 5, 2022 22:06
guibescos pushed a commit that referenced this pull request Aug 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants