remove markdown formatting from exception string
This commit is contained in:
parent
df8ba28ce5
commit
29670b9814
@ -72,9 +72,9 @@ class RPC(object):
|
|||||||
# Fetch open trade
|
# Fetch open trade
|
||||||
trades = Trade.query.filter(Trade.is_open.is_(True)).all()
|
trades = Trade.query.filter(Trade.is_open.is_(True)).all()
|
||||||
if self._freqtrade.state != State.RUNNING:
|
if self._freqtrade.state != State.RUNNING:
|
||||||
raise RPCException('*Status:* `trader is not running`')
|
raise RPCException('trader is not running')
|
||||||
elif not trades:
|
elif not trades:
|
||||||
raise RPCException('*Status:* `no active trade`')
|
raise RPCException('no active trade')
|
||||||
else:
|
else:
|
||||||
result = []
|
result = []
|
||||||
for trade in trades:
|
for trade in trades:
|
||||||
@ -116,9 +116,9 @@ class RPC(object):
|
|||||||
def _rpc_status_table(self) -> DataFrame:
|
def _rpc_status_table(self) -> DataFrame:
|
||||||
trades = Trade.query.filter(Trade.is_open.is_(True)).all()
|
trades = Trade.query.filter(Trade.is_open.is_(True)).all()
|
||||||
if self._freqtrade.state != State.RUNNING:
|
if self._freqtrade.state != State.RUNNING:
|
||||||
raise RPCException('*Status:* `trader is not running`')
|
raise RPCException('trader is not running')
|
||||||
elif not trades:
|
elif not trades:
|
||||||
raise RPCException('*Status:* `no active order`')
|
raise RPCException('no active order')
|
||||||
else:
|
else:
|
||||||
trades_list = []
|
trades_list = []
|
||||||
for trade in trades:
|
for trade in trades:
|
||||||
@ -144,7 +144,7 @@ class RPC(object):
|
|||||||
profit_days: Dict[date, Dict] = {}
|
profit_days: Dict[date, Dict] = {}
|
||||||
|
|
||||||
if not (isinstance(timescale, int) and timescale > 0):
|
if not (isinstance(timescale, int) and timescale > 0):
|
||||||
raise RPCException('*Daily [n]:* `must be an integer greater than 0`')
|
raise RPCException('timescale must be an integer greater than 0')
|
||||||
|
|
||||||
fiat = self._freqtrade.fiat_converter
|
fiat = self._freqtrade.fiat_converter
|
||||||
for day in range(0, timescale):
|
for day in range(0, timescale):
|
||||||
@ -224,7 +224,7 @@ class RPC(object):
|
|||||||
.order_by(sql.text('profit_sum DESC')).first()
|
.order_by(sql.text('profit_sum DESC')).first()
|
||||||
|
|
||||||
if not best_pair:
|
if not best_pair:
|
||||||
raise RPCException('*Status:* `no closed trade`')
|
raise RPCException('no closed trade')
|
||||||
|
|
||||||
bp_pair, bp_rate = best_pair
|
bp_pair, bp_rate = best_pair
|
||||||
|
|
||||||
@ -289,7 +289,7 @@ class RPC(object):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
if total == 0.0:
|
if total == 0.0:
|
||||||
raise RPCException('`All balances are zero.`')
|
raise RPCException('all balances are zero')
|
||||||
|
|
||||||
fiat = self._freqtrade.fiat_converter
|
fiat = self._freqtrade.fiat_converter
|
||||||
symbol = fiat_display_currency
|
symbol = fiat_display_currency
|
||||||
@ -350,7 +350,7 @@ class RPC(object):
|
|||||||
# ---- EOF def _exec_forcesell ----
|
# ---- EOF def _exec_forcesell ----
|
||||||
|
|
||||||
if self._freqtrade.state != State.RUNNING:
|
if self._freqtrade.state != State.RUNNING:
|
||||||
raise RPCException('`trader is not running`')
|
raise RPCException('trader is not running')
|
||||||
|
|
||||||
if trade_id == 'all':
|
if trade_id == 'all':
|
||||||
# Execute sell for all open orders
|
# Execute sell for all open orders
|
||||||
@ -367,7 +367,7 @@ class RPC(object):
|
|||||||
).first()
|
).first()
|
||||||
if not trade:
|
if not trade:
|
||||||
logger.warning('forcesell: Invalid argument received')
|
logger.warning('forcesell: Invalid argument received')
|
||||||
raise RPCException('Invalid argument.')
|
raise RPCException('invalid argument')
|
||||||
|
|
||||||
_exec_forcesell(trade)
|
_exec_forcesell(trade)
|
||||||
Trade.session.flush()
|
Trade.session.flush()
|
||||||
@ -378,7 +378,7 @@ class RPC(object):
|
|||||||
Shows a performance statistic from finished trades
|
Shows a performance statistic from finished trades
|
||||||
"""
|
"""
|
||||||
if self._freqtrade.state != State.RUNNING:
|
if self._freqtrade.state != State.RUNNING:
|
||||||
raise RPCException('`trader is not running`')
|
raise RPCException('trader is not running')
|
||||||
|
|
||||||
pair_rates = Trade.session.query(Trade.pair,
|
pair_rates = Trade.session.query(Trade.pair,
|
||||||
sql.func.sum(Trade.close_profit).label('profit_sum'),
|
sql.func.sum(Trade.close_profit).label('profit_sum'),
|
||||||
@ -395,6 +395,6 @@ class RPC(object):
|
|||||||
def _rpc_count(self) -> List[Trade]:
|
def _rpc_count(self) -> List[Trade]:
|
||||||
""" Returns the number of trades running """
|
""" Returns the number of trades running """
|
||||||
if self._freqtrade.state != State.RUNNING:
|
if self._freqtrade.state != State.RUNNING:
|
||||||
raise RPCException('`trader is not running`')
|
raise RPCException('trader is not running')
|
||||||
|
|
||||||
return Trade.query.filter(Trade.is_open.is_(True)).all()
|
return Trade.query.filter(Trade.is_open.is_(True)).all()
|
||||||
|
@ -92,11 +92,11 @@ def test_rpc_status_table(default_conf, ticker, fee, markets, mocker) -> None:
|
|||||||
rpc = RPC(freqtradebot)
|
rpc = RPC(freqtradebot)
|
||||||
|
|
||||||
freqtradebot.state = State.STOPPED
|
freqtradebot.state = State.STOPPED
|
||||||
with pytest.raises(RPCException, match=r'.*\*Status:\* `trader is not running``*'):
|
with pytest.raises(RPCException, match=r'.*trader is not running*'):
|
||||||
rpc._rpc_status_table()
|
rpc._rpc_status_table()
|
||||||
|
|
||||||
freqtradebot.state = State.RUNNING
|
freqtradebot.state = State.RUNNING
|
||||||
with pytest.raises(RPCException, match=r'.*\*Status:\* `no active order`*'):
|
with pytest.raises(RPCException, match=r'.*no active order*'):
|
||||||
rpc._rpc_status_table()
|
rpc._rpc_status_table()
|
||||||
|
|
||||||
freqtradebot.create_trade()
|
freqtradebot.create_trade()
|
||||||
@ -422,11 +422,11 @@ def test_rpc_forcesell(default_conf, ticker, fee, mocker, markets) -> None:
|
|||||||
rpc = RPC(freqtradebot)
|
rpc = RPC(freqtradebot)
|
||||||
|
|
||||||
freqtradebot.state = State.STOPPED
|
freqtradebot.state = State.STOPPED
|
||||||
with pytest.raises(RPCException, match=r'.*`trader is not running`*'):
|
with pytest.raises(RPCException, match=r'.*trader is not running*'):
|
||||||
rpc._rpc_forcesell(None)
|
rpc._rpc_forcesell(None)
|
||||||
|
|
||||||
freqtradebot.state = State.RUNNING
|
freqtradebot.state = State.RUNNING
|
||||||
with pytest.raises(RPCException, match=r'.*Invalid argument.*'):
|
with pytest.raises(RPCException, match=r'.*invalid argument*'):
|
||||||
rpc._rpc_forcesell(None)
|
rpc._rpc_forcesell(None)
|
||||||
|
|
||||||
rpc._rpc_forcesell('all')
|
rpc._rpc_forcesell('all')
|
||||||
@ -437,10 +437,10 @@ def test_rpc_forcesell(default_conf, ticker, fee, mocker, markets) -> None:
|
|||||||
rpc._rpc_forcesell('1')
|
rpc._rpc_forcesell('1')
|
||||||
|
|
||||||
freqtradebot.state = State.STOPPED
|
freqtradebot.state = State.STOPPED
|
||||||
with pytest.raises(RPCException, match=r'.*`trader is not running`*'):
|
with pytest.raises(RPCException, match=r'.*trader is not running*'):
|
||||||
rpc._rpc_forcesell(None)
|
rpc._rpc_forcesell(None)
|
||||||
|
|
||||||
with pytest.raises(RPCException, match=r'.*`trader is not running`*'):
|
with pytest.raises(RPCException, match=r'.*trader is not running*'):
|
||||||
rpc._rpc_forcesell('all')
|
rpc._rpc_forcesell('all')
|
||||||
|
|
||||||
freqtradebot.state = State.RUNNING
|
freqtradebot.state = State.RUNNING
|
||||||
|
@ -598,7 +598,7 @@ def test_zero_balance_handle(default_conf, update, mocker) -> None:
|
|||||||
telegram._balance(bot=MagicMock(), update=update)
|
telegram._balance(bot=MagicMock(), update=update)
|
||||||
result = msg_mock.call_args_list[0][0][0]
|
result = msg_mock.call_args_list[0][0][0]
|
||||||
assert msg_mock.call_count == 1
|
assert msg_mock.call_count == 1
|
||||||
assert '`All balances are zero.`' in result
|
assert 'all balances are zero' in result
|
||||||
|
|
||||||
|
|
||||||
def test_start_handle(default_conf, update, mocker) -> None:
|
def test_start_handle(default_conf, update, mocker) -> None:
|
||||||
@ -866,7 +866,7 @@ def test_forcesell_handle_invalid(default_conf, update, mocker) -> None:
|
|||||||
update.message.text = '/forcesell'
|
update.message.text = '/forcesell'
|
||||||
telegram._forcesell(bot=MagicMock(), update=update)
|
telegram._forcesell(bot=MagicMock(), update=update)
|
||||||
assert msg_mock.call_count == 1
|
assert msg_mock.call_count == 1
|
||||||
assert 'Invalid argument' in msg_mock.call_args_list[0][0][0]
|
assert 'invalid argument' in msg_mock.call_args_list[0][0][0]
|
||||||
|
|
||||||
# Invalid argument
|
# Invalid argument
|
||||||
msg_mock.reset_mock()
|
msg_mock.reset_mock()
|
||||||
@ -874,7 +874,7 @@ def test_forcesell_handle_invalid(default_conf, update, mocker) -> None:
|
|||||||
update.message.text = '/forcesell 123456'
|
update.message.text = '/forcesell 123456'
|
||||||
telegram._forcesell(bot=MagicMock(), update=update)
|
telegram._forcesell(bot=MagicMock(), update=update)
|
||||||
assert msg_mock.call_count == 1
|
assert msg_mock.call_count == 1
|
||||||
assert 'Invalid argument.' in msg_mock.call_args_list[0][0][0]
|
assert 'invalid argument' in msg_mock.call_args_list[0][0][0]
|
||||||
|
|
||||||
|
|
||||||
def test_performance_handle(default_conf, update, ticker, fee,
|
def test_performance_handle(default_conf, update, ticker, fee,
|
||||||
|
Loading…
Reference in New Issue
Block a user