Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
realiti4 committed Nov 15, 2023
1 parent b28d2d4 commit e63efd4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
6 changes: 3 additions & 3 deletions tradingfeatures/api_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions tradingfeatures/apis/binance/funding.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e63efd4

Please sign in to comment.