Update failing test
This commit is contained in:
parent
7bd55aa2f1
commit
6a88eb603b
@ -42,8 +42,12 @@ def test_rpc_trade_status(default_conf, ticker, fee, mocker) -> None:
|
|||||||
rpc._rpc_trade_status()
|
rpc._rpc_trade_status()
|
||||||
|
|
||||||
freqtradebot.enter_positions()
|
freqtradebot.enter_positions()
|
||||||
|
trades = Trade.get_open_trades()
|
||||||
|
trades[0].open_order_id = None
|
||||||
|
freqtradebot.exit_positions(trades)
|
||||||
|
|
||||||
results = rpc._rpc_trade_status()
|
results = rpc._rpc_trade_status()
|
||||||
assert {
|
assert results[0] == {
|
||||||
'trade_id': 1,
|
'trade_id': 1,
|
||||||
'pair': 'ETH/BTC',
|
'pair': 'ETH/BTC',
|
||||||
'base_currency': 'BTC',
|
'base_currency': 'BTC',
|
||||||
@ -54,11 +58,11 @@ def test_rpc_trade_status(default_conf, ticker, fee, mocker) -> None:
|
|||||||
'fee_open': ANY,
|
'fee_open': ANY,
|
||||||
'fee_open_cost': ANY,
|
'fee_open_cost': ANY,
|
||||||
'fee_open_currency': ANY,
|
'fee_open_currency': ANY,
|
||||||
'fee_close': ANY,
|
'fee_close': fee.return_value,
|
||||||
'fee_close_cost': ANY,
|
'fee_close_cost': ANY,
|
||||||
'fee_close_currency': ANY,
|
'fee_close_currency': ANY,
|
||||||
'open_rate_requested': ANY,
|
'open_rate_requested': ANY,
|
||||||
'open_trade_price': ANY,
|
'open_trade_price': 0.0010025,
|
||||||
'close_rate_requested': ANY,
|
'close_rate_requested': ANY,
|
||||||
'sell_reason': ANY,
|
'sell_reason': ANY,
|
||||||
'sell_order_status': ANY,
|
'sell_order_status': ANY,
|
||||||
@ -80,28 +84,32 @@ def test_rpc_trade_status(default_conf, ticker, fee, mocker) -> None:
|
|||||||
'close_profit_abs': None,
|
'close_profit_abs': None,
|
||||||
'current_profit': -0.00408133,
|
'current_profit': -0.00408133,
|
||||||
'current_profit_pct': -0.41,
|
'current_profit_pct': -0.41,
|
||||||
'stop_loss': 0.0,
|
'current_profit_abs': -4.09e-06,
|
||||||
'stop_loss_abs': 0.0,
|
'stop_loss': 9.882e-06,
|
||||||
'stop_loss_pct': None,
|
'stop_loss_abs': 9.882e-06,
|
||||||
'stop_loss_ratio': None,
|
'stop_loss_pct': -10.0,
|
||||||
|
'stop_loss_ratio': -0.1,
|
||||||
'stoploss_order_id': None,
|
'stoploss_order_id': None,
|
||||||
'stoploss_last_update': None,
|
'stoploss_last_update': ANY,
|
||||||
'stoploss_last_update_timestamp': None,
|
'stoploss_last_update_timestamp': ANY,
|
||||||
'initial_stop_loss': 0.0,
|
'initial_stop_loss': 9.882e-06,
|
||||||
'initial_stop_loss_abs': 0.0,
|
'initial_stop_loss_abs': 9.882e-06,
|
||||||
'initial_stop_loss_pct': None,
|
'initial_stop_loss_pct': -10.0,
|
||||||
'initial_stop_loss_ratio': None,
|
'initial_stop_loss_ratio': -0.1,
|
||||||
'open_order': '(limit buy rem=0.00000000)',
|
'stoploss_current_dist': -1.1080000000000002e-06,
|
||||||
|
'stoploss_current_dist_ratio': -0.10081893,
|
||||||
|
'stoploss_entry_dist': -0.00010475,
|
||||||
|
'stoploss_entry_dist_ratio': -0.10448878,
|
||||||
|
'open_order': None,
|
||||||
'exchange': 'bittrex',
|
'exchange': 'bittrex',
|
||||||
|
}
|
||||||
} == results[0]
|
|
||||||
|
|
||||||
mocker.patch('freqtrade.freqtradebot.FreqtradeBot.get_sell_rate',
|
mocker.patch('freqtrade.freqtradebot.FreqtradeBot.get_sell_rate',
|
||||||
MagicMock(side_effect=DependencyException("Pair 'ETH/BTC' not available")))
|
MagicMock(side_effect=DependencyException("Pair 'ETH/BTC' not available")))
|
||||||
results = rpc._rpc_trade_status()
|
results = rpc._rpc_trade_status()
|
||||||
assert isnan(results[0]['current_profit'])
|
assert isnan(results[0]['current_profit'])
|
||||||
assert isnan(results[0]['current_rate'])
|
assert isnan(results[0]['current_rate'])
|
||||||
assert {
|
assert results[0] == {
|
||||||
'trade_id': 1,
|
'trade_id': 1,
|
||||||
'pair': 'ETH/BTC',
|
'pair': 'ETH/BTC',
|
||||||
'base_currency': 'BTC',
|
'base_currency': 'BTC',
|
||||||
@ -112,7 +120,7 @@ def test_rpc_trade_status(default_conf, ticker, fee, mocker) -> None:
|
|||||||
'fee_open': ANY,
|
'fee_open': ANY,
|
||||||
'fee_open_cost': ANY,
|
'fee_open_cost': ANY,
|
||||||
'fee_open_currency': ANY,
|
'fee_open_currency': ANY,
|
||||||
'fee_close': ANY,
|
'fee_close': fee.return_value,
|
||||||
'fee_close_cost': ANY,
|
'fee_close_cost': ANY,
|
||||||
'fee_close_currency': ANY,
|
'fee_close_currency': ANY,
|
||||||
'open_rate_requested': ANY,
|
'open_rate_requested': ANY,
|
||||||
@ -138,20 +146,25 @@ def test_rpc_trade_status(default_conf, ticker, fee, mocker) -> None:
|
|||||||
'close_profit_abs': None,
|
'close_profit_abs': None,
|
||||||
'current_profit': ANY,
|
'current_profit': ANY,
|
||||||
'current_profit_pct': ANY,
|
'current_profit_pct': ANY,
|
||||||
'stop_loss': 0.0,
|
'current_profit_abs': ANY,
|
||||||
'stop_loss_abs': 0.0,
|
'stop_loss': 9.882e-06,
|
||||||
'stop_loss_pct': None,
|
'stop_loss_abs': 9.882e-06,
|
||||||
'stop_loss_ratio': None,
|
'stop_loss_pct': -10.0,
|
||||||
|
'stop_loss_ratio': -0.1,
|
||||||
'stoploss_order_id': None,
|
'stoploss_order_id': None,
|
||||||
'stoploss_last_update': None,
|
'stoploss_last_update': ANY,
|
||||||
'stoploss_last_update_timestamp': None,
|
'stoploss_last_update_timestamp': ANY,
|
||||||
'initial_stop_loss': 0.0,
|
'initial_stop_loss': 9.882e-06,
|
||||||
'initial_stop_loss_abs': 0.0,
|
'initial_stop_loss_abs': 9.882e-06,
|
||||||
'initial_stop_loss_pct': None,
|
'initial_stop_loss_pct': -10.0,
|
||||||
'initial_stop_loss_ratio': None,
|
'initial_stop_loss_ratio': -0.1,
|
||||||
'open_order': '(limit buy rem=0.00000000)',
|
'stoploss_current_dist': ANY,
|
||||||
|
'stoploss_current_dist_ratio': ANY,
|
||||||
|
'stoploss_entry_dist': -0.00010475,
|
||||||
|
'stoploss_entry_dist_ratio': -0.10448878,
|
||||||
|
'open_order': None,
|
||||||
'exchange': 'bittrex',
|
'exchange': 'bittrex',
|
||||||
} == results[0]
|
}
|
||||||
|
|
||||||
|
|
||||||
def test_rpc_status_table(default_conf, ticker, fee, mocker) -> None:
|
def test_rpc_status_table(default_conf, ticker, fee, mocker) -> None:
|
||||||
|
Loading…
Reference in New Issue
Block a user