mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
feat: add start_list_trades_data command to output trades data
This commit is contained in:
parent
9bfd0cb63c
commit
5a9f87ac63
|
@ -15,6 +15,7 @@ from freqtrade.commands.data_commands import (
|
||||||
start_convert_trades,
|
start_convert_trades,
|
||||||
start_download_data,
|
start_download_data,
|
||||||
start_list_data,
|
start_list_data,
|
||||||
|
start_list_trades_data,
|
||||||
)
|
)
|
||||||
from freqtrade.commands.db_commands import start_convert_db
|
from freqtrade.commands.db_commands import start_convert_db
|
||||||
from freqtrade.commands.deploy_commands import (
|
from freqtrade.commands.deploy_commands import (
|
||||||
|
|
|
@ -118,6 +118,10 @@ def start_list_data(args: Dict[str, Any]) -> None:
|
||||||
List available OHLCV data
|
List available OHLCV data
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if args["download_trades"]:
|
||||||
|
start_list_trades_data(args)
|
||||||
|
return
|
||||||
|
|
||||||
config = setup_utils_configuration(args, RunMode.UTIL_NO_EXCHANGE)
|
config = setup_utils_configuration(args, RunMode.UTIL_NO_EXCHANGE)
|
||||||
|
|
||||||
from freqtrade.data.history import get_datahandler
|
from freqtrade.data.history import get_datahandler
|
||||||
|
@ -127,7 +131,6 @@ def start_list_data(args: Dict[str, Any]) -> None:
|
||||||
paircombs = dhc.ohlcv_get_available_data(
|
paircombs = dhc.ohlcv_get_available_data(
|
||||||
config["datadir"], config.get("trading_mode", TradingMode.SPOT)
|
config["datadir"], config.get("trading_mode", TradingMode.SPOT)
|
||||||
)
|
)
|
||||||
|
|
||||||
if args["pairs"]:
|
if args["pairs"]:
|
||||||
paircombs = [comb for comb in paircombs if comb[0] in args["pairs"]]
|
paircombs = [comb for comb in paircombs if comb[0] in args["pairs"]]
|
||||||
title = f"Found {len(paircombs)} pair / timeframe combinations."
|
title = f"Found {len(paircombs)} pair / timeframe combinations."
|
||||||
|
@ -171,3 +174,51 @@ def start_list_data(args: Dict[str, Any]) -> None:
|
||||||
summary=title,
|
summary=title,
|
||||||
table_kwargs={"min_width": 50},
|
table_kwargs={"min_width": 50},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def start_list_trades_data(args: Dict[str, Any]) -> None:
|
||||||
|
"""
|
||||||
|
List available Trades data
|
||||||
|
"""
|
||||||
|
|
||||||
|
config = setup_utils_configuration(args, RunMode.UTIL_NO_EXCHANGE)
|
||||||
|
|
||||||
|
from freqtrade.data.history import get_datahandler
|
||||||
|
|
||||||
|
dhc = get_datahandler(config["datadir"], config["dataformat_trades"])
|
||||||
|
|
||||||
|
paircombs = dhc.trades_get_available_data(
|
||||||
|
config["datadir"], config.get("trading_mode", TradingMode.SPOT)
|
||||||
|
)
|
||||||
|
|
||||||
|
if args["pairs"]:
|
||||||
|
paircombs = [comb for comb in paircombs if comb in args["pairs"]]
|
||||||
|
|
||||||
|
title = f"Found trades data for {len(paircombs)} pairs."
|
||||||
|
if not config.get("show_timerange"):
|
||||||
|
print_rich_table(
|
||||||
|
[(pair, config.get("candle_type_def", CandleType.SPOT)) for pair in sorted(paircombs)],
|
||||||
|
("Pair", "Type"),
|
||||||
|
title,
|
||||||
|
table_kwargs={"min_width": 50},
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
paircombs1 = [
|
||||||
|
(pair, *dhc.trades_data_min_max(pair, config.get("trading_mode", TradingMode.SPOT)))
|
||||||
|
for pair in paircombs
|
||||||
|
]
|
||||||
|
print_rich_table(
|
||||||
|
[
|
||||||
|
(
|
||||||
|
pair,
|
||||||
|
config.get("candle_type_def", CandleType.SPOT),
|
||||||
|
start.strftime(DATETIME_PRINT_FORMAT),
|
||||||
|
end.strftime(DATETIME_PRINT_FORMAT),
|
||||||
|
str(length),
|
||||||
|
)
|
||||||
|
for pair, start, end, length in sorted(paircombs1, key=lambda x: (x[0]))
|
||||||
|
],
|
||||||
|
("Pair", "Type", "From", "To", "Trades"),
|
||||||
|
summary=title,
|
||||||
|
table_kwargs={"min_width": 50},
|
||||||
|
)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user