Allow limiting kraken pairs to --pairs selection
This commit is contained in:
@@ -38,6 +38,13 @@ def import_kraken_trades_from_csv(config: Config, convert_to: str):
|
|||||||
}
|
}
|
||||||
logger.info(f"Found csv files for {', '.join(data_symbols)}.")
|
logger.info(f"Found csv files for {', '.join(data_symbols)}.")
|
||||||
|
|
||||||
|
if pairs := config.get('pairs'):
|
||||||
|
markets = [m for m in markets if m[0] in pairs]
|
||||||
|
if not markets:
|
||||||
|
logger.info(f"No data found for pairs {', '.join(pairs)}.")
|
||||||
|
return
|
||||||
|
logger.info(f"Converting pairs: {', '.join(m[0] for m in markets)}.")
|
||||||
|
|
||||||
for pair, name in markets:
|
for pair, name in markets:
|
||||||
dfs = []
|
dfs = []
|
||||||
# Load and combine all csv files for this pair
|
# Load and combine all csv files for this pair
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ def test_import_kraken_trades_from_csv(testdatadir, tmp_path, caplog, default_co
|
|||||||
|
|
||||||
import_kraken_trades_from_csv(default_conf_usdt, 'feather')
|
import_kraken_trades_from_csv(default_conf_usdt, 'feather')
|
||||||
assert log_has("Found csv files for BCHEUR.", caplog)
|
assert log_has("Found csv files for BCHEUR.", caplog)
|
||||||
|
assert log_has("Converting pairs: BCH/EUR.", caplog)
|
||||||
assert log_has_re(r"BCH/EUR: 340 trades.* 2023-01-01.* 2023-01-02.*", caplog)
|
assert log_has_re(r"BCH/EUR: 340 trades.* 2023-01-01.* 2023-01-02.*", caplog)
|
||||||
|
|
||||||
assert dstfile.is_file()
|
assert dstfile.is_file()
|
||||||
@@ -48,3 +49,10 @@ def test_import_kraken_trades_from_csv(testdatadir, tmp_path, caplog, default_co
|
|||||||
tzinfo=timezone.utc)
|
tzinfo=timezone.utc)
|
||||||
# ID is not filled
|
# ID is not filled
|
||||||
assert len(trades.loc[trades['id'] != '']) == 0
|
assert len(trades.loc[trades['id'] != '']) == 0
|
||||||
|
|
||||||
|
caplog.clear()
|
||||||
|
default_conf_usdt['pairs'] = ['XRP/EUR']
|
||||||
|
# Filtered to non-existing pair
|
||||||
|
import_kraken_trades_from_csv(default_conf_usdt, 'feather')
|
||||||
|
assert log_has("Found csv files for BCHEUR.", caplog)
|
||||||
|
assert log_has("No data found for pairs XRP/EUR.", caplog)
|
||||||
|
|||||||
Reference in New Issue
Block a user