diff options
author | Danglewood <85772166+deeleeramone@users.noreply.github.com> | 2024-06-29 19:35:57 -0700 |
---|---|---|
committer | Danglewood <85772166+deeleeramone@users.noreply.github.com> | 2024-06-29 19:35:57 -0700 |
commit | e84b5a5be5009c5a6f0dea03a18b1894d04aa8cc (patch) | |
tree | 47b4850f5f837c02d12e13ae692e8361eb28c556 | |
parent | 9fcbc2e2fcb9ec0cf39a16b50d2c651fd86e5b04 (diff) |
pylint
-rw-r--r-- | openbb_platform/providers/cboe/openbb_cboe/utils/vix.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/openbb_platform/providers/cboe/openbb_cboe/utils/vix.py b/openbb_platform/providers/cboe/openbb_cboe/utils/vix.py index bbd3eb33432..150e017c90d 100644 --- a/openbb_platform/providers/cboe/openbb_cboe/utils/vix.py +++ b/openbb_platform/providers/cboe/openbb_cboe/utils/vix.py @@ -47,9 +47,8 @@ def get_front_month(date: Optional[str] = None): if today.day > third_wednesday: # If today is after the third Wednesday of the month, return the next month return (today.month % 12) + 1 - else: - # Otherwise, return the current month - return today.month + # Otherwise, return the current month + return today.month def get_vx_symbols(date: Optional[str] = None) -> Dict: @@ -165,6 +164,7 @@ async def get_vx_current( return df +# pylint: disable=too-many-locals async def get_vx_by_date( date: Union[str, List[str]], vx_type: Literal["am", "eod"] = "eod", @@ -193,7 +193,6 @@ async def get_vx_by_date( from openbb_core.app.model.abstract.error import OpenBBError from openbb_core.provider.utils.errors import EmptyDataError from openbb_cboe.models.equity_historical import CboeEquityHistoricalFetcher - from numpy import abs from pandas import Categorical, DataFrame, DatetimeIndex, concat, isna, to_datetime if vx_type not in ["am", "eod"]: @@ -263,10 +262,10 @@ async def get_vx_by_date( df = df.dropna(how="any") nearest_dates = [] - for date in dates_list: - nearest_date = df.index.asof(date) + for date_ in dates_list: + nearest_date = df.index.asof(date_) if isna(nearest_date): # type: ignore - differences = abs(df.index - date) + differences = abs(df.index - date_) min_diff_index = differences.argmin() nearest_date = df.index[min_diff_index] nearest_dates.append(nearest_date) |