fail if known bad exchanges are detcted
This commit is contained in:
parent
d8dbea9d5b
commit
3c589bb877
@ -53,6 +53,7 @@ Mandatory Parameters are marked as **Required**.
|
|||||||
| `experimental.use_sell_signal` | false | Use your sell strategy in addition of the `minimal_roi`. [Strategy Override](#parameters-in-the-strategy).
|
| `experimental.use_sell_signal` | false | Use your sell strategy in addition of the `minimal_roi`. [Strategy Override](#parameters-in-the-strategy).
|
||||||
| `experimental.sell_profit_only` | false | Waits until you have made a positive profit before taking a sell decision. [Strategy Override](#parameters-in-the-strategy).
|
| `experimental.sell_profit_only` | false | Waits until you have made a positive profit before taking a sell decision. [Strategy Override](#parameters-in-the-strategy).
|
||||||
| `experimental.ignore_roi_if_buy_signal` | false | Does not sell if the buy-signal is still active. Takes preference over `minimal_roi` and `use_sell_signal`. [Strategy Override](#parameters-in-the-strategy).
|
| `experimental.ignore_roi_if_buy_signal` | false | Does not sell if the buy-signal is still active. Takes preference over `minimal_roi` and `use_sell_signal`. [Strategy Override](#parameters-in-the-strategy).
|
||||||
|
| `experimental.block_bad_exchanges` | true | Block exchanges known to not work with freqtrade. Leave on default unless you want to test if that exchange works now.
|
||||||
| `pairlist.method` | StaticPairList | Use static or dynamic volume-based pairlist. [More information below](#dynamic-pairlists).
|
| `pairlist.method` | StaticPairList | Use static or dynamic volume-based pairlist. [More information below](#dynamic-pairlists).
|
||||||
| `pairlist.config` | None | Additional configuration for dynamic pairlists. [More information below](#dynamic-pairlists).
|
| `pairlist.config` | None | Additional configuration for dynamic pairlists. [More information below](#dynamic-pairlists).
|
||||||
| `telegram.enabled` | true | **Required.** Enable or not the usage of Telegram.
|
| `telegram.enabled` | true | **Required.** Enable or not the usage of Telegram.
|
||||||
|
@ -2,9 +2,9 @@ import logging
|
|||||||
from typing import Any, Dict
|
from typing import Any, Dict
|
||||||
|
|
||||||
from freqtrade import OperationalException
|
from freqtrade import OperationalException
|
||||||
from freqtrade.exchange import (is_exchange_bad, is_exchange_available,
|
from freqtrade.exchange import (available_exchanges, get_exchange_bad_reason,
|
||||||
is_exchange_officially_supported, available_exchanges)
|
is_exchange_available, is_exchange_bad,
|
||||||
|
is_exchange_officially_supported)
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -31,9 +31,8 @@ def check_exchange(config: Dict[str, Any], check_for_bad: bool = True) -> bool:
|
|||||||
)
|
)
|
||||||
|
|
||||||
if check_for_bad and is_exchange_bad(exchange):
|
if check_for_bad and is_exchange_bad(exchange):
|
||||||
logger.warning(f'Exchange "{exchange}" is known to not work with the bot yet. '
|
raise OperationalException(f'Exchange "{exchange}" is known to not work with the bot yet. '
|
||||||
f'Use it only for development and testing purposes.')
|
f'Reason: {get_exchange_bad_reason(exchange)}')
|
||||||
return False
|
|
||||||
|
|
||||||
if is_exchange_officially_supported(exchange):
|
if is_exchange_officially_supported(exchange):
|
||||||
logger.info(f'Exchange "{exchange}" is officially supported '
|
logger.info(f'Exchange "{exchange}" is officially supported '
|
||||||
|
@ -148,7 +148,7 @@ class Configuration(object):
|
|||||||
config['internals'].update({'sd_notify': True})
|
config['internals'].update({'sd_notify': True})
|
||||||
|
|
||||||
# Check if the exchange set by the user is supported
|
# Check if the exchange set by the user is supported
|
||||||
check_exchange(config)
|
check_exchange(config, config.get('experimental', {}).get('block_bad_exchanges', True))
|
||||||
|
|
||||||
def _process_datadir_options(self, config: Dict[str, Any]) -> None:
|
def _process_datadir_options(self, config: Dict[str, Any]) -> None:
|
||||||
"""
|
"""
|
||||||
|
@ -27,7 +27,8 @@ logger = logging.getLogger(__name__)
|
|||||||
API_RETRY_COUNT = 4
|
API_RETRY_COUNT = 4
|
||||||
BAD_EXCHANGES = {
|
BAD_EXCHANGES = {
|
||||||
"bitmex": "Various reasons",
|
"bitmex": "Various reasons",
|
||||||
"bitstamp": "Does not provide history. Details in https://github.com/freqtrade/freqtrade/issues/1983",
|
"bitstamp": "Does not provide history. "
|
||||||
|
"Details in https://github.com/freqtrade/freqtrade/issues/1983",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -763,7 +764,7 @@ def is_exchange_bad(exchange: str) -> bool:
|
|||||||
|
|
||||||
|
|
||||||
def get_exchange_bad_reason(exchange: str) -> str:
|
def get_exchange_bad_reason(exchange: str) -> str:
|
||||||
return BAD_EXCHANGES.get(exchange)
|
return BAD_EXCHANGES.get(exchange, "")
|
||||||
|
|
||||||
|
|
||||||
def is_exchange_available(exchange: str, ccxt_module=None) -> bool:
|
def is_exchange_available(exchange: str, ccxt_module=None) -> bool:
|
||||||
|
@ -499,9 +499,9 @@ def test_check_exchange(default_conf, caplog) -> None:
|
|||||||
|
|
||||||
# Test a 'bad' exchange, which known to have serious problems
|
# Test a 'bad' exchange, which known to have serious problems
|
||||||
default_conf.get('exchange').update({'name': 'bitmex'})
|
default_conf.get('exchange').update({'name': 'bitmex'})
|
||||||
assert not check_exchange(default_conf)
|
with pytest.raises(OperationalException,
|
||||||
assert log_has_re(r"Exchange .* is known to not work with the bot yet\. "
|
match=r"Exchange .* is known to not work with the bot yet.*"):
|
||||||
r"Use it only for development and testing purposes\.", caplog)
|
check_exchange(default_conf)
|
||||||
caplog.clear()
|
caplog.clear()
|
||||||
|
|
||||||
# Test a 'bad' exchange with check_for_bad=False
|
# Test a 'bad' exchange with check_for_bad=False
|
||||||
|
Loading…
Reference in New Issue
Block a user