-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Preferred data source for a given command and help docs for any command #1928
Merged
Chavithra
merged 68 commits into
OpenBB-finance:main
from
stkerr:stkerr-preferred-data-provider-setting
Jun 14, 2022
Merged
Preferred data source for a given command and help docs for any command #1928
Chavithra
merged 68 commits into
OpenBB-finance:main
from
stkerr:stkerr-preferred-data-provider-setting
Jun 14, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stkerr
force-pushed
the
stkerr-preferred-data-provider-setting
branch
from
June 10, 2022 19:59
be03fe8
to
26c6414
Compare
stkerr
changed the title
Add a feature flag loaded from . env for preferred data source
Add a feature setting for preferred data source
Jun 10, 2022
Hey @stkerr , I am currently away until next week, but this is something I wanted for us to tackle in a more generic way. I was thinking about doing something along the lines of having a file with:
And adding a command to access this file and change it in settings. Something where we could do: Thoughts? |
stkerr
changed the title
Add a feature setting for preferred data source
Add routines to retrieve preferred data source for a given command
Jun 11, 2022
stkerr
commented
Jun 11, 2022
stkerr
force-pushed
the
stkerr-preferred-data-provider-setting
branch
from
June 11, 2022 20:52
1cf700a
to
ce29e6e
Compare
…pecifies a specific file
stkerr
force-pushed
the
stkerr-preferred-data-provider-setting
branch
from
June 13, 2022 15:14
2600a1b
to
f677e31
Compare
…tkerr/OpenBBTerminal into stkerr-preferred-data-provider-setting
…tkerr/OpenBBTerminal into stkerr-preferred-data-provider-setting
DidierRLopes
approved these changes
Jun 14, 2022
DidierRLopes
changed the title
Add routines to retrieve preferred data source for a given command
Preferred data source for a given command and help docs for any command
Jun 14, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR adds a new feature settings under
/settings
calledpreferred_data_source_file
. It is defaulted tosources.json
. This PR updates the/stocks/load
command to use the preferred data source if one is not specified explicitly.This PR also introduces a new helper function called
get_preferred_source
which can be used to retrieve the preferred value for a given command. If a specific value is not present, the function wlll return the most specific preference as possible, eventually resulting in the default value. In practice, this means a call likeget_preferred_source("stocks.subcommand.subsubcommand")
will return first the value forstocks.subcommand.subsubcommand
, thenstocks.subcommand["default"]
, thenstocks["default"]
, then eventually the root-level["default"]
value.This is intended to allow different parts of Terminal to know what data source the user wants to use and then they can take action based on that. The individual commands implemented will be responsible for examining and respecting this value.
In the future, this can be used to change the logic inside of various functions depending on which data source the user prefers, rather than hardcoding to Yahoo finance as is currently done in several parts of the Terminal. As various other data sources, such as new brokers, are added, users can select those as their preferred data source instead of Yahoo.
How has this been tested?
Existing pytests were run successfully.
Several manual runs to change the values in the source file and then run the load command were done.
Checklist:
Others
pre-commit install
.pytest tests/...
.