Humanize show-trades error when no database is specified
This commit is contained in:
parent
1b448f57b9
commit
ffef4bc474
@ -206,6 +206,11 @@ def start_show_trades(args: Dict[str, Any]) -> None:
|
|||||||
from freqtrade.persistence import init, Trade
|
from freqtrade.persistence import init, Trade
|
||||||
import json
|
import json
|
||||||
config = setup_utils_configuration(args, RunMode.UTIL_NO_EXCHANGE)
|
config = setup_utils_configuration(args, RunMode.UTIL_NO_EXCHANGE)
|
||||||
|
|
||||||
|
if 'db_url' not in config:
|
||||||
|
raise OperationalException("--db-url is required for this command.")
|
||||||
|
|
||||||
|
logger.info(f'Using DB: "{config["db_url"]}"')
|
||||||
init(config['db_url'], clean_open_orders=False)
|
init(config['db_url'], clean_open_orders=False)
|
||||||
tfilter = []
|
tfilter = []
|
||||||
|
|
||||||
|
@ -1077,3 +1077,11 @@ def test_show_trades(mocker, fee, capsys, caplog):
|
|||||||
assert '"trade_id": 1' in captured.out
|
assert '"trade_id": 1' in captured.out
|
||||||
assert '"trade_id": 2' in captured.out
|
assert '"trade_id": 2' in captured.out
|
||||||
assert '"trade_id": 3' not in captured.out
|
assert '"trade_id": 3' not in captured.out
|
||||||
|
args = [
|
||||||
|
"show-trades",
|
||||||
|
]
|
||||||
|
pargs = get_args(args)
|
||||||
|
pargs['config'] = None
|
||||||
|
|
||||||
|
with pytest.raises(OperationalException, match=r"--db-url is required for this command."):
|
||||||
|
start_show_trades(pargs)
|
||||||
|
Loading…
Reference in New Issue
Block a user