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

fix tokenomics error #2155

Merged
merged 15 commits into from
Jul 25, 2022

Conversation

jaymgonzalez
Copy link
Contributor

Description

  • Summary of the change / bug fix.
    When trying to get the tokenomics info for any assets I was faced with this error.
ETH not found on CoinGecko
Error: list indices must be integers or slices, not str

Error: cannot concatenate object of type '<class 'list'>'; only Series and DataFrame objs are valid

Error: not enough values to unpack (expected 2, got 0)

The first change I made was to force the symbol to lower case which made the not found on coingecko error disappear but the it complained about the ID.
Error: {'error': 'Could not find coin with the given id'}
Which was fixed by passing the coingecko ID to get_coin_tokenomics() function instead of the symbol.

This fixes made tokenomic info appear but there is still an issue when displaying the data in a graph, which I need more time to understand and investigate.

  • Link # issue, if applicable. -> Didn't create an issue, I just started to play and found the solution.
  • Screenshot of the feature or the bug before/after fix, if applicable.
  • Relevant motivation and context. -> I wanted the feature to work :)
  • List any dependencies that are required for this change. -> none

How has this been tested?

  • Please describe the tests that you ran to verify your changes.
    Manual testing only
  • Provide instructions so we can reproduce.
    crypto / load [ANY] / dd / tk
  • Please also list any relevant details for your test configuration.

Checklist:

Others

  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas. -> No need
  • My code passes all the checks pylint, flake8, black, ... To speed up development you should run pre-commit install.
  • New and existing unit tests pass locally with my changes. You can test this locally using pytest tests/.... -> getting this error Uninstall brotli and brotlipy before running tests, not sure if i should uninstall the packages

@jose-donato jose-donato self-requested a review July 24, 2022 11:25
@jose-donato
Copy link
Contributor

ahah we just pushed exactly at the same time a fix to this error 😄

#2156

@jose-donato jose-donato added the bug Fix bug label Jul 24, 2022
@jaymgonzalez
Copy link
Contributor Author

@jose-donato oh really!? :D glad it's working, looking forward to find & fix more bugs :p

Copy link
Contributor

@jose-donato jose-donato left a comment

Choose a reason for hiding this comment

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

before fixing the linting/tests, can you just update this line on messari_view.py to merged_df['circulating_supply'] instead of merged_df['values'] ?

i will close my PR and we can work on yours. thanks 🚀

@jaymgonzalez
Copy link
Contributor Author

Sure! I'll do it now!

Copy link
Contributor

@jose-donato jose-donato left a comment

Choose a reason for hiding this comment

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

code looks good now. we just need to fix the tests/linting.

do you need any help on setting the pre-commit hooks for the linting?

to fix the tests you only need to run:
pytest tests/openbb_terminal/cryptocurrency/test_cryptocurrency_helpers.py --record-mode=rewrite

this will update the tests that are failing

@jaymgonzalez
Copy link
Contributor Author

im getting this error, Exit: Uninstall brotli and brotlipy before running tests i'll uninstall them now and try again, please advise if those packages are needed and should be reinstalled, thanks

@jaymgonzalez
Copy link
Contributor Author

@jose-donato im trying poetry remove brotli brotlipy but im getting a ValueError - Package brotli not found should i deactivate it? not sure what i need to do to make it work? have never used brotli before 😢

@jaymgonzalez
Copy link
Contributor Author

also, i'd need help setting up the pre commit hooks for the linting...

@DidierRLopes
Copy link
Collaborator

Hey @jaymgonzalez ,

Can you do this in your environment pip list | grep brot that should show you if you have any brotli or brotlipy installed.

And then you can uninstall it with pip uninstall brotli or pip uninstall brotlipy.

This is necessary for generating the tests, so that there are no new tests created due to the installation of this package.

To set the pre-commit hook you can run pre-commit install. Hope this helps, let me know if you ned anything else!

@jaymgonzalez
Copy link
Contributor Author

Hey @DidierRLopes, thanks for your comment, I installed pre-commit and uninstall the packages that were causing the issue. It let me run the test 🥳
I added them to my commit and will push them now, hopefully it works! 😊
Please let me know if there is anything else left to do after.

@jose-donato
Copy link
Contributor

Hey @DidierRLopes, thanks for your comment, I installed pre-commit and uninstall the packages that were causing the issue. It let me run the test 🥳 I added them to my commit and will push them now, hopefully it works! 😊 Please let me know if there is anything else left to do after.

you need to run black openbb_terminal/cryptocurrency/due_diligence/messari_model.py to format that file that is failing. pre-commit didnt catch this because it happened in previous commits when you didnt have the hooks yet

@jaymgonzalez
Copy link
Contributor Author

hey @jose-donato, i run the command you posted in the comment before and it fixed Test / General Linting, thanks for that! unfortunately, test / base tests is not passing, there seems to be an issue with test_coin_chart() not sure how to test the test... 😮

@jose-donato
Copy link
Contributor

hey @jose-donato, i run the command you posted in the comment before and it fixed Test / General Linting, thanks for that! unfortunately, test / base tests is not passing, there seems to be an issue with test_coin_chart() not sure how to test the test... 😮

Hey, thanks for your effort!
Did you try running this one?
pytest tests/openbb_terminal/cryptocurrency/test_cryptocurrency_helpers.py --record-mode=rewrite

@jaymgonzalez
Copy link
Contributor Author

hey @jose-donato, i run the command you posted in the comment before and it fixed Test / General Linting, thanks for that! unfortunately, test / base tests is not passing, there seems to be an issue with test_coin_chart() not sure how to test the test... 😮

Hey, thanks for your effort! Did you try running this one? pytest tests/openbb_terminal/cryptocurrency/test_cryptocurrency_helpers.py --record-mode=rewrite

yes i did, i just re run it and try again! 😄
thank YOU guys! love the tool, glad im able to contribute a bit...

@jose-donato
Copy link
Contributor

jose-donato commented Jul 24, 2022

hey @jose-donato, i run the command you posted in the comment before and it fixed Test / General Linting, thanks for that! unfortunately, test / base tests is not passing, there seems to be an issue with test_coin_chart() not sure how to test the test... 😮

Hey, thanks for your effort! Did you try running this one? pytest tests/openbb_terminal/cryptocurrency/test_cryptocurrency_helpers.py --record-mode=rewrite

yes i did, i just re run it and try again! 😄 thank YOU guys! love the tool, glad im able to contribute a bit...

If it does not work I can try figure it out tomorrow.
Thank you for your contribution 🙌
Are you on our discord already?

@jaymgonzalez
Copy link
Contributor Author

hey @jose-donato, i run the command you posted in the comment before and it fixed Test / General Linting, thanks for that! unfortunately, test / base tests is not passing, there seems to be an issue with test_coin_chart() not sure how to test the test... 😮

Hey, thanks for your effort! Did you try running this one? pytest tests/openbb_terminal/cryptocurrency/test_cryptocurrency_helpers.py --record-mode=rewrite

yes i did, i just re run it and try again! 😄 thank YOU guys! love the tool, glad im able to contribute a bit...

If it does not work I can try figure it out tomorrow. Thank you for your contribution 🙌 Are you on our discord already?

yeah i tried again and it didnt work 🤷🏽‍♂️ if you can have a look tomorrow and let me know if there is anything else i can do to help 😄

just joined the discord! where do you usually you hang out in there?

@DidierRLopes
Copy link
Collaborator

hey @jose-donato, i run the command you posted in the comment before and it fixed Test / General Linting, thanks for that! unfortunately, test / base tests is not passing, there seems to be an issue with test_coin_chart() not sure how to test the test... 😮

Hey, thanks for your effort! Did you try running this one? pytest tests/openbb_terminal/cryptocurrency/test_cryptocurrency_helpers.py --record-mode=rewrite

yes i did, i just re run it and try again! 😄 thank YOU guys! love the tool, glad im able to contribute a bit...

If it does not work I can try figure it out tomorrow. Thank you for your contribution 🙌 Are you on our discord already?

yeah i tried again and it didnt work 🤷🏽‍♂️ if you can have a look tomorrow and let me know if there is anything else i can do to help 😄

just joined the discord! where do you usually you hang out in there?

Feel free to join us on any channel (perhaps #develop) and tag us: Didier & 1lluz10n

@jose-donato jose-donato merged commit 9d6292c into OpenBB-finance:main Jul 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fix bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants