Skip to content
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

Epic: Historacle pricing #1521

Closed
12 of 17 tasks
adamewozniak opened this issue Oct 24, 2022 · 10 comments
Closed
12 of 17 tasks

Epic: Historacle pricing #1521

adamewozniak opened this issue Oct 24, 2022 · 10 comments

Comments

@adamewozniak
Copy link
Collaborator

adamewozniak commented Oct 24, 2022

Summary

As an addition to the oracle module, we need to:

  1. Stamp prices for every assets every X amount of blocks
  2. Provide a keeper function & query that responds with the median of the last 30 days of prices
  3. Provide a keeper function that takes a denomination and a price, and will return whether or not that price is within the standard deviation of the median of the last 30 days of prices

This should serve as an epic for some smaller tasks:


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@toteki
Copy link
Member

toteki commented Oct 24, 2022

I can make this into a submodule of leverage, so the code stays fairly isolated, until we figure out what to do with it. It'll just

  • Store prices every epoch, keeping the last num_epochs
  • Calculate and store median and SD of stored prices each epoch, per asset
  • Get stored values using a keeper method + query

That way leverage can, for every MsgBorrow and possibly MsgDecollateralize and MsgWithdraw, execute some custom logic.

(Only difference from issue desc. is the storing of calculated values since they should only change on epoch)

@adamewozniak
Copy link
Collaborator Author

adamewozniak commented Oct 24, 2022

I can make this into a submodule of leverage, so the code stays fairly isolated, until we figure out what to do with it. It'll just

  • Store prices every epoch, keeping the last num_epochs
  • Calculate and store median and SD of stored prices each epoch, per asset
  • Get stored values using a keeper method + query

That way leverage can, for every MsgBorrow and possibly MsgDecollateralize and MsgWithdraw, execute some custom logic.

(Only difference from issue desc. is the storing of calculated values since they should only change on epoch)

Ehh now that I think about it, it might be cleaner to do this within the oracle module or as a x/historacle module. Separation of concerns 🤷 @toteki

@robert-zaremba
Copy link
Member

@adamewozniak
Copy link
Collaborator Author

@toteki I'm going to make a couple keeper functions for you to call on the oracle side (thinking 30 days now)

@toteki
Copy link
Member

toteki commented Oct 25, 2022

Keeping it in oracle module works, yeah. If the historical price can be kept as a single function (like TokenPrice) then I can build whatever helpers are needed on the leverage side to translate like I did with the various TokenValue functions.

@adamewozniak
Copy link
Collaborator Author

Keeping it in oracle module works, yeah. If the historical price can be kept as a single function (like TokenPrice) then I can build whatever helpers are needed on the leverage side to translate like I did with the various TokenValue functions.

Thinking about just doing a separate module that has hooks into the oracle module to keep the oracle module smaller & migrations cleaner

@adamewozniak
Copy link
Collaborator Author

@toteki I'm turning this into an epic for @zarazan / @rbajollari to work on, I'll add another task for wiring this to the leverage module

@adamewozniak adamewozniak assigned zarazan and rbajollari and unassigned toteki Oct 31, 2022
@adamewozniak adamewozniak mentioned this issue Nov 1, 2022
14 tasks
@adamewozniak adamewozniak changed the title Historacle pricing Epic: Historacle pricing Nov 1, 2022
@robert-zaremba
Copy link
Member

Spec should be added / created before going into implementation.

@adamewozniak
Copy link
Collaborator Author

@robert-zaremba I'll add a spec for this today / tomorrow, have just been swamped with PFv2

@adamewozniak adamewozniak mentioned this issue Nov 9, 2022
17 tasks
mergify bot pushed a commit that referenced this issue Nov 9, 2022
## Description

Initial spec for the historacle pricing oracle feature.

Please see #1521 for initial discussion 

---

### Author Checklist

_All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues._

I have...

- [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [x] added `!` to the type prefix if API or client breaking change
- [x] added appropriate labels to the PR
- [x] targeted the correct branch (see [PR Targeting](https://github.com/umee-network/umee/blob/main/CONTRIBUTING.md#pr-targeting))
- [x] provided a link to the relevant issue or specification
- [x] added a changelog entry to `CHANGELOG.md`
- [x] included comments for [documenting Go code](https://blog.golang.org/godoc)
- [x] updated the relevant documentation or specification
- [x] reviewed "Files changed" and left comments if necessary
- [x] confirmed all CI checks have passed

### Reviewers Checklist

_All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items._

I have...

- [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] confirmed all author checklist items have been addressed
- [ ] reviewed state machine logic
- [ ] reviewed API design and naming
- [ ] reviewed documentation is accurate
- [ ] reviewed tests and test coverage
- [ ] manually tested (if applicable)
@robert-zaremba robert-zaremba added this to the v3.4 milestone Dec 21, 2022
@adamewozniak
Copy link
Collaborator Author

closing out historacle pricing, this came out last year

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants