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

[BugFix] Make User Preferences -> Defaults Work With Any Parameter #6687

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

Conversation

deeleeramone
Copy link
Contributor

@deeleeramone deeleeramone commented Sep 23, 2024

  1. Why?:

    • The "defaults" section of the user_settings.json was not able to cope with anything other than "provider".
    • The app fails to import if the defaults configuration is incorrect.
  2. What?:

  3. Impact:

    • Improved configurability.
    • The API only partially supports this behavior because all mandatory fields need to be supplied to the URL.
  4. Testing Done:

    • Ran integration tests and have not found unexpected behavior.

User Settings:

{
  "defaults": {
    "commands": {
      "/equity/price/historical": {
        "provider": "yfinance",
        "chart": true,
        "chart_params": {
          "heikin_ashi": true,
          "indicators": {
            "sma": {
              "length": [21, 50]
            },
            "ema": {
              "length": 150
            }
          }
        }
      }
    }
  }
}

Before:

from openbb import obb
ValidationError: 2 validation errors for UserSettings
defaults.commands.`equity.price.historical`.chart
  Input should be a valid list [type=list_type, input_value=True, input_type=bool]
    For further information visit https://errors.pydantic.dev/2.9/v/list_type
defaults.commands.`equity.price.historical`.chart_params
  Input should be a valid list [type=list_type, input_value={'heikin_ashi': True, 'in...'ema': {'length': 150}}}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.9/v/list_type

After:

from openbb import obb

res = obb.equity.price.historical(symbol="AAPL")
res.show()

image

@deeleeramone deeleeramone added bug Fix bug platform OpenBB Platform labels Sep 23, 2024
@github-actions github-actions bot added v4 PRs for v4 labels Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fix bug platform OpenBB Platform v4 PRs for v4
Projects
None yet
1 participant