revised dataloader

This commit is contained in:
Mark 2022-06-04 16:32:02 +03:00
parent c608d73f07
commit aaee1a9fcf

View File

@ -8,9 +8,13 @@ class DukaMTInterface:
has two attributes -- bids and asks
"""
def __init__(self, duka_candlesticks_filepath):
def __init__(self, duka_candlesticks):
# checking if provided is path or pandas dataframe
if isinstance(duka_candlesticks, pd.DataFrame):
self.duka_dataset = duka_candlesticks
else:
# reading index from column 0 and header takes two rows, because of multirow indexers
self.duka_dataset = pd.read_csv(duka_candlesticks_filepath, index_col=0, header=[0, 1], parse_dates=True)
self.duka_dataset = pd.read_csv(duka_candlesticks, index_col=0, header=[0, 1], parse_dates=True)
# renaming timestamp to date
self.duka_dataset['date'] = self.duka_dataset.index