From b1d9155b2ef4e90c5593f48aa7638e23a0a50a29 Mon Sep 17 00:00:00 2001 From: Danglewood <85772166+deeleeramone@users.noreply.github.com> Date: Thu, 24 Oct 2024 17:30:18 -0700 Subject: [PATCH] fix some bugs before release (#6869) --- openbb_platform/providers/imf/__init__.py | 1 + .../openbb_tiingo/models/crypto_historical.py | 15 ++++++------ .../models/currency_historical.py | 23 +++++++++++-------- 3 files changed, 22 insertions(+), 17 deletions(-) create mode 100644 openbb_platform/providers/imf/__init__.py diff --git a/openbb_platform/providers/imf/__init__.py b/openbb_platform/providers/imf/__init__.py new file mode 100644 index 00000000000..0f0076f6c21 --- /dev/null +++ b/openbb_platform/providers/imf/__init__.py @@ -0,0 +1 @@ +"""IMF Provoider Extension.""" diff --git a/openbb_platform/providers/tiingo/openbb_tiingo/models/crypto_historical.py b/openbb_platform/providers/tiingo/openbb_tiingo/models/crypto_historical.py index 93862a0530c..344e12192cd 100644 --- a/openbb_platform/providers/tiingo/openbb_tiingo/models/crypto_historical.py +++ b/openbb_platform/providers/tiingo/openbb_tiingo/models/crypto_historical.py @@ -136,14 +136,15 @@ class TiingoCryptoHistoricalFetcher( base_url = "https://api.tiingo.com/tiingo/crypto/prices" query_str = get_querystring(query.model_dump(by_alias=True), ["interval"]) - frequency = query.interval - if frequency.endswith("m"): - frequency = f"{frequency[:-1]}min" - elif frequency == "h": - frequency = f"{frequency[:-1]}hour" - elif frequency.endswith("d"): - frequency = f"{frequency[:-1]}day" + if query.interval.endswith("m"): + frequency = f"{query.interval[:-1]}min" + elif query.interval.endswith("h"): + frequency = f"{query.interval[:-1]}hour" + elif query.interval.endswith("d"): + frequency = f"{query.interval[:-1]}day" + else: + frequency = "1day" results: list = [] url = f"{base_url}?{query_str}&resampleFreq={frequency}&token={api_key}" diff --git a/openbb_platform/providers/tiingo/openbb_tiingo/models/currency_historical.py b/openbb_platform/providers/tiingo/openbb_tiingo/models/currency_historical.py index 372e36b3230..ae4ca19a1cf 100644 --- a/openbb_platform/providers/tiingo/openbb_tiingo/models/currency_historical.py +++ b/openbb_platform/providers/tiingo/openbb_tiingo/models/currency_historical.py @@ -117,17 +117,19 @@ class TiingoCurrencyHistoricalFetcher( query_str = get_querystring( query.model_dump(by_alias=True), ["symbol", "interval"] ) - frequency = query.interval - if frequency.endswith("m"): - frequency = f"{frequency[:-1]}min" - elif frequency == "h": - frequency = f"{frequency[:-1]}hour" - elif frequency.endswith("d"): - frequency = f"{frequency[:-1]}day" + if query.interval.endswith("m"): + frequency = f"{query.interval[:-1]}min" + elif query.interval.endswith("h"): + frequency = f"{query.interval[:-1]}hour" + elif query.interval.endswith("d"): + frequency = f"{query.interval[:-1]}day" + else: + frequency = "1day" results: list = [] messages: list = [] + symbols = query.symbol.split(",") async def get_one(symbol): """Get data for one symbol.""" @@ -149,8 +151,10 @@ class TiingoCurrencyHistoricalFetcher( if isinstance(data, list): for d in data: - if "," in query.symbol: - d["symbol"] = symbol + ticker = d.pop("ticker", None) + if ticker and len(symbols) > 1: + d["ticker"] = d["ticker"].upper() + if query.interval.endswith("d"): d["date"] = to_datetime(d["date"]).date() else: @@ -158,7 +162,6 @@ class TiingoCurrencyHistoricalFetcher( results.extend(data) - symbols = query.symbol.split(",") await asyncio.gather(*[get_one(symbol) for symbol in symbols]) if not results and messages: