Ejemplo n.º 1
0
def test_check_exchange(default_conf, caplog) -> None:
    configuration = Configuration(Namespace())

    # Test a valid exchange
    default_conf.get('exchange').update({'name': 'BITTREX'})
    assert configuration.check_exchange(default_conf)

    # Test a valid exchange
    default_conf.get('exchange').update({'name': 'binance'})
    assert configuration.check_exchange(default_conf)

    # Test a invalid exchange
    default_conf.get('exchange').update({'name': 'unknown_exchange'})
    configuration.config = default_conf

    with pytest.raises(OperationalException,
                       match=r'.*Exchange "unknown_exchange" not supported.*'):
        configuration.check_exchange(default_conf)

    # Test ccxt_rate_limit depreciation
    default_conf.get('exchange').update({'name': 'binance'})
    default_conf['exchange']['ccxt_rate_limit'] = True
    configuration.check_exchange(default_conf)
    assert log_has(
        "`ccxt_rate_limit` has been deprecated in favor of "
        "`ccxt_config` and `ccxt_async_config` and will be removed "
        "in a future version.", caplog.record_tuples)
Ejemplo n.º 2
0
def test_check_exchange(default_conf, caplog) -> None:
    configuration = Configuration(Namespace())

    # Test an officially supported by Freqtrade team exchange
    default_conf.get('exchange').update({'name': 'BITTREX'})
    assert configuration.check_exchange(default_conf)
    assert log_has_re(
        r"Exchange .* is officially supported by the Freqtrade development team\.",
        caplog.record_tuples)
    caplog.clear()

    # Test an officially supported by Freqtrade team exchange
    default_conf.get('exchange').update({'name': 'binance'})
    assert configuration.check_exchange(default_conf)
    assert log_has_re(
        r"Exchange .* is officially supported by the Freqtrade development team\.",
        caplog.record_tuples)
    caplog.clear()

    # Test an available exchange, supported by ccxt
    default_conf.get('exchange').update({'name': 'kraken'})
    assert configuration.check_exchange(default_conf)
    assert log_has_re(
        r"Exchange .* is supported by ccxt and .* not officially supported "
        r"by the Freqtrade development team\. .*", caplog.record_tuples)
    caplog.clear()

    # Test a 'bad' exchange, which known to have serious problems
    default_conf.get('exchange').update({'name': 'bitmex'})
    assert not configuration.check_exchange(default_conf)
    assert log_has_re(
        r"Exchange .* is known to not work with the bot yet\. "
        r"Use it only for development and testing purposes\.",
        caplog.record_tuples)
    caplog.clear()

    # Test a 'bad' exchange with check_for_bad=False
    default_conf.get('exchange').update({'name': 'bitmex'})
    assert configuration.check_exchange(default_conf, False)
    assert log_has_re(
        r"Exchange .* is supported by ccxt and .* not officially supported "
        r"by the Freqtrade development team\. .*", caplog.record_tuples)
    caplog.clear()

    # Test an invalid exchange
    default_conf.get('exchange').update({'name': 'unknown_exchange'})
    configuration.config = default_conf

    with pytest.raises(
            OperationalException,
            match=r'.*Exchange "unknown_exchange" is not supported by ccxt '
            r'and therefore not available for the bot.*'):
        configuration.check_exchange(default_conf)
def test_check_exchange(default_conf, caplog) -> None:
    configuration = Configuration(Namespace())

    # Test a valid exchange
    default_conf.get('exchange').update({'name': 'BITTREX'})
    assert configuration.check_exchange(default_conf)

    # Test a valid exchange
    default_conf.get('exchange').update({'name': 'binance'})
    assert configuration.check_exchange(default_conf)

    # Test a invalid exchange
    default_conf.get('exchange').update({'name': 'unknown_exchange'})
    configuration.config = default_conf

    with pytest.raises(OperationalException,
                       match=r'.*Exchange "unknown_exchange" not supported.*'):
        configuration.check_exchange(default_conf)
Ejemplo n.º 4
0
def test_check_exchange(default_conf) -> None:
    """
    Test the configuration validator with a missing attribute
    """
    conf = deepcopy(default_conf)
    configuration = Configuration(Namespace())

    # Test a valid exchange
    conf.get('exchange').update({'name': 'BITTREX'})
    assert configuration.check_exchange(conf)

    # Test a valid exchange
    conf.get('exchange').update({'name': 'binance'})
    assert configuration.check_exchange(conf)

    # Test a invalid exchange
    conf.get('exchange').update({'name': 'unknown_exchange'})
    configuration.config = conf

    with pytest.raises(OperationalException,
                       match=r'.*Exchange "unknown_exchange" not supported.*'):
        configuration.check_exchange(conf)