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

Added check for valid Coinbase product, including delisted checking #1633

Merged
merged 4 commits into from
Apr 5, 2022
Merged

Added check for valid Coinbase product, including delisted checking #1633

merged 4 commits into from
Apr 5, 2022

Conversation

marcelonyc
Copy link
Contributor

@marcelonyc marcelonyc commented Apr 4, 2022

This change fixes a bug I reported yesterday. Fixes #1624

When loading a Coinbase portfolio, the list cointains USD as well as delisted products(XRP). The load fails when checking prices for invalid pairs or delisted products.

The fix does 3 things

  • Confirm the pair is valid in Coinbase
  • Checks for a message indicating the pair is delisted
  • Returns an Exception if it fails to get a price for that pair that does not match the previous checks

Testing
Testing requires an account on Coinbase PRO. I confirmed my portfolio loaded as expected.

What is missing
Multiple portfolios: In Coinbase Pro you can have multiple portfolios. Each with its own API-KEY-SECRET. Adding this feature will require additional changes to key management and a decision on how to handle multiple portfolios within a single broker.

Description

  • Summary of the change / bug fix.
  • Link # issue, if applicable.
  • Screenshot of the feature or the bug before/after fix, if applicable.
  • Relevant motivation and context.
  • List any dependencies that are required for this change.

How has this been tested?

  • Please describe the tests that you ran to verify your changes.
  • Provide instructions so we can reproduce.
  • 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.
  • 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/....

@colin99d colin99d added the bug Fix bug label Apr 4, 2022
@piiq piiq requested review from jmaslek and piiq April 5, 2022 09:27
Copy link
Contributor

@piiq piiq left a comment

Choose a reason for hiding this comment

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

Thanks for the patch @marcelonyc !

I saw that the coinbase menu is not covered by unit tests. Will you be open to make another PR adding tests to this menu?

@marcelonyc
Copy link
Contributor Author

@piiq I will try to contribute the tests for the Coinbase menu. However, I would need to get more proficient with pytest. If someone gets to write the tests before me, I will not take offense :)

@piiq piiq merged commit 6eb0fbb into OpenBB-finance:main Apr 5, 2022
@minhhoang1023
Copy link
Contributor

tests

we actually just updated our Test Documentation, so it should be easy to follow! Feel free to ping me or our Test master @Chavithra if you have any questions

mrriteshranjan added a commit to mrriteshranjan/OpenBBTerminal that referenced this pull request Apr 6, 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.

[Bug] Cannot load Coinbase portfolio
5 participants