marketTrade/market_trade/dataloader.py
2022-05-17 15:58:20 +03:00

29 lines
947 B
Python

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_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)
# 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']