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

Enable Token Price History without History Module #348

Closed
ryuash opened this issue Mar 4, 2022 · 4 comments · Fixed by #353
Closed

Enable Token Price History without History Module #348

ryuash opened this issue Mar 4, 2022 · 4 comments · Fixed by #353
Assignees

Comments

@ryuash
Copy link

ryuash commented Mar 4, 2022

Issue:
Currently token price history is only enabled if history module is enabled.

There will be networks that don't require history and I would like to retrieve their token price history in order to display a 7 day chart.

Implementation:
Separate Token Price History from history. Log the price once a day (seriously once a day should be enough)

@ryuash ryuash changed the title Enable Token Price History Enable Token Price History without History Module Mar 4, 2022
@huichiaotsou
Copy link
Contributor

@ryuash currently there's only storing price in history module, can we say we just remove history module and store the price history every 30 secs as usual?

@ryuash
Copy link
Author

ryuash commented Mar 7, 2022

Every 30 seconds is a bit extreme for ui's use-case.
I just want the price once a day but I would have to search through 2880 rows for each day. 2880 * 7 just to get 7 days of price history.

I don't mind logging them all back in to token_price table please also check with X on this as they switched to token_price_history

edit:
Also okay with hourly and i can display the 24 hours change

@MonikaCat
Copy link
Contributor

I think we can add it to the pricefeed module to query the price once a day and store it inside new daily_token_price_history table. This way we keep history module optional to enable for users.

@ryuash
Copy link
Author

ryuash commented Mar 8, 2022

Can we default this to hourly instead?

Both BD and X does not need it every 30 seconds - 2 minutes and just logging once per hour is more than enough. I've confirmed with @calvinkei

Implementation

  • Add a frequency config specifically for tokens that defaults to every hour
  • Enable this by default in token module or create a token_history module
  • Keep the data in token_price_history table

I don't see any usecase for such high frequency as we are not coin gecko and I don't see the point of creating a new table as it's still considered history.

@MonikaCat MonikaCat self-assigned this Mar 9, 2022
@mergify mergify bot closed this as completed in #353 Mar 11, 2022
mergify bot pushed a commit that referenced this issue Mar 11, 2022
## Description

Closes: #348 



- Updated periodic ops to query token price and store it inside `token_price` table every 2 mins
- Added periodic ops to history module to query historic token price and store it inside `token_price_history` table every 1hr 
---

### 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
- [ ] added `!` to the type prefix if API or client breaking change
- [x] targeted the correct branch
- [x] provided a link to the relevant issue or specification
- [ ] added a changelog entry to `CHANGELOG.md`
- [ ] included comments for [documenting Go code](https://blog.golang.org/godoc)
- [ ] 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 `!` in the type prefix if API or client breaking change
- [ ] confirmed all author checklist items have been addressed
- [ ] reviewed API design and naming
- [ ] reviewed documentation is accurate
- [ ] reviewed tests and test coverage
- [ ] manually tested (if applicable)
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 a pull request may close this issue.

3 participants