use binance intests instead of bittrex

This commit is contained in:
Matthias
2021-04-20 12:54:22 +02:00
parent bd7e535e42
commit 2254f65fa7
13 changed files with 117 additions and 96 deletions

View File

@@ -106,7 +106,7 @@ def test_rpc_trade_status(default_conf, ticker, fee, mocker) -> None:
'stoploss_entry_dist': -0.00010475,
'stoploss_entry_dist_ratio': -0.10448878,
'open_order': None,
'exchange': 'bittrex',
'exchange': 'binance',
}
mocker.patch('freqtrade.freqtradebot.FreqtradeBot.get_sell_rate',
@@ -172,7 +172,7 @@ def test_rpc_trade_status(default_conf, ticker, fee, mocker) -> None:
'stoploss_entry_dist': -0.00010475,
'stoploss_entry_dist_ratio': -0.10448878,
'open_order': None,
'exchange': 'bittrex',
'exchange': 'binance',
}

View File

@@ -468,7 +468,7 @@ def test_api_show_config(botclient, mocker):
rc = client_get(client, f"{BASE_URI}/show_config")
assert_response(rc)
assert 'dry_run' in rc.json()
assert rc.json()['exchange'] == 'bittrex'
assert rc.json()['exchange'] == 'binance'
assert rc.json()['timeframe'] == '5m'
assert rc.json()['timeframe_ms'] == 300000
assert rc.json()['timeframe_min'] == 5
@@ -825,7 +825,7 @@ def test_api_status(botclient, mocker, ticker, fee, markets):
'sell_order_status': None,
'strategy': 'DefaultStrategy',
'timeframe': 5,
'exchange': 'bittrex',
'exchange': 'binance',
}
mocker.patch('freqtrade.freqtradebot.FreqtradeBot.get_sell_rate',
@@ -916,7 +916,7 @@ def test_api_forcebuy(botclient, mocker, fee):
pair='ETH/ETH',
amount=1,
amount_requested=1,
exchange='bittrex',
exchange='binance',
stake_amount=1,
open_rate=0.245441,
open_order_id="123456",
@@ -979,7 +979,7 @@ def test_api_forcebuy(botclient, mocker, fee):
'sell_order_status': None,
'strategy': 'DefaultStrategy',
'timeframe': 5,
'exchange': 'bittrex',
'exchange': 'binance',
}

View File

@@ -140,7 +140,7 @@ def test_startupmessages_telegram_enabled(mocker, default_conf, caplog) -> None:
rpc_manager.startup_messages(default_conf, freqtradebot.pairlists, freqtradebot.protections)
assert telegram_mock.call_count == 3
assert "*Exchange:* `bittrex`" in telegram_mock.call_args_list[1][0][0]['status']
assert "*Exchange:* `binance`" in telegram_mock.call_args_list[1][0][0]['status']
telegram_mock.reset_mock()
default_conf['dry_run'] = True

View File

@@ -688,7 +688,7 @@ def test_telegram_forcesell_handle(default_conf, update, ticker, fee,
assert {
'type': RPCMessageType.SELL_NOTIFICATION,
'trade_id': 1,
'exchange': 'Bittrex',
'exchange': 'Binance',
'pair': 'ETH/BTC',
'gain': 'profit',
'limit': 1.173e-05,
@@ -749,7 +749,7 @@ def test_telegram_forcesell_down_handle(default_conf, update, ticker, fee,
assert {
'type': RPCMessageType.SELL_NOTIFICATION,
'trade_id': 1,
'exchange': 'Bittrex',
'exchange': 'Binance',
'pair': 'ETH/BTC',
'gain': 'loss',
'limit': 1.043e-05,
@@ -800,7 +800,7 @@ def test_forcesell_all_handle(default_conf, update, ticker, fee, mocker) -> None
assert {
'type': RPCMessageType.SELL_NOTIFICATION,
'trade_id': 1,
'exchange': 'Bittrex',
'exchange': 'Binance',
'pair': 'ETH/BTC',
'gain': 'loss',
'limit': 1.099e-05,
@@ -1178,7 +1178,7 @@ def test_show_config_handle(default_conf, update, mocker) -> None:
telegram._show_config(update=update, context=MagicMock())
assert msg_mock.call_count == 1
assert '*Mode:* `{}`'.format('Dry-run') in msg_mock.call_args_list[0][0][0]
assert '*Exchange:* `bittrex`' in msg_mock.call_args_list[0][0][0]
assert '*Exchange:* `binance`' in msg_mock.call_args_list[0][0][0]
assert '*Strategy:* `DefaultStrategy`' in msg_mock.call_args_list[0][0][0]
assert '*Stoploss:* `-0.1`' in msg_mock.call_args_list[0][0][0]
@@ -1187,7 +1187,7 @@ def test_show_config_handle(default_conf, update, mocker) -> None:
telegram._show_config(update=update, context=MagicMock())
assert msg_mock.call_count == 1
assert '*Mode:* `{}`'.format('Dry-run') in msg_mock.call_args_list[0][0][0]
assert '*Exchange:* `bittrex`' in msg_mock.call_args_list[0][0][0]
assert '*Exchange:* `binance`' in msg_mock.call_args_list[0][0][0]
assert '*Strategy:* `DefaultStrategy`' in msg_mock.call_args_list[0][0][0]
assert '*Initial Stoploss:* `-0.1`' in msg_mock.call_args_list[0][0][0]
@@ -1197,7 +1197,7 @@ def test_send_msg_buy_notification(default_conf, mocker, caplog) -> None:
msg = {
'type': RPCMessageType.BUY_NOTIFICATION,
'trade_id': 1,
'exchange': 'Bittrex',
'exchange': 'Binance',
'pair': 'ETH/BTC',
'limit': 1.099e-05,
'order_type': 'limit',
@@ -1213,7 +1213,7 @@ def test_send_msg_buy_notification(default_conf, mocker, caplog) -> None:
telegram.send_msg(msg)
assert msg_mock.call_args[0][0] \
== '\N{LARGE BLUE CIRCLE} *Bittrex:* Buying ETH/BTC (#1)\n' \
== '\N{LARGE BLUE CIRCLE} *Binance:* Buying ETH/BTC (#1)\n' \
'*Amount:* `1333.33333333`\n' \
'*Open Rate:* `0.00001099`\n' \
'*Current Rate:* `0.00001099`\n' \
@@ -1242,11 +1242,11 @@ def test_send_msg_buy_cancel_notification(default_conf, mocker) -> None:
telegram.send_msg({
'type': RPCMessageType.BUY_CANCEL_NOTIFICATION,
'trade_id': 1,
'exchange': 'Bittrex',
'exchange': 'Binance',
'pair': 'ETH/BTC',
'reason': CANCEL_REASON['TIMEOUT']
})
assert (msg_mock.call_args[0][0] == '\N{WARNING SIGN} *Bittrex:* '
assert (msg_mock.call_args[0][0] == '\N{WARNING SIGN} *Binance:* '
'Cancelling open buy Order for ETH/BTC (#1). '
'Reason: cancelled due to timeout.')
@@ -1393,7 +1393,7 @@ def test_send_msg_buy_notification_no_fiat(default_conf, mocker) -> None:
telegram.send_msg({
'type': RPCMessageType.BUY_NOTIFICATION,
'trade_id': 1,
'exchange': 'Bittrex',
'exchange': 'Binance',
'pair': 'ETH/BTC',
'limit': 1.099e-05,
'order_type': 'limit',
@@ -1405,7 +1405,7 @@ def test_send_msg_buy_notification_no_fiat(default_conf, mocker) -> None:
'amount': 1333.3333333333335,
'open_date': arrow.utcnow().shift(hours=-1)
})
assert msg_mock.call_args[0][0] == ('\N{LARGE BLUE CIRCLE} *Bittrex:* Buying ETH/BTC (#1)\n'
assert msg_mock.call_args[0][0] == ('\N{LARGE BLUE CIRCLE} *Binance:* Buying ETH/BTC (#1)\n'
'*Amount:* `1333.33333333`\n'
'*Open Rate:* `0.00001099`\n'
'*Current Rate:* `0.00001099`\n'

View File

@@ -59,7 +59,7 @@ def test_send_msg(default_conf, mocker):
mocker.patch("freqtrade.rpc.webhook.Webhook._send_msg", msg_mock)
msg = {
'type': RPCMessageType.BUY_NOTIFICATION,
'exchange': 'Bittrex',
'exchange': 'Binance',
'pair': 'ETH/BTC',
'limit': 0.005,
'stake_amount': 0.8,
@@ -80,7 +80,7 @@ def test_send_msg(default_conf, mocker):
mocker.patch("freqtrade.rpc.webhook.Webhook._send_msg", msg_mock)
msg = {
'type': RPCMessageType.BUY_CANCEL_NOTIFICATION,
'exchange': 'Bittrex',
'exchange': 'Binance',
'pair': 'ETH/BTC',
'limit': 0.005,
'stake_amount': 0.8,
@@ -101,7 +101,7 @@ def test_send_msg(default_conf, mocker):
mocker.patch("freqtrade.rpc.webhook.Webhook._send_msg", msg_mock)
msg = {
'type': RPCMessageType.SELL_NOTIFICATION,
'exchange': 'Bittrex',
'exchange': 'Binance',
'pair': 'ETH/BTC',
'gain': "profit",
'limit': 0.005,
@@ -127,7 +127,7 @@ def test_send_msg(default_conf, mocker):
mocker.patch("freqtrade.rpc.webhook.Webhook._send_msg", msg_mock)
msg = {
'type': RPCMessageType.SELL_CANCEL_NOTIFICATION,
'exchange': 'Bittrex',
'exchange': 'Binance',
'pair': 'ETH/BTC',
'gain': "profit",
'limit': 0.005,
@@ -184,7 +184,7 @@ def test_exception_send_msg(default_conf, mocker, caplog):
webhook = Webhook(RPC(get_patched_freqtradebot(mocker, default_conf)), default_conf)
msg = {
'type': RPCMessageType.BUY_NOTIFICATION,
'exchange': 'Bittrex',
'exchange': 'Binance',
'pair': 'ETH/BTC',
'limit': 0.005,
'order_type': 'limit',