Enhance ohlcv_convert method
This commit is contained in:
parent
018e270336
commit
d804372d74
@ -255,8 +255,9 @@ def convert_trades_format(config: Dict[str, Any], convert_from: str, convert_to:
|
|||||||
logger.info(f"Converting trades for {config['pairs']}")
|
logger.info(f"Converting trades for {config['pairs']}")
|
||||||
|
|
||||||
for pair in config['pairs']:
|
for pair in config['pairs']:
|
||||||
src = SrcClass(Path(config['datadir'], pair))
|
print(pair)
|
||||||
trg = TrgClass(Path(config['datadir'], pair))
|
src = SrcClass(Path(config['datadir']), pair)
|
||||||
|
trg = TrgClass(Path(config['datadir']), pair)
|
||||||
data = src.trades_load()
|
data = src.trades_load()
|
||||||
logger.info(f"Converting {len(data)} trades for {pair}")
|
logger.info(f"Converting {len(data)} trades for {pair}")
|
||||||
trg.trades_store(data)
|
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)
|
SrcClass = get_datahandlerclass(convert_from)
|
||||||
TrgClass = get_datahandlerclass(convert_to)
|
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:
|
if 'pairs' not in config:
|
||||||
config['pairs'] = SrcClass.ohclv_get_pairs(Path(config['datadir']), config['ticker_interval'])
|
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']}")
|
logger.info(f"Converting OHLCV for {config['pairs']}")
|
||||||
|
|
||||||
|
for timeframe in timeframes:
|
||||||
|
|
||||||
for pair in config['pairs']:
|
for pair in config['pairs']:
|
||||||
src = SrcClass(Path(config['datadir']), pair)
|
src = SrcClass(Path(config['datadir']), pair)
|
||||||
trg = TrgClass(Path(config['datadir']), pair)
|
trg = TrgClass(Path(config['datadir']), pair)
|
||||||
data = src.ohlcv_load()
|
data = src.ohlcv_load(timeframe)
|
||||||
logger.info(f"Converting {len(data)} candles for {pair}")
|
logger.info(f"Converting {len(data)} candles for {pair}")
|
||||||
trg.ohlcv_store(data)
|
# trg.ohlcv_store(data)
|
||||||
|
|
||||||
|
|
||||||
def start_convert_data(args: Dict[str, Any], ohlcv: bool = True) -> None:
|
def start_convert_data(args: Dict[str, Any], ohlcv: bool = True) -> None:
|
||||||
|
Loading…
Reference in New Issue
Block a user