diff options
author | Chavithra <chavithra@gmail.com> | 2023-03-01 03:08:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-01 03:08:47 +0100 |
commit | 39a58b38cf00b8aeedf55b16002c252fa0ea77ba (patch) | |
tree | c6214a34de6dd5b96103ec2d1faeb6d1d56005a3 | |
parent | 36266d5563667f4f21e18811b5d49b8b59160a45 (diff) |
Fix issue 4316 (#4357)
* Fix issue 4316
* Updating polygon_model + options_controller
* Tests : FRED
-rw-r--r-- | openbb_terminal/economy/nasdaq_model.py | 4 | ||||
-rw-r--r-- | openbb_terminal/forex/polygon_model.py | 4 | ||||
-rw-r--r-- | openbb_terminal/stocks/options/options_controller.py | 6 | ||||
-rw-r--r-- | tests/conftest.py | 7 |
4 files changed, 13 insertions, 8 deletions
diff --git a/openbb_terminal/economy/nasdaq_model.py b/openbb_terminal/economy/nasdaq_model.py index ace479ddf1f..090dbf87e0d 100644 --- a/openbb_terminal/economy/nasdaq_model.py +++ b/openbb_terminal/economy/nasdaq_model.py @@ -9,7 +9,7 @@ from typing import List, Optional, Union import pandas as pd -from openbb_terminal.config_terminal import API_KEY_QUANDL +import openbb_terminal.config_terminal as cfg from openbb_terminal.decorators import check_api_key, log_start_end from openbb_terminal.helper_funcs import request from openbb_terminal.rich_config import console @@ -177,7 +177,7 @@ def get_big_mac_index(country_code: str = "USA") -> pd.DataFrame: Dataframe with Big Mac index converted to USD equivalent. """ URL = f"https://data.nasdaq.com/api/v3/datasets/ECONOMIST/BIGMAC_{country_code}" - URL += f"?column_index=3&api_key={API_KEY_QUANDL}" + URL += f"?column_index=3&api_key={cfg.API_KEY_QUANDL}" try: r = request(URL) except Exception: diff --git a/openbb_terminal/forex/polygon_model.py b/openbb_terminal/forex/polygon_model.py index 4accd4adffe..ed237d187b3 100644 --- a/openbb_terminal/forex/polygon_model.py +++ b/openbb_terminal/forex/polygon_model.py @@ -6,7 +6,7 @@ from typing import Optional import pandas as pd -from openbb_terminal.config_terminal import API_POLYGON_KEY as api_key +import openbb_terminal.config_terminal as cfg from openbb_terminal.decorators import check_api_key from openbb_terminal.helper_funcs import get_user_agent, request from openbb_terminal.rich_config import console @@ -48,7 +48,7 @@ def get_historical( request_url = ( f"https://api.polygon.io/v2/aggs/ticker/C:{fx_pair}/range" - f"/{multiplier}/{timespan}/{start_date}/{end_date}?adjusted=true&sort=desc&limit=50000&apiKey={api_key}" + f"/{multiplier}/{timespan}/{start_date}/{end_date}?adjusted=true&sort=desc&limit=50000&apiKey={cfg.API_POLYGON_KEY}" ) json_response = request( request_url, headers={"User-Agent": get_user_agent()} diff --git a/openbb_terminal/stocks/options/options_controller.py b/openbb_terminal/stocks/options/options_controller.py index f74f9a0f5ac..75439a01a11 100644 --- a/openbb_terminal/stocks/options/options_controller.py +++ b/openbb_terminal/stocks/options/options_controller.py @@ -9,7 +9,7 @@ from typing import List, Optional import pandas as pd from openbb_terminal import feature_flags as obbff -from openbb_terminal.config_terminal import API_TRADIER_TOKEN +import openbb_terminal.config_terminal as cfg from openbb_terminal.custom_prompt_toolkit import NestedCompleter from openbb_terminal.decorators import log_start_end from openbb_terminal.helper_funcs import ( @@ -141,7 +141,7 @@ class OptionsController(BaseController): self.source = "" if ticker: - if API_TRADIER_TOKEN == "REPLACE_ME": # nosec + if cfg.API_TRADIER_TOKEN == "REPLACE_ME": # nosec console.print("Loaded expiry dates from Yahoo Finance") self.expiry_dates = yfinance_model.option_expirations(self.ticker) else: @@ -844,7 +844,7 @@ class OptionsController(BaseController): ) if ( - ns_parser.source == "Tradier" and API_TRADIER_TOKEN != "REPLACE_ME" + ns_parser.source == "Tradier" and cfg.API_TRADIER_TOKEN != "REPLACE_ME" ): # nosec tradier_view.display_historical( symbol=self.ticker, diff --git a/tests/conftest.py b/tests/conftest.py index 0de22fe833b..42393927730 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -23,11 +23,16 @@ from openbb_terminal import ( feature_flags as obbff, helper_funcs, ) -from openbb_terminal.base_helpers import strtobool +from openbb_terminal.base_helpers import ( + load_dotenv_and_reload_configs, + strtobool, +) # pylint: disable=redefined-outer-name +load_dotenv_and_reload_configs() + DISPLAY_LIMIT: int = 500 EXTENSIONS_ALLOWED: List[str] = ["csv", "json", "txt"] EXTENSIONS_MATCHING: Dict[str, List[Type]] = { |