merged with feat/short
This commit is contained in:
commit
6486b904b5
@ -718,7 +718,7 @@ class FreqtradeBot(LoggingMixin):
|
|||||||
analyzed_df, is_short=trade.is_short
|
analyzed_df, is_short=trade.is_short
|
||||||
)
|
)
|
||||||
|
|
||||||
# TODO-lev: side should depend on trade side.
|
logger.debug('checking sell')
|
||||||
exit_rate = self.exchange.get_rate(trade.pair, refresh=True, side="sell")
|
exit_rate = self.exchange.get_rate(trade.pair, refresh=True, side="sell")
|
||||||
if self._check_and_execute_exit(trade, exit_rate, enter, exit_):
|
if self._check_and_execute_exit(trade, exit_rate, enter, exit_):
|
||||||
return True
|
return True
|
||||||
@ -1010,8 +1010,6 @@ class FreqtradeBot(LoggingMixin):
|
|||||||
reason += f", {constants.CANCEL_REASON['PARTIALLY_FILLED']}"
|
reason += f", {constants.CANCEL_REASON['PARTIALLY_FILLED']}"
|
||||||
|
|
||||||
self.wallets.update()
|
self.wallets.update()
|
||||||
# TODO-lev: Should short and exit_short be an order type?
|
|
||||||
|
|
||||||
self._notify_enter_cancel(trade, order_type=self.strategy.order_types['buy'],
|
self._notify_enter_cancel(trade, order_type=self.strategy.order_types['buy'],
|
||||||
reason=reason)
|
reason=reason)
|
||||||
return was_trade_fully_canceled
|
return was_trade_fully_canceled
|
||||||
|
@ -20,14 +20,14 @@ nav:
|
|||||||
- Web Hook: webhook-config.md
|
- Web Hook: webhook-config.md
|
||||||
- Data Downloading: data-download.md
|
- Data Downloading: data-download.md
|
||||||
- Backtesting: backtesting.md
|
- Backtesting: backtesting.md
|
||||||
- Leverage: leverage.md
|
|
||||||
- Hyperopt: hyperopt.md
|
- Hyperopt: hyperopt.md
|
||||||
|
- Leverage: leverage.md
|
||||||
- Utility Sub-commands: utils.md
|
- Utility Sub-commands: utils.md
|
||||||
- Plotting: plotting.md
|
- Plotting: plotting.md
|
||||||
|
- Exchange-specific Notes: exchanges.md
|
||||||
- Data Analysis:
|
- Data Analysis:
|
||||||
- Jupyter Notebooks: data-analysis.md
|
- Jupyter Notebooks: data-analysis.md
|
||||||
- Strategy analysis: strategy_analysis_example.md
|
- Strategy analysis: strategy_analysis_example.md
|
||||||
- Exchange-specific Notes: exchanges.md
|
|
||||||
- Advanced Topics:
|
- Advanced Topics:
|
||||||
- Advanced Post-installation Tasks: advanced-setup.md
|
- Advanced Post-installation Tasks: advanced-setup.md
|
||||||
- Edge Positioning: edge.md
|
- Edge Positioning: edge.md
|
||||||
|
@ -107,7 +107,6 @@ def test_order_dict_dry_run(default_conf, mocker, caplog) -> None:
|
|||||||
freqtrade = FreqtradeBot(conf)
|
freqtrade = FreqtradeBot(conf)
|
||||||
assert not freqtrade.strategy.order_types['stoploss_on_exchange']
|
assert not freqtrade.strategy.order_types['stoploss_on_exchange']
|
||||||
assert not log_has_re(".*stoploss_on_exchange .* dry-run", caplog)
|
assert not log_has_re(".*stoploss_on_exchange .* dry-run", caplog)
|
||||||
caplog.clear()
|
|
||||||
|
|
||||||
|
|
||||||
def test_order_dict_live(default_conf, mocker, caplog) -> None:
|
def test_order_dict_live(default_conf, mocker, caplog) -> None:
|
||||||
@ -141,7 +140,6 @@ def test_order_dict_live(default_conf, mocker, caplog) -> None:
|
|||||||
freqtrade = FreqtradeBot(conf)
|
freqtrade = FreqtradeBot(conf)
|
||||||
assert not freqtrade.strategy.order_types['stoploss_on_exchange']
|
assert not freqtrade.strategy.order_types['stoploss_on_exchange']
|
||||||
assert not log_has_re(".*stoploss_on_exchange .* dry-run", caplog)
|
assert not log_has_re(".*stoploss_on_exchange .* dry-run", caplog)
|
||||||
caplog.clear()
|
|
||||||
|
|
||||||
|
|
||||||
def test_get_trade_stake_amount(default_conf, ticker, mocker) -> None:
|
def test_get_trade_stake_amount(default_conf, ticker, mocker) -> None:
|
||||||
@ -417,7 +415,6 @@ def test_create_trade_too_small_stake_amount(default_conf, ticker, limit_buy_ord
|
|||||||
|
|
||||||
assert freqtrade.create_trade('ETH/BTC')
|
assert freqtrade.create_trade('ETH/BTC')
|
||||||
assert log_has_re(r"Stake amount for pair .* is too small.*", caplog)
|
assert log_has_re(r"Stake amount for pair .* is too small.*", caplog)
|
||||||
caplog.clear()
|
|
||||||
|
|
||||||
|
|
||||||
def test_create_trade_zero_stake_amount(default_conf, ticker, limit_buy_order_open,
|
def test_create_trade_zero_stake_amount(default_conf, ticker, limit_buy_order_open,
|
||||||
@ -481,7 +478,6 @@ def test_enter_positions_no_pairs_left(default_conf, ticker, limit_buy_order_ope
|
|||||||
n = freqtrade.enter_positions()
|
n = freqtrade.enter_positions()
|
||||||
assert n == 0
|
assert n == 0
|
||||||
assert log_has_re(r"No currency pair in active pair whitelist.*", caplog)
|
assert log_has_re(r"No currency pair in active pair whitelist.*", caplog)
|
||||||
caplog.clear()
|
|
||||||
|
|
||||||
|
|
||||||
def test_enter_positions_no_pairs_in_whitelist(default_conf, ticker, limit_buy_order, fee,
|
def test_enter_positions_no_pairs_in_whitelist(default_conf, ticker, limit_buy_order, fee,
|
||||||
@ -528,7 +524,6 @@ def test_enter_positions_global_pairlock(default_conf, ticker, limit_buy_order,
|
|||||||
n = freqtrade.enter_positions()
|
n = freqtrade.enter_positions()
|
||||||
assert n == 0
|
assert n == 0
|
||||||
assert log_has_re(message, caplog)
|
assert log_has_re(message, caplog)
|
||||||
caplog.clear()
|
|
||||||
|
|
||||||
|
|
||||||
def test_create_trade_no_signal(default_conf, fee, mocker) -> None:
|
def test_create_trade_no_signal(default_conf, fee, mocker) -> None:
|
||||||
@ -1123,7 +1118,6 @@ def test_handle_stoploss_on_exchange(mocker, default_conf, fee, caplog,
|
|||||||
mocker.patch('freqtrade.exchange.Binance.stoploss', stoploss)
|
mocker.patch('freqtrade.exchange.Binance.stoploss', stoploss)
|
||||||
assert freqtrade.handle_stoploss_on_exchange(trade) is False
|
assert freqtrade.handle_stoploss_on_exchange(trade) is False
|
||||||
assert stoploss.call_count == 0
|
assert stoploss.call_count == 0
|
||||||
caplog.clear()
|
|
||||||
|
|
||||||
|
|
||||||
def test_handle_sle_cancel_cant_recreate(mocker, default_conf, fee, caplog,
|
def test_handle_sle_cancel_cant_recreate(mocker, default_conf, fee, caplog,
|
||||||
@ -1163,7 +1157,6 @@ def test_handle_sle_cancel_cant_recreate(mocker, default_conf, fee, caplog,
|
|||||||
assert log_has_re(r'Stoploss order was cancelled, but unable to recreate one.*', caplog)
|
assert log_has_re(r'Stoploss order was cancelled, but unable to recreate one.*', caplog)
|
||||||
assert trade.stoploss_order_id is None
|
assert trade.stoploss_order_id is None
|
||||||
assert trade.is_open is True
|
assert trade.is_open is True
|
||||||
caplog.clear()
|
|
||||||
|
|
||||||
|
|
||||||
def test_create_stoploss_order_invalid_order(mocker, default_conf, caplog, fee,
|
def test_create_stoploss_order_invalid_order(mocker, default_conf, caplog, fee,
|
||||||
@ -1212,7 +1205,6 @@ def test_create_stoploss_order_invalid_order(mocker, default_conf, caplog, fee,
|
|||||||
assert rpc_mock.call_count == 2
|
assert rpc_mock.call_count == 2
|
||||||
assert rpc_mock.call_args_list[1][0][0]['sell_reason'] == SellType.EMERGENCY_SELL.value
|
assert rpc_mock.call_args_list[1][0][0]['sell_reason'] == SellType.EMERGENCY_SELL.value
|
||||||
assert rpc_mock.call_args_list[1][0][0]['order_type'] == 'market'
|
assert rpc_mock.call_args_list[1][0][0]['order_type'] == 'market'
|
||||||
caplog.clear()
|
|
||||||
|
|
||||||
|
|
||||||
def test_create_stoploss_order_insufficient_funds(mocker, default_conf, caplog, fee,
|
def test_create_stoploss_order_insufficient_funds(mocker, default_conf, caplog, fee,
|
||||||
@ -1442,7 +1434,6 @@ def test_handle_stoploss_on_exchange_trailing_error(mocker, default_conf, fee, c
|
|||||||
freqtrade.handle_trailing_stoploss_on_exchange(trade, stoploss_order_hanging, side="sell")
|
freqtrade.handle_trailing_stoploss_on_exchange(trade, stoploss_order_hanging, side="sell")
|
||||||
assert cancel_mock.call_count == 1
|
assert cancel_mock.call_count == 1
|
||||||
assert log_has_re(r"Could not create trailing stoploss order for pair ETH/BTC\..*", caplog)
|
assert log_has_re(r"Could not create trailing stoploss order for pair ETH/BTC\..*", caplog)
|
||||||
caplog.clear()
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.usefixtures("init_persistence")
|
@pytest.mark.usefixtures("init_persistence")
|
||||||
@ -1683,7 +1674,6 @@ def test_enter_positions(mocker, default_conf, caplog) -> None:
|
|||||||
assert log_has('Found no enter signals for whitelisted currencies. Trying again...', caplog)
|
assert log_has('Found no enter signals for whitelisted currencies. Trying again...', caplog)
|
||||||
# create_trade should be called once for every pair in the whitelist.
|
# create_trade should be called once for every pair in the whitelist.
|
||||||
assert mock_ct.call_count == len(default_conf['exchange']['pair_whitelist'])
|
assert mock_ct.call_count == len(default_conf['exchange']['pair_whitelist'])
|
||||||
caplog.clear()
|
|
||||||
|
|
||||||
|
|
||||||
def test_enter_positions_exception(mocker, default_conf, caplog) -> None:
|
def test_enter_positions_exception(mocker, default_conf, caplog) -> None:
|
||||||
@ -1723,7 +1713,6 @@ def test_exit_positions(mocker, default_conf, limit_buy_order, caplog) -> None:
|
|||||||
# test amount modified by fee-logic
|
# test amount modified by fee-logic
|
||||||
n = freqtrade.exit_positions(trades)
|
n = freqtrade.exit_positions(trades)
|
||||||
assert n == 0
|
assert n == 0
|
||||||
caplog.clear()
|
|
||||||
|
|
||||||
|
|
||||||
def test_exit_positions_exception(mocker, default_conf, limit_buy_order, caplog) -> None:
|
def test_exit_positions_exception(mocker, default_conf, limit_buy_order, caplog) -> None:
|
||||||
@ -1743,8 +1732,7 @@ def test_exit_positions_exception(mocker, default_conf, limit_buy_order, caplog)
|
|||||||
)
|
)
|
||||||
n = freqtrade.exit_positions(trades)
|
n = freqtrade.exit_positions(trades)
|
||||||
assert n == 0
|
assert n == 0
|
||||||
assert log_has('Unable to exit trade ETH/BTC: ', caplog)
|
assert log_has('Unable to sell trade ETH/BTC: ', caplog)
|
||||||
caplog.clear()
|
|
||||||
|
|
||||||
|
|
||||||
def test_update_trade_state(mocker, default_conf, limit_buy_order, caplog) -> None:
|
def test_update_trade_state(mocker, default_conf, limit_buy_order, caplog) -> None:
|
||||||
@ -1790,7 +1778,6 @@ def test_update_trade_state(mocker, default_conf, limit_buy_order, caplog) -> No
|
|||||||
freqtrade.update_trade_state(trade, '123')
|
freqtrade.update_trade_state(trade, '123')
|
||||||
|
|
||||||
assert log_has_re('Found open order for.*', caplog)
|
assert log_has_re('Found open order for.*', caplog)
|
||||||
caplog.clear()
|
|
||||||
|
|
||||||
|
|
||||||
def test_update_trade_state_withorderdict(default_conf, trades_for_order, limit_buy_order, fee,
|
def test_update_trade_state_withorderdict(default_conf, trades_for_order, limit_buy_order, fee,
|
||||||
@ -1841,7 +1828,6 @@ def test_update_trade_state_withorderdict_rounding_fee(default_conf, trades_for_
|
|||||||
assert trade.amount != amount
|
assert trade.amount != amount
|
||||||
assert trade.amount == limit_buy_order['amount']
|
assert trade.amount == limit_buy_order['amount']
|
||||||
assert log_has_re(r'Applying fee on amount for .*', caplog)
|
assert log_has_re(r'Applying fee on amount for .*', caplog)
|
||||||
caplog.clear()
|
|
||||||
|
|
||||||
|
|
||||||
def test_update_trade_state_exception(mocker, default_conf,
|
def test_update_trade_state_exception(mocker, default_conf,
|
||||||
@ -1860,7 +1846,6 @@ def test_update_trade_state_exception(mocker, default_conf,
|
|||||||
)
|
)
|
||||||
freqtrade.update_trade_state(trade, trade.open_order_id)
|
freqtrade.update_trade_state(trade, trade.open_order_id)
|
||||||
assert log_has('Could not update trade amount: ', caplog)
|
assert log_has('Could not update trade amount: ', caplog)
|
||||||
caplog.clear()
|
|
||||||
|
|
||||||
|
|
||||||
def test_update_trade_state_orderexception(mocker, default_conf, caplog) -> None:
|
def test_update_trade_state_orderexception(mocker, default_conf, caplog) -> None:
|
||||||
@ -1877,7 +1862,6 @@ def test_update_trade_state_orderexception(mocker, default_conf, caplog) -> None
|
|||||||
freqtrade.update_trade_state(trade, trade.open_order_id)
|
freqtrade.update_trade_state(trade, trade.open_order_id)
|
||||||
assert grm_mock.call_count == 0
|
assert grm_mock.call_count == 0
|
||||||
assert log_has(f'Unable to fetch order {trade.open_order_id}: ', caplog)
|
assert log_has(f'Unable to fetch order {trade.open_order_id}: ', caplog)
|
||||||
caplog.clear()
|
|
||||||
|
|
||||||
|
|
||||||
def test_update_trade_state_sell(default_conf, trades_for_order, limit_sell_order_open,
|
def test_update_trade_state_sell(default_conf, trades_for_order, limit_sell_order_open,
|
||||||
@ -2046,7 +2030,6 @@ def test_handle_trade_roi(default_conf, ticker, limit_buy_order_open,
|
|||||||
assert freqtrade.handle_trade(trade)
|
assert freqtrade.handle_trade(trade)
|
||||||
assert log_has("ETH/BTC - Required profit reached. sell_type=SellType.ROI",
|
assert log_has("ETH/BTC - Required profit reached. sell_type=SellType.ROI",
|
||||||
caplog)
|
caplog)
|
||||||
caplog.clear()
|
|
||||||
|
|
||||||
|
|
||||||
def test_handle_trade_use_sell_signal(default_conf, ticker, limit_buy_order_open,
|
def test_handle_trade_use_sell_signal(default_conf, ticker, limit_buy_order_open,
|
||||||
@ -2079,7 +2062,6 @@ def test_handle_trade_use_sell_signal(default_conf, ticker, limit_buy_order_open
|
|||||||
assert freqtrade.handle_trade(trade)
|
assert freqtrade.handle_trade(trade)
|
||||||
assert log_has("ETH/BTC - Sell signal received. sell_type=SellType.SELL_SIGNAL",
|
assert log_has("ETH/BTC - Sell signal received. sell_type=SellType.SELL_SIGNAL",
|
||||||
caplog)
|
caplog)
|
||||||
caplog.clear()
|
|
||||||
|
|
||||||
|
|
||||||
def test_close_trade(default_conf, ticker, limit_buy_order, limit_buy_order_open, limit_sell_order,
|
def test_close_trade(default_conf, ticker, limit_buy_order, limit_buy_order_open, limit_sell_order,
|
||||||
@ -2120,7 +2102,6 @@ def test_bot_loop_start_called_once(mocker, default_conf, caplog):
|
|||||||
assert log_has_re(r'Strategy caused the following exception.*', caplog)
|
assert log_has_re(r'Strategy caused the following exception.*', caplog)
|
||||||
assert ftbot.strategy.bot_loop_start.call_count == 1
|
assert ftbot.strategy.bot_loop_start.call_count == 1
|
||||||
assert ftbot.strategy.analyze.call_count == 1
|
assert ftbot.strategy.analyze.call_count == 1
|
||||||
caplog.clear()
|
|
||||||
|
|
||||||
|
|
||||||
def test_check_handle_timedout_buy_usercustom(default_conf, ticker, limit_buy_order_old, open_trade,
|
def test_check_handle_timedout_buy_usercustom(default_conf, ticker, limit_buy_order_old, open_trade,
|
||||||
@ -2235,7 +2216,6 @@ def test_check_handle_cancelled_buy(default_conf, ticker, limit_buy_order_old, o
|
|||||||
nb_trades = len(trades)
|
nb_trades = len(trades)
|
||||||
assert nb_trades == 0
|
assert nb_trades == 0
|
||||||
assert log_has_re("Buy order cancelled on exchange for Trade.*", caplog)
|
assert log_has_re("Buy order cancelled on exchange for Trade.*", caplog)
|
||||||
caplog.clear()
|
|
||||||
|
|
||||||
|
|
||||||
def test_check_handle_timedout_buy_exception(default_conf, ticker, limit_buy_order_old, open_trade,
|
def test_check_handle_timedout_buy_exception(default_conf, ticker, limit_buy_order_old, open_trade,
|
||||||
@ -2370,7 +2350,6 @@ def test_check_handle_cancelled_sell(default_conf, ticker, limit_sell_order_old,
|
|||||||
assert rpc_mock.call_count == 1
|
assert rpc_mock.call_count == 1
|
||||||
assert open_trade.is_open is True
|
assert open_trade.is_open is True
|
||||||
assert log_has_re("Sell order cancelled on exchange for Trade.*", caplog)
|
assert log_has_re("Sell order cancelled on exchange for Trade.*", caplog)
|
||||||
caplog.clear()
|
|
||||||
|
|
||||||
|
|
||||||
def test_check_handle_timedout_partial(default_conf, ticker, limit_buy_order_old_partial,
|
def test_check_handle_timedout_partial(default_conf, ticker, limit_buy_order_old_partial,
|
||||||
@ -2439,7 +2418,6 @@ def test_check_handle_timedout_partial_fee(default_conf, ticker, open_trade, cap
|
|||||||
assert trades[0].open_order_id is None
|
assert trades[0].open_order_id is None
|
||||||
assert trades[0].fee_updated('buy')
|
assert trades[0].fee_updated('buy')
|
||||||
assert pytest.approx(trades[0].fee_open) == 0.001
|
assert pytest.approx(trades[0].fee_open) == 0.001
|
||||||
caplog.clear()
|
|
||||||
|
|
||||||
|
|
||||||
def test_check_handle_timedout_partial_except(default_conf, ticker, open_trade, caplog, fee,
|
def test_check_handle_timedout_partial_except(default_conf, ticker, open_trade, caplog, fee,
|
||||||
@ -2480,7 +2458,6 @@ def test_check_handle_timedout_partial_except(default_conf, ticker, open_trade,
|
|||||||
limit_buy_order_old_partial['remaining'])
|
limit_buy_order_old_partial['remaining'])
|
||||||
assert trades[0].open_order_id is None
|
assert trades[0].open_order_id is None
|
||||||
assert trades[0].fee_open == fee()
|
assert trades[0].fee_open == fee()
|
||||||
caplog.clear()
|
|
||||||
|
|
||||||
|
|
||||||
def test_check_handle_timedout_exception(default_conf, ticker, open_trade, mocker, caplog) -> None:
|
def test_check_handle_timedout_exception(default_conf, ticker, open_trade, mocker, caplog) -> None:
|
||||||
@ -2510,7 +2487,6 @@ def test_check_handle_timedout_exception(default_conf, ticker, open_trade, mocke
|
|||||||
f"{open_trade.open_date.strftime('%Y-%m-%d %H:%M:%S')}"
|
f"{open_trade.open_date.strftime('%Y-%m-%d %H:%M:%S')}"
|
||||||
r"\) due to Traceback \(most recent call last\):\n*",
|
r"\) due to Traceback \(most recent call last\):\n*",
|
||||||
caplog)
|
caplog)
|
||||||
caplog.clear()
|
|
||||||
|
|
||||||
|
|
||||||
def test_handle_cancel_enter(mocker, caplog, default_conf, limit_buy_order) -> None:
|
def test_handle_cancel_enter(mocker, caplog, default_conf, limit_buy_order) -> None:
|
||||||
@ -2554,7 +2530,6 @@ def test_handle_cancel_enter(mocker, caplog, default_conf, limit_buy_order) -> N
|
|||||||
mocker.patch('freqtrade.exchange.Exchange.cancel_order_with_result', cancel_order_mock)
|
mocker.patch('freqtrade.exchange.Exchange.cancel_order_with_result', cancel_order_mock)
|
||||||
assert not freqtrade.handle_cancel_enter(trade, limit_buy_order, reason)
|
assert not freqtrade.handle_cancel_enter(trade, limit_buy_order, reason)
|
||||||
assert log_has_re(r"Order .* for .* not cancelled.", caplog)
|
assert log_has_re(r"Order .* for .* not cancelled.", caplog)
|
||||||
caplog.clear()
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("limit_buy_order_canceled_empty", ['binance', 'ftx', 'kraken', 'bittrex'],
|
@pytest.mark.parametrize("limit_buy_order_canceled_empty", ['binance', 'ftx', 'kraken', 'bittrex'],
|
||||||
@ -2576,7 +2551,6 @@ def test_handle_cancel_enter_exchanges(mocker, caplog, default_conf,
|
|||||||
assert cancel_order_mock.call_count == 0
|
assert cancel_order_mock.call_count == 0
|
||||||
assert log_has_re(r'Buy order fully cancelled. Removing .* from database\.', caplog)
|
assert log_has_re(r'Buy order fully cancelled. Removing .* from database\.', caplog)
|
||||||
assert nofiy_mock.call_count == 1
|
assert nofiy_mock.call_count == 1
|
||||||
caplog.clear()
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('cancelorder', [
|
@pytest.mark.parametrize('cancelorder', [
|
||||||
@ -2946,7 +2920,6 @@ def test_execute_trade_exit_sloe_cancel_exception(
|
|||||||
sell_reason=SellCheckTuple(sell_type=SellType.STOP_LOSS))
|
sell_reason=SellCheckTuple(sell_type=SellType.STOP_LOSS))
|
||||||
assert create_order_mock.call_count == 2
|
assert create_order_mock.call_count == 2
|
||||||
assert log_has('Could not cancel stoploss order abcd', caplog)
|
assert log_has('Could not cancel stoploss order abcd', caplog)
|
||||||
caplog.clear()
|
|
||||||
|
|
||||||
|
|
||||||
def test_execute_trade_exit_with_stoploss_on_exchange(default_conf, ticker, fee, ticker_sell_up,
|
def test_execute_trade_exit_with_stoploss_on_exchange(default_conf, ticker, fee, ticker_sell_up,
|
||||||
@ -3342,7 +3315,6 @@ def test_sell_not_enough_balance(default_conf, limit_buy_order, limit_buy_order_
|
|||||||
assert freqtrade.handle_trade(trade) is True
|
assert freqtrade.handle_trade(trade) is True
|
||||||
assert log_has_re(r'.*Falling back to wallet-amount.', caplog)
|
assert log_has_re(r'.*Falling back to wallet-amount.', caplog)
|
||||||
assert trade.amount != amnt
|
assert trade.amount != amnt
|
||||||
caplog.clear()
|
|
||||||
|
|
||||||
|
|
||||||
def test__safe_exit_amount(default_conf, fee, caplog, mocker):
|
def test__safe_exit_amount(default_conf, fee, caplog, mocker):
|
||||||
@ -3373,10 +3345,9 @@ def test__safe_exit_amount(default_conf, fee, caplog, mocker):
|
|||||||
assert freqtrade._safe_exit_amount(trade.pair, amount_wallet) == amount_wallet
|
assert freqtrade._safe_exit_amount(trade.pair, amount_wallet) == amount_wallet
|
||||||
assert not log_has_re(r'.*Falling back to wallet-amount.', caplog)
|
assert not log_has_re(r'.*Falling back to wallet-amount.', caplog)
|
||||||
assert wallet_update.call_count == 1
|
assert wallet_update.call_count == 1
|
||||||
caplog.clear()
|
|
||||||
|
|
||||||
|
|
||||||
def test_safe_exit_amount_error(default_conf, fee, caplog, mocker):
|
def test__safe_exit_amount_error(default_conf, fee, caplog, mocker):
|
||||||
patch_RPCManager(mocker)
|
patch_RPCManager(mocker)
|
||||||
patch_exchange(mocker)
|
patch_exchange(mocker)
|
||||||
amount = 95.33
|
amount = 95.33
|
||||||
@ -3430,7 +3401,6 @@ def test_locked_pairs(default_conf, ticker, fee, ticker_sell_down, mocker, caplo
|
|||||||
freqtrade.enter_positions()
|
freqtrade.enter_positions()
|
||||||
|
|
||||||
assert log_has_re(f"Pair {trade.pair} is still locked.*", caplog)
|
assert log_has_re(f"Pair {trade.pair} is still locked.*", caplog)
|
||||||
caplog.clear()
|
|
||||||
|
|
||||||
|
|
||||||
def test_ignore_roi_if_buy_signal(default_conf, limit_buy_order, limit_buy_order_open,
|
def test_ignore_roi_if_buy_signal(default_conf, limit_buy_order, limit_buy_order_open,
|
||||||
@ -3522,7 +3492,6 @@ def test_trailing_stop_loss(default_conf, limit_buy_order_open, limit_buy_order,
|
|||||||
assert log_has("ETH/BTC - HIT STOP: current price at 0.000012, stoploss is 0.000015, "
|
assert log_has("ETH/BTC - HIT STOP: current price at 0.000012, stoploss is 0.000015, "
|
||||||
"initial stoploss was at 0.000010, trade opened at 0.000011", caplog)
|
"initial stoploss was at 0.000010, trade opened at 0.000011", caplog)
|
||||||
assert trade.sell_reason == SellType.TRAILING_STOP_LOSS.value
|
assert trade.sell_reason == SellType.TRAILING_STOP_LOSS.value
|
||||||
caplog.clear()
|
|
||||||
|
|
||||||
|
|
||||||
def test_trailing_stop_loss_positive(default_conf, limit_buy_order, limit_buy_order_open, fee,
|
def test_trailing_stop_loss_positive(default_conf, limit_buy_order, limit_buy_order_open, fee,
|
||||||
@ -3584,7 +3553,6 @@ def test_trailing_stop_loss_positive(default_conf, limit_buy_order, limit_buy_or
|
|||||||
f"ETH/BTC - HIT STOP: current price at {buy_price + 0.000002:.6f}, "
|
f"ETH/BTC - HIT STOP: current price at {buy_price + 0.000002:.6f}, "
|
||||||
f"stoploss is {trade.stop_loss:.6f}, "
|
f"stoploss is {trade.stop_loss:.6f}, "
|
||||||
f"initial stoploss was at 0.000010, trade opened at 0.000011", caplog)
|
f"initial stoploss was at 0.000010, trade opened at 0.000011", caplog)
|
||||||
caplog.clear()
|
|
||||||
|
|
||||||
|
|
||||||
def test_trailing_stop_loss_offset(default_conf, limit_buy_order, limit_buy_order_open, fee,
|
def test_trailing_stop_loss_offset(default_conf, limit_buy_order, limit_buy_order_open, fee,
|
||||||
@ -3647,7 +3615,6 @@ def test_trailing_stop_loss_offset(default_conf, limit_buy_order, limit_buy_orde
|
|||||||
f"stoploss is {trade.stop_loss:.6f}, "
|
f"stoploss is {trade.stop_loss:.6f}, "
|
||||||
f"initial stoploss was at 0.000010, trade opened at 0.000011", caplog)
|
f"initial stoploss was at 0.000010, trade opened at 0.000011", caplog)
|
||||||
assert trade.sell_reason == SellType.TRAILING_STOP_LOSS.value
|
assert trade.sell_reason == SellType.TRAILING_STOP_LOSS.value
|
||||||
caplog.clear()
|
|
||||||
|
|
||||||
|
|
||||||
def test_tsl_only_offset_reached(default_conf, limit_buy_order, limit_buy_order_open, fee,
|
def test_tsl_only_offset_reached(default_conf, limit_buy_order, limit_buy_order_open, fee,
|
||||||
@ -3712,7 +3679,6 @@ def test_tsl_only_offset_reached(default_conf, limit_buy_order, limit_buy_order_
|
|||||||
assert log_has("ETH/BTC - Using positive stoploss: 0.05 offset: 0.055 profit: 0.1218%", caplog)
|
assert log_has("ETH/BTC - Using positive stoploss: 0.05 offset: 0.055 profit: 0.1218%", caplog)
|
||||||
assert log_has("ETH/BTC - Adjusting stoploss...", caplog)
|
assert log_has("ETH/BTC - Adjusting stoploss...", caplog)
|
||||||
assert trade.stop_loss == 0.0000117705
|
assert trade.stop_loss == 0.0000117705
|
||||||
caplog.clear()
|
|
||||||
|
|
||||||
|
|
||||||
def test_disable_ignore_roi_if_buy_signal(default_conf, limit_buy_order, limit_buy_order_open,
|
def test_disable_ignore_roi_if_buy_signal(default_conf, limit_buy_order, limit_buy_order_open,
|
||||||
@ -3776,7 +3742,6 @@ def test_get_real_amount_quote(default_conf, trades_for_order, buy_order_fee, fe
|
|||||||
' leverage=1.0, open_rate=0.24544100, open_since=closed) (from 8.0 to 7.992).',
|
' leverage=1.0, open_rate=0.24544100, open_since=closed) (from 8.0 to 7.992).',
|
||||||
caplog
|
caplog
|
||||||
)
|
)
|
||||||
caplog.clear()
|
|
||||||
|
|
||||||
|
|
||||||
def test_get_real_amount_quote_dust(default_conf, trades_for_order, buy_order_fee, fee,
|
def test_get_real_amount_quote_dust(default_conf, trades_for_order, buy_order_fee, fee,
|
||||||
@ -3802,7 +3767,6 @@ def test_get_real_amount_quote_dust(default_conf, trades_for_order, buy_order_fe
|
|||||||
assert walletmock.call_count == 1
|
assert walletmock.call_count == 1
|
||||||
assert log_has_re(r'Fee amount for Trade.* was in base currency '
|
assert log_has_re(r'Fee amount for Trade.* was in base currency '
|
||||||
'- Eating Fee 0.008 into dust', caplog)
|
'- Eating Fee 0.008 into dust', caplog)
|
||||||
caplog.clear()
|
|
||||||
|
|
||||||
|
|
||||||
def test_get_real_amount_no_trade(default_conf, buy_order_fee, caplog, mocker, fee):
|
def test_get_real_amount_no_trade(default_conf, buy_order_fee, caplog, mocker, fee):
|
||||||
@ -3828,7 +3792,6 @@ def test_get_real_amount_no_trade(default_conf, buy_order_fee, caplog, mocker, f
|
|||||||
'myTrade-Dict empty found',
|
'myTrade-Dict empty found',
|
||||||
caplog
|
caplog
|
||||||
)
|
)
|
||||||
caplog.clear()
|
|
||||||
|
|
||||||
|
|
||||||
def test_get_real_amount_stake(default_conf, trades_for_order, buy_order_fee, fee, mocker):
|
def test_get_real_amount_stake(default_conf, trades_for_order, buy_order_fee, fee, mocker):
|
||||||
@ -3924,7 +3887,6 @@ def test_get_real_amount_multi(default_conf, trades_for_order2, buy_order_fee, c
|
|||||||
assert trade.fee_open_currency is not None
|
assert trade.fee_open_currency is not None
|
||||||
assert trade.fee_close_cost is None
|
assert trade.fee_close_cost is None
|
||||||
assert trade.fee_close_currency is None
|
assert trade.fee_close_currency is None
|
||||||
caplog.clear()
|
|
||||||
|
|
||||||
|
|
||||||
def test_get_real_amount_multi2(default_conf, trades_for_order3, buy_order_fee, caplog, fee,
|
def test_get_real_amount_multi2(default_conf, trades_for_order3, buy_order_fee, caplog, fee,
|
||||||
@ -3962,7 +3924,6 @@ def test_get_real_amount_multi2(default_conf, trades_for_order3, buy_order_fee,
|
|||||||
assert trade.fee_open_currency is not None
|
assert trade.fee_open_currency is not None
|
||||||
assert trade.fee_close_cost is None
|
assert trade.fee_close_cost is None
|
||||||
assert trade.fee_close_currency is None
|
assert trade.fee_close_currency is None
|
||||||
caplog.clear()
|
|
||||||
|
|
||||||
|
|
||||||
def test_get_real_amount_fromorder(default_conf, trades_for_order, buy_order_fee, fee,
|
def test_get_real_amount_fromorder(default_conf, trades_for_order, buy_order_fee, fee,
|
||||||
@ -3993,7 +3954,6 @@ def test_get_real_amount_fromorder(default_conf, trades_for_order, buy_order_fee
|
|||||||
' leverage=1.0, open_rate=0.24544100, open_since=closed) (from 8.0 to 7.996).',
|
' leverage=1.0, open_rate=0.24544100, open_since=closed) (from 8.0 to 7.996).',
|
||||||
caplog
|
caplog
|
||||||
)
|
)
|
||||||
caplog.clear()
|
|
||||||
|
|
||||||
|
|
||||||
def test_get_real_amount_invalid_order(default_conf, trades_for_order, buy_order_fee, fee, mocker):
|
def test_get_real_amount_invalid_order(default_conf, trades_for_order, buy_order_fee, fee, mocker):
|
||||||
@ -4237,7 +4197,6 @@ def test_order_book_bid_strategy_exception(mocker, default_conf, caplog) -> None
|
|||||||
with pytest.raises(PricingError):
|
with pytest.raises(PricingError):
|
||||||
freqtrade.exchange.get_rate('ETH/BTC', refresh=True, side="buy")
|
freqtrade.exchange.get_rate('ETH/BTC', refresh=True, side="buy")
|
||||||
assert log_has_re(r'Buy Price at location 1 from orderbook could not be determined.', caplog)
|
assert log_has_re(r'Buy Price at location 1 from orderbook could not be determined.', caplog)
|
||||||
caplog.clear()
|
|
||||||
|
|
||||||
|
|
||||||
def test_check_depth_of_market_buy(default_conf, mocker, order_book_l2) -> None:
|
def test_check_depth_of_market_buy(default_conf, mocker, order_book_l2) -> None:
|
||||||
@ -4308,7 +4267,6 @@ def test_order_book_ask_strategy(default_conf, limit_buy_order_open, limit_buy_o
|
|||||||
freqtrade.handle_trade(trade)
|
freqtrade.handle_trade(trade)
|
||||||
assert log_has_re(r'Sell Price at location 1 from orderbook could not be determined\..*',
|
assert log_has_re(r'Sell Price at location 1 from orderbook could not be determined\..*',
|
||||||
caplog)
|
caplog)
|
||||||
caplog.clear()
|
|
||||||
|
|
||||||
|
|
||||||
def test_startup_state(default_conf, mocker):
|
def test_startup_state(default_conf, mocker):
|
||||||
@ -4367,7 +4325,6 @@ def test_sync_wallet_dry_run(mocker, default_conf, ticker, fee, limit_buy_order_
|
|||||||
assert log_has_re(r"Unable to create trade for XRP/BTC: "
|
assert log_has_re(r"Unable to create trade for XRP/BTC: "
|
||||||
r"Available balance \(0.0 BTC\) is lower than stake amount \(0.001 BTC\)",
|
r"Available balance \(0.0 BTC\) is lower than stake amount \(0.001 BTC\)",
|
||||||
caplog)
|
caplog)
|
||||||
caplog.clear()
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.usefixtures("init_persistence")
|
@pytest.mark.usefixtures("init_persistence")
|
||||||
@ -4527,7 +4484,6 @@ def test_reupdate_enter_order_fees(mocker, default_conf, fee, caplog):
|
|||||||
assert log_has_re(r"Trying to reupdate buy fees for .*", caplog)
|
assert log_has_re(r"Trying to reupdate buy fees for .*", caplog)
|
||||||
assert mock_uts.call_count == 0
|
assert mock_uts.call_count == 0
|
||||||
assert not log_has_re(r"Updating buy-fee on trade .* for order .*\.", caplog)
|
assert not log_has_re(r"Updating buy-fee on trade .* for order .*\.", caplog)
|
||||||
caplog.clear()
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.usefixtures("init_persistence")
|
@pytest.mark.usefixtures("init_persistence")
|
||||||
@ -4665,7 +4621,6 @@ def test_refind_lost_order(mocker, default_conf, fee, caplog):
|
|||||||
|
|
||||||
freqtrade.refind_lost_order(trades[4])
|
freqtrade.refind_lost_order(trades[4])
|
||||||
assert log_has(f"Error updating {order['id']}.", caplog)
|
assert log_has(f"Error updating {order['id']}.", caplog)
|
||||||
caplog.clear()
|
|
||||||
|
|
||||||
|
|
||||||
def test_get_valid_price(mocker, default_conf) -> None:
|
def test_get_valid_price(mocker, default_conf) -> None:
|
||||||
|
Loading…
Reference in New Issue
Block a user