Use pair-reconstruction method wherever possible

This commit is contained in:
Matthias 2021-12-07 20:12:44 +01:00
parent 5b67be06c2
commit f1c5a4d065
2 changed files with 4 additions and 4 deletions

View File

@ -66,7 +66,7 @@ class HDF5DataHandler(IDataHandler):
_tmp = [re.search(r'^(\S+)(?=\-' + timeframe + candle + '.h5)', p.name) _tmp = [re.search(r'^(\S+)(?=\-' + timeframe + candle + '.h5)', p.name)
for p in datadir.glob(f"*{timeframe}{candle}.h5")] for p in datadir.glob(f"*{timeframe}{candle}.h5")]
# Check if regex found something and only return these results # Check if regex found something and only return these results
return [match[0].replace('_', '/') for match in _tmp if match] return [cls.rebuild_pair_from_filename(match[0]) for match in _tmp if match]
def ohlcv_store( def ohlcv_store(
self, self,
@ -160,7 +160,7 @@ class HDF5DataHandler(IDataHandler):
_tmp = [re.search(r'^(\S+)(?=\-trades.h5)', p.name) _tmp = [re.search(r'^(\S+)(?=\-trades.h5)', p.name)
for p in datadir.glob("*trades.h5")] for p in datadir.glob("*trades.h5")]
# Check if regex found something and only return these results to avoid exceptions. # Check if regex found something and only return these results to avoid exceptions.
return [match[0].replace('_', '/') for match in _tmp if match] return [cls.rebuild_pair_from_filename(match[0]) for match in _tmp if match]
def trades_store(self, pair: str, data: TradeList) -> None: def trades_store(self, pair: str, data: TradeList) -> None:
""" """

View File

@ -67,7 +67,7 @@ class JsonDataHandler(IDataHandler):
_tmp = [re.search(r'^(\S+)(?=\-' + timeframe + candle + '.json)', p.name) _tmp = [re.search(r'^(\S+)(?=\-' + timeframe + candle + '.json)', p.name)
for p in datadir.glob(f"*{timeframe}{candle}.{cls._get_file_extension()}")] for p in datadir.glob(f"*{timeframe}{candle}.{cls._get_file_extension()}")]
# Check if regex found something and only return these results # Check if regex found something and only return these results
return [match[0].replace('_', '/') for match in _tmp if match] return [cls.rebuild_pair_from_filename(match[0]) for match in _tmp if match]
def ohlcv_store( def ohlcv_store(
self, self,
@ -156,7 +156,7 @@ class JsonDataHandler(IDataHandler):
_tmp = [re.search(r'^(\S+)(?=\-trades.json)', p.name) _tmp = [re.search(r'^(\S+)(?=\-trades.json)', p.name)
for p in datadir.glob(f"*trades.{cls._get_file_extension()}")] for p in datadir.glob(f"*trades.{cls._get_file_extension()}")]
# Check if regex found something and only return these results to avoid exceptions. # Check if regex found something and only return these results to avoid exceptions.
return [match[0].replace('_', '/') for match in _tmp if match] return [cls.rebuild_pair_from_filename(match[0]) for match in _tmp if match]
def trades_store(self, pair: str, data: TradeList) -> None: def trades_store(self, pair: str, data: TradeList) -> None:
""" """