Enhance ohlcv_convert method
This commit is contained in:
parent
018e270336
commit
d804372d74
@ -252,11 +252,12 @@ def convert_trades_format(config: Dict[str, Any], convert_from: str, convert_to:
|
||||
|
||||
if 'pairs' not in config:
|
||||
config['pairs'] = SrcClass.trades_get_pairs(Path(config['datadir']))
|
||||
logger.info(f"Converting trades for {config['pairs']}")
|
||||
logger.info(f"Converting trades for {config['pairs']}")
|
||||
|
||||
for pair in config['pairs']:
|
||||
src = SrcClass(Path(config['datadir'], pair))
|
||||
trg = TrgClass(Path(config['datadir'], pair))
|
||||
print(pair)
|
||||
src = SrcClass(Path(config['datadir']), pair)
|
||||
trg = TrgClass(Path(config['datadir']), pair)
|
||||
data = src.trades_load()
|
||||
logger.info(f"Converting {len(data)} trades for {pair}")
|
||||
trg.trades_store(data)
|
||||
@ -269,17 +270,25 @@ def convert_ohlcv_format(config: Dict[str, Any], convert_from: str, convert_to:
|
||||
"""
|
||||
SrcClass = get_datahandlerclass(convert_from)
|
||||
TrgClass = get_datahandlerclass(convert_to)
|
||||
timeframes = config.get('timeframes', [config.get('ticker_interval')])
|
||||
logger.info(f"Converting OHLCV for timeframe {timeframes}")
|
||||
|
||||
if 'pairs' not in config:
|
||||
config['pairs'] = SrcClass.ohclv_get_pairs(Path(config['datadir']), config['ticker_interval'])
|
||||
logger.info(f"Converting OHLCV for {config['pairs']}")
|
||||
config['pairs'] = []
|
||||
# Check timeframes or fall back to ticker_interval.
|
||||
for timeframe in timeframes:
|
||||
config['pairs'].extend(SrcClass.ohlcv_get_pairs(Path(config['datadir']),
|
||||
timeframe))
|
||||
logger.info(f"Converting OHLCV for {config['pairs']}")
|
||||
|
||||
for pair in config['pairs']:
|
||||
src = SrcClass(Path(config['datadir']), pair)
|
||||
trg = TrgClass(Path(config['datadir']), pair)
|
||||
data = src.ohlcv_load()
|
||||
logger.info(f"Converting {len(data)} candles for {pair}")
|
||||
trg.ohlcv_store(data)
|
||||
for timeframe in timeframes:
|
||||
|
||||
for pair in config['pairs']:
|
||||
src = SrcClass(Path(config['datadir']), pair)
|
||||
trg = TrgClass(Path(config['datadir']), pair)
|
||||
data = src.ohlcv_load(timeframe)
|
||||
logger.info(f"Converting {len(data)} candles for {pair}")
|
||||
# trg.ohlcv_store(data)
|
||||
|
||||
|
||||
def start_convert_data(args: Dict[str, Any], ohlcv: bool = True) -> None:
|
||||
|
Loading…
Reference in New Issue
Block a user