Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
realiti4 committed Mar 15, 2021
1 parent d34290d commit 4840025
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 21 deletions.
2 changes: 1 addition & 1 deletion tradingfeatures/apis/bitmex/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def get(self,

start, end, out_of_range = self.calc_start(limit, start, end, interval)
if out_of_range:
return self.get_hist(start=start, end=end)
return self.get_hist(start=start, end=end, columns=columns)

address = address or self.address
address = self.base_address + address
Expand Down
5 changes: 3 additions & 2 deletions tradingfeatures/apis/bitmex/funding.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,11 @@ def get_recent(self, df): # Recent Funding
df_final = df_final[['fundingRate']]
return df_final

def get_hist(self, convert_funds=False, *args, **kwargs):
def get_hist(self, columns=None, convert_funds=False, *args, **kwargs):
columns = ['fundingRate', 'fundingRateDaily'] if columns is None else columns
return apiBase.get_hist(
self,
columns=['fundingRate', 'fundingRateDaily'],
columns=columns,
interval='8h',
*args, **kwargs
)
Expand Down
13 changes: 4 additions & 9 deletions tradingfeatures/apis/bitmex/quote.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,6 @@ def __init__(self):
self.start = 1423227200

def get(self, symbol=None, query=None, start=None, end=None, *args, **kwargs):
# start = self.start if start is None else start
# end = time.time() if end is None else end
# start, end = self.to_date(start), self.to_date(end)
# symbol = symbol or 'XBT'

# if query is None:
# query = {'symbol': symbol, 'binSize': interval, 'count': self.limit, 'reverse': 'false', 'startTime': start}

return super(bitmexQuote, self).get(
query=query,
Expand All @@ -31,10 +24,12 @@ def get(self, symbol=None, query=None, start=None, end=None, *args, **kwargs):
*args, **kwargs
)

def get_hist(self, convert_funds=False, *args, **kwargs):
def get_hist(self, columns=None, convert_funds=False, *args, **kwargs):
columns = ['bidSize', 'bidPrice', 'askPrice', 'askSize'] if columns is None else columns

df = apiBase.get_hist(
self,
columns=['bidSize', 'bidPrice', 'askPrice', 'askSize'],
columns=columns,
# interval='8h',
*args, **kwargs
)
Expand Down
11 changes: 2 additions & 9 deletions tradingfeatures/uber.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def eval_get(self, limit=1000, **kwargs):

# Fix for 0 and nan - check here again later
merged = merged.replace(0, np.nan)
if df.isnull().values.any(): # Check here later
if merged.isnull().values.any(): # Check here later
merged = merged.interpolate()

return merged
Expand Down Expand Up @@ -96,14 +96,7 @@ def get(self, path='', datasets=None, merge=True, trends=False, date=True,
df_final[item] = df_main.loc[:, df_main.columns.str.contains(item)].mean(axis=1)

if date:
df_final['date'] = pd.to_datetime(df_final.index, unit='s', utc=True)

# Extras
# if experiment_binance:
# binance_api = self.apis_dict['binance']
# columns = ['quote_asset_volume', 'number_of_trades', 'taker_base_asset_volume', 'taker_quote_asset_volume']
# features = binance_api.get()[columns]
# df_final = df_final.join(features)
df_final['date'] = pd.to_datetime(df_final.index, unit='s', utc=True)

if trends:
df_trends = self.google_trends.update('uber_data')
Expand Down

0 comments on commit 4840025

Please sign in to comment.