From e63efd435363712fe03d76f62c552b81f92a4129 Mon Sep 17 00:00:00 2001 From: Onur Cetinkol Date: Wed, 15 Nov 2023 16:27:05 +0300 Subject: [PATCH] bug fixes --- setup.py | 2 +- tradingfeatures/api_base.py | 6 +++--- tradingfeatures/apis/binance/funding.py | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/setup.py b/setup.py index 57704d2..a47b496 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setup( name="tradingfeatures", - version="0.7.0", + version="0.7.1", author="Onur Cetinkol", author_email="realiti44@gmail.com", description="A useful tool to download market history from popular exchanges.", diff --git a/tradingfeatures/api_base.py b/tradingfeatures/api_base.py index 4359499..f9f5fbc 100644 --- a/tradingfeatures/api_base.py +++ b/tradingfeatures/api_base.py @@ -124,11 +124,11 @@ def get_hist( end=str(end_batch), ) if df_temp is None: # Try this fix for other apis - print(" Warning: Got empty window from exchange at start") + df_temp = pd.DataFrame() assert ( len(df) == 0 ), "Warning: Got empty window from exchange in middle of download" - df_temp = pd.DataFrame() + print(" Warning: Got empty window from exchange at start") except Exception as e: # raise e print(e, "\nDebug: error between timestamps: ", start_batch, end_batch) @@ -196,7 +196,7 @@ def calc_start(self, limit, start=None, end=None, interval=3600, scale=1): end = current_time if end is None else end if start is None: start = end - ( - interval * (limit - 1) + (interval * limit) - 3600 ) # limit -1 to be sure to get the latest hour out_of_range = True if limit > self.limit else False return start, end, out_of_range diff --git a/tradingfeatures/apis/binance/funding.py b/tradingfeatures/apis/binance/funding.py index 5480722..844dfa1 100644 --- a/tradingfeatures/apis/binance/funding.py +++ b/tradingfeatures/apis/binance/funding.py @@ -62,15 +62,15 @@ def get( df = pd.DataFrame(result) df["timestamp"] = df["fundingTime"].div(1000).astype(int) - df.pop("fundingTime") - df.pop("symbol") + df = df[['fundingRate', 'timestamp']] df = df.set_index("timestamp") - df = df.astype(float) df.rename(columns={"fundingRate": "fundingRate_binance"}, inplace=True) if get_latest: # add this to binance as well df = self.get_recent(df) + df = df.astype(float) + # if columns is not None: # return df[columns] return self.convert_funding(df, get_latest)