diff --git a/market_trade/dataloader.py b/market_trade/dataloader.py index e48308a..846c24a 100644 --- a/market_trade/dataloader.py +++ b/market_trade/dataloader.py @@ -8,9 +8,13 @@ class DukaMTInterface: has two attributes -- bids and asks """ - def __init__(self, duka_candlesticks_filepath): - # 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) + 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, index_col=0, header=[0, 1], parse_dates=True) # renaming timestamp to date self.duka_dataset['date'] = self.duka_dataset.index