trades_append should use dataframe, not lists

This commit is contained in:
Matthias
2023-08-17 18:06:25 +02:00
parent 780f238904
commit 6fc1ee9831
6 changed files with 11 additions and 11 deletions

View File

@@ -95,11 +95,11 @@ class FeatherDataHandler(IDataHandler):
tradesdata = DataFrame(data, columns=DEFAULT_TRADES_COLUMNS) tradesdata = DataFrame(data, columns=DEFAULT_TRADES_COLUMNS)
tradesdata.to_feather(filename, compression_level=9, compression='lz4') tradesdata.to_feather(filename, compression_level=9, compression='lz4')
def trades_append(self, pair: str, data: TradeList): def trades_append(self, pair: str, data: DataFrame):
""" """
Append data to existing files Append data to existing files
:param pair: Pair - used for filename :param pair: Pair - used for filename
:param data: List of Lists containing trade data, :param data: Dataframe containing trades
column sequence as in DEFAULT_TRADES_COLUMNS column sequence as in DEFAULT_TRADES_COLUMNS
""" """
raise NotImplementedError() raise NotImplementedError()

View File

@@ -115,11 +115,11 @@ class HDF5DataHandler(IDataHandler):
format='table', data_columns=['timestamp'] format='table', data_columns=['timestamp']
) )
def trades_append(self, pair: str, data: TradeList): def trades_append(self, pair: str, data: pd.DataFrame):
""" """
Append data to existing files Append data to existing files
:param pair: Pair - used for filename :param pair: Pair - used for filename
:param data: List of Lists containing trade data, :param data: Dataframe containing trades
column sequence as in DEFAULT_TRADES_COLUMNS column sequence as in DEFAULT_TRADES_COLUMNS
""" """
raise NotImplementedError() raise NotImplementedError()

View File

@@ -180,11 +180,11 @@ class IDataHandler(ABC):
""" """
@abstractmethod @abstractmethod
def trades_append(self, pair: str, data: TradeList): def trades_append(self, pair: str, data: DataFrame):
""" """
Append data to existing files Append data to existing files
:param pair: Pair - used for filename :param pair: Pair - used for filename
:param data: List of Lists containing trade data, :param data: Dataframe containing trades
column sequence as in DEFAULT_TRADES_COLUMNS column sequence as in DEFAULT_TRADES_COLUMNS
""" """

View File

@@ -104,11 +104,11 @@ class JsonDataHandler(IDataHandler):
filename = self._pair_trades_filename(self._datadir, pair) filename = self._pair_trades_filename(self._datadir, pair)
misc.file_dump_json(filename, data, is_zip=self._use_zip) misc.file_dump_json(filename, data, is_zip=self._use_zip)
def trades_append(self, pair: str, data: TradeList): def trades_append(self, pair: str, data: DataFrame):
""" """
Append data to existing files Append data to existing files
:param pair: Pair - used for filename :param pair: Pair - used for filename
:param data: List of Lists containing trade data, :param data: Dataframe containing trades
column sequence as in DEFAULT_TRADES_COLUMNS column sequence as in DEFAULT_TRADES_COLUMNS
""" """
raise NotImplementedError() raise NotImplementedError()

View File

@@ -95,11 +95,11 @@ class ParquetDataHandler(IDataHandler):
# array # array
# feather.write_feather(data, filename) # feather.write_feather(data, filename)
def trades_append(self, pair: str, data: TradeList): def trades_append(self, pair: str, data: DataFrame):
""" """
Append data to existing files Append data to existing files
:param pair: Pair - used for filename :param pair: Pair - used for filename
:param data: List of Lists containing trade data, :param data: Dataframe containing trades
column sequence as in DEFAULT_TRADES_COLUMNS column sequence as in DEFAULT_TRADES_COLUMNS
""" """
raise NotImplementedError() raise NotImplementedError()

View File

@@ -291,7 +291,7 @@ def test_datahandler_ohlcv_append(datahandler, testdatadir, ):
def test_datahandler_trades_append(datahandler, testdatadir): def test_datahandler_trades_append(datahandler, testdatadir):
dh = get_datahandler(testdatadir, datahandler) dh = get_datahandler(testdatadir, datahandler)
with pytest.raises(NotImplementedError): with pytest.raises(NotImplementedError):
dh.trades_append('UNITTEST/ETH', []) dh.trades_append('UNITTEST/ETH', DataFrame())
def test_hdf5datahandler_trades_get_pairs(testdatadir): def test_hdf5datahandler_trades_get_pairs(testdatadir):