Merge pull request #3390 from freqtrade/rpc/profit

improve /profit to not raise an exception if no trade is closed
This commit is contained in:
hroff-1902
2020-05-30 22:06:22 +03:00
committed by GitHub
6 changed files with 66 additions and 53 deletions

View File

@@ -290,8 +290,12 @@ def test_rpc_trade_statistics(default_conf, ticker, ticker_sell_up, fee,
rpc = RPC(freqtradebot)
rpc._fiat_converter = CryptoToFiatConverter()
with pytest.raises(RPCException, match=r'.*no closed trade*'):
rpc._rpc_trade_statistics(stake_currency, fiat_display_currency)
res = rpc._rpc_trade_statistics(stake_currency, fiat_display_currency)
assert res['trade_count'] == 0
assert res['first_trade_date'] == ''
assert res['first_trade_timestamp'] == 0
assert res['latest_trade_date'] == ''
assert res['latest_trade_timestamp'] == 0
# Create some test data
freqtradebot.enter_positions()