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

Update API endpoint from deprecated api.coindix to new api.nanoly #5849

Open
wants to merge 18 commits into
base: develop
Choose a base branch
from

Conversation

davidtran001
Copy link

This PR addresses issue #5631, it fixes the /crypto/defi/vaults command.

The api endpoint https://api.coindix.com/ and https://apiv2.coindix.com/ has been replaced with https://api.nanoly.com/ since coindix was renamed to nanoly last year.

Without the fix running /crypto/defi/vaults results in:
Screenshot 2023-12-01 at 11 18 44 PM

Running /crypto/defi/vaults after the fix resolves this issue:
Screenshot 2023-12-01 at 11 19 36 PM

@CLAassistant
Copy link

CLAassistant commented Dec 2, 2023

CLA assistant check
All committers have signed the CLA.

@reviewpad reviewpad bot added the feat XS Extra small feature label Dec 2, 2023
@reviewpad reviewpad bot added feat S Small T-Shirt size Feature and removed feat XS Extra small feature labels Dec 3, 2023
@deeleeramone
Copy link
Contributor

Hi there!

Thanks for the PR. This looks pretty good, but the code linters are picking up something.

ruff --fix might do the trick for the item it has highlighted, but there may be more after that.

You can install the pre-commit hooks by running:

pre-commit install

This will run the series of linters, as well as the testing suite, locally before the commit goes to GitHub.

As the name of the data source is changing, we need to reflect that change on-screen. This is accomplished by updating this file:
https://github.com/OpenBB-finance/OpenBBTerminal/blob/develop/openbb_terminal/miscellaneous/sources/openbb_default.json

Doing this will also trigger the need to recapture the controller test output because the contents of the menu screen will have changed.

@davidtran001
Copy link
Author

Hi there!

Thanks for the PR. This looks pretty good, but the code linters are picking up something.

ruff --fix might do the trick for the item it has highlighted, but there may be more after that.

You can install the pre-commit hooks by running:

pre-commit install

This will run the series of linters, as well as the testing suite, locally before the commit goes to GitHub.

As the name of the data source is changing, we need to reflect that change on-screen. This is accomplished by updating this file: https://github.com/OpenBB-finance/OpenBBTerminal/blob/develop/openbb_terminal/miscellaneous/sources/openbb_default.json

Doing this will also trigger the need to recapture the controller test output because the contents of the menu screen will have changed.

Hi, thanks for the feedback!

I ran ruff -fix and received the following output:

openbb_platform/providers/alpha_vantage/tests/test_alpha_vantage_fetchers.py:25:5: PLW0127 Self-assignment of variable `params`
openbb_platform/providers/cboe/tests/test_cboe_fetchers.py:86:5: PLW0127 Self-assignment of variable `params`
openbb_terminal/keys_model.py:947:9: PLW0127 Self-assignment of variable `r`
openbb_terminal/stocks/fundamental_analysis/yahoo_finance_model.py:295:11: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
Found 4 errors.

It found a few errors but these are files that I have not made changes to so some I would appreciate some guidance on what to do here.

I also installed pre-commit and ran the linters and testing suite before commits on 12/5/2023.

@@ -9,8 +9,8 @@

from openbb_terminal.core.session.current_user import get_current_user
from openbb_terminal.cryptocurrency.defi import (
coindix_model,
coindix_view,
nanoly_model,
Copy link
Contributor

Choose a reason for hiding this comment

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

It is right here where Ruff is tripping. It wants to see these sorted alphabetically.

Copy link
Author

Choose a reason for hiding this comment

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

Nice catch!
I have reordered the imports in defi_controller.py such that they're in alphabetical order in commit: 8b925e2

Copy link
Contributor

Choose a reason for hiding this comment

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

There is an error with the related tests. I think you may have to re-capture the tests for the model, view and controller.

Screenshot 2023-12-06 at 7 43 13 PM

pytest tests/openbb_terminal/path_to/test_file.py --record-mode once --rewrite-expected should get us there, allegedly.

Copy link
Author

Choose a reason for hiding this comment

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

Hi, I have tried running the command you suggested but I can't get it to run on my machine locally.
The command:

pytest tests/openbb_terminal/cryptocurrency/test_defi_controller.py --record-mode once --rewrite-expected

and receive this error:

ERROR: usage: pytest [options] [file_or_dir] [file_or_dir] [...]
pytest: error: unrecognized arguments: --record-mode once
  inifile: /Users/davidtran/Code/OpenBBTerminal/pytest.ini
  rootdir: /Users/davidtran/Code/OpenBBTerminal

I have also ran

pytest tests/openbb_terminal/cryptocurrency/test_defi_controller.py --record-mode=once --rewrite-expected

But received the same error.

Do you have any suggestions where to go from here?

Copy link
Contributor

Choose a reason for hiding this comment

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

oooo.. looks like I missed a sub-folder (defi), sorry about that.

tests/openbb_terminal/cryptocurrency/defi/test_defi_controller.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat S Small T-Shirt size Feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants