Fix issue 4316 (#4357)

* Fix issue 4316

* Updating polygon_model + options_controller

* Tests : FRED
This commit is contained in:
Chavithra
2023-03-01 03:08:47 +01:00
committed by GitHub
parent 36266d5563
commit 39a58b38cf
4 changed files with 13 additions and 8 deletions

View File

@@ -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:

View File

@@ -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()}

View File

@@ -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,

View File

@@ -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]] = {