import pandas as pd class DukaMTInterface: """ Interface between my askbid candlesticks and sasha's price candlesticks has two attributes -- bids and asks """ 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 # droppnig old timestamp index self.duka_dataset.reset_index(inplace=True, drop=True) # adding bids self.bid_candlesticks = self.duka_dataset['bid'].copy() self.bid_candlesticks['date'] = self.duka_dataset['date'] # adding asks self.ask_candlesticks = self.duka_dataset['ask'].copy() self.ask_candlesticks['date'] = self.duka_dataset['date']