diff options
author | Danglewood <85772166+deeleeramone@users.noreply.github.com> | 2024-01-26 15:40:03 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-26 23:40:03 +0000 |
commit | e7798c211ecc50912a4cfd96dbf30097ec9fe4de (patch) | |
tree | 0aa026b886dd42503fad8e4f85cb917ded3aaa72 | |
parent | c6eefd26b92b44b32ac13151fce44d6e0bc0e80f (diff) |
hotfix/intrinio-options-date: Fix comparing values between str and datetime (#5997)
* fix compare between str and datetime
* unused argument
* get_weekday
* lint
---------
Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>
-rw-r--r-- | openbb_platform/providers/intrinio/openbb_intrinio/models/options_chains.py | 11 | ||||
-rw-r--r-- | openbb_platform/providers/intrinio/openbb_intrinio/utils/helpers.py | 6 |
2 files changed, 11 insertions, 6 deletions
diff --git a/openbb_platform/providers/intrinio/openbb_intrinio/models/options_chains.py b/openbb_platform/providers/intrinio/openbb_intrinio/models/options_chains.py index 08c31786ebd..252a16766b3 100644 --- a/openbb_platform/providers/intrinio/openbb_intrinio/models/options_chains.py +++ b/openbb_platform/providers/intrinio/openbb_intrinio/models/options_chains.py @@ -1,5 +1,6 @@ """Intrinio Options Chains Model.""" +# pylint: disable=unused-argument from datetime import ( date as dateType, datetime, @@ -116,11 +117,15 @@ class IntrinioOptionsChainsFetcher( date = datetime.now().date() if query.date is None else query.date date = get_weekday(date) - results = await amake_requests(await get_urls(date), callback, **kwargs) + results = await amake_requests( + await get_urls(date.strftime("%Y-%m-%d")), callback, **kwargs + ) if not results: - urls = await get_urls(get_weekday(date - timedelta(days=1))) - results = await amake_requests(urls, callback, **kwargs) + urls = await get_urls( + get_weekday(date - timedelta(days=1)).strftime("%Y-%m-%d") + ) + results = await amake_requests(urls, response_callback=callback, **kwargs) return results diff --git a/openbb_platform/providers/intrinio/openbb_intrinio/utils/helpers.py b/openbb_platform/providers/intrinio/openbb_intrinio/utils/helpers.py index 51fdd8dd11f..83126a65809 100644 --- a/openbb_platform/providers/intrinio/openbb_intrinio/utils/helpers.py +++ b/openbb_platform/providers/intrinio/openbb_intrinio/utils/helpers.py @@ -123,11 +123,11 @@ async def get_data_one(url: str, **kwargs: Any) -> Dict[str, Any]: return data -def get_weekday(date: dateType) -> str: +def get_weekday(date: dateType) -> dateType: """Return the weekday date.""" if date.weekday() in [5, 6]: - return (date - timedelta(days=date.weekday() - 4)).strftime("%Y-%m-%d") - return date.strftime("%Y-%m-%d") + return date - timedelta(days=date.weekday() - 4) + return date async def async_get_data_one( |