Adjust imports in tests to new path
This commit is contained in:
parent
65a516e229
commit
26d76cdb19
@ -891,8 +891,8 @@ def tickers():
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def result():
|
def result(testdatadir):
|
||||||
with Path('freqtrade/tests/testdata/UNITTEST_BTC-1m.json').open('r') as data_file:
|
with (testdatadir / 'UNITTEST_BTC-1m.json').open('r') as data_file:
|
||||||
return parse_ticker_dataframe(json.load(data_file), '1m', pair="UNITTEST/BTC",
|
return parse_ticker_dataframe(json.load(data_file), '1m', pair="UNITTEST/BTC",
|
||||||
fill_missing=True)
|
fill_missing=True)
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ from freqtrade.data.btanalysis import (BT_DATA_COLUMNS,
|
|||||||
load_backtest_data, load_trades,
|
load_backtest_data, load_trades,
|
||||||
load_trades_from_db)
|
load_trades_from_db)
|
||||||
from freqtrade.data.history import load_data, load_pair_history
|
from freqtrade.data.history import load_data, load_pair_history
|
||||||
from freqtrade.tests.test_persistence import create_mock_trades
|
from tests.test_persistence import create_mock_trades
|
||||||
|
|
||||||
|
|
||||||
def test_load_backtest_data(testdatadir):
|
def test_load_backtest_data(testdatadir):
|
||||||
|
@ -3,7 +3,7 @@ import logging
|
|||||||
|
|
||||||
from freqtrade.data.converter import parse_ticker_dataframe, ohlcv_fill_up_missing_data
|
from freqtrade.data.converter import parse_ticker_dataframe, ohlcv_fill_up_missing_data
|
||||||
from freqtrade.data.history import load_pair_history, validate_backtest_data, get_timeframe
|
from freqtrade.data.history import load_pair_history, validate_backtest_data, get_timeframe
|
||||||
from freqtrade.tests.conftest import log_has
|
from tests.conftest import log_has
|
||||||
|
|
||||||
|
|
||||||
def test_dataframe_correct_columns(result):
|
def test_dataframe_correct_columns(result):
|
||||||
|
@ -4,7 +4,7 @@ from pandas import DataFrame
|
|||||||
|
|
||||||
from freqtrade.data.dataprovider import DataProvider
|
from freqtrade.data.dataprovider import DataProvider
|
||||||
from freqtrade.state import RunMode
|
from freqtrade.state import RunMode
|
||||||
from freqtrade.tests.conftest import get_patched_exchange
|
from tests.conftest import get_patched_exchange
|
||||||
|
|
||||||
|
|
||||||
def test_ohlcv(mocker, default_conf, ticker_history):
|
def test_ohlcv(mocker, default_conf, ticker_history):
|
||||||
|
@ -22,7 +22,7 @@ from freqtrade.data.history import (download_pair_history,
|
|||||||
from freqtrade.exchange import timeframe_to_minutes
|
from freqtrade.exchange import timeframe_to_minutes
|
||||||
from freqtrade.misc import file_dump_json
|
from freqtrade.misc import file_dump_json
|
||||||
from freqtrade.strategy.default_strategy import DefaultStrategy
|
from freqtrade.strategy.default_strategy import DefaultStrategy
|
||||||
from freqtrade.tests.conftest import get_patched_exchange, log_has, log_has_re, patch_exchange
|
from tests.conftest import get_patched_exchange, log_has, log_has_re, patch_exchange
|
||||||
|
|
||||||
# Change this if modifying UNITTEST/BTC testdatafile
|
# Change this if modifying UNITTEST/BTC testdatafile
|
||||||
_BTC_UNITTEST_LENGTH = 13681
|
_BTC_UNITTEST_LENGTH = 13681
|
||||||
|
@ -14,10 +14,9 @@ from freqtrade import OperationalException
|
|||||||
from freqtrade.data.converter import parse_ticker_dataframe
|
from freqtrade.data.converter import parse_ticker_dataframe
|
||||||
from freqtrade.edge import Edge, PairInfo
|
from freqtrade.edge import Edge, PairInfo
|
||||||
from freqtrade.strategy.interface import SellType
|
from freqtrade.strategy.interface import SellType
|
||||||
from freqtrade.tests.conftest import get_patched_freqtradebot, log_has
|
from tests.conftest import get_patched_freqtradebot, log_has
|
||||||
from freqtrade.tests.optimize import (BTContainer, BTrade,
|
from tests.optimize import (BTContainer, BTrade, _build_backtest_dataframe,
|
||||||
_build_backtest_dataframe,
|
_get_frame_time_from_offset)
|
||||||
_get_frame_time_from_offset)
|
|
||||||
|
|
||||||
# Cases to be tested:
|
# Cases to be tested:
|
||||||
# 1) Open trade should be removed from the end
|
# 1) Open trade should be removed from the end
|
||||||
|
@ -6,7 +6,7 @@ import pytest
|
|||||||
|
|
||||||
from freqtrade import (DependencyException, InvalidOrderException,
|
from freqtrade import (DependencyException, InvalidOrderException,
|
||||||
OperationalException, TemporaryError)
|
OperationalException, TemporaryError)
|
||||||
from freqtrade.tests.conftest import get_patched_exchange
|
from tests.conftest import get_patched_exchange
|
||||||
|
|
||||||
|
|
||||||
def test_stoploss_limit_order(default_conf, mocker):
|
def test_stoploss_limit_order(default_conf, mocker):
|
||||||
|
@ -20,7 +20,7 @@ from freqtrade.exchange.exchange import (API_RETRY_COUNT, timeframe_to_minutes,
|
|||||||
timeframe_to_prev_date,
|
timeframe_to_prev_date,
|
||||||
timeframe_to_seconds)
|
timeframe_to_seconds)
|
||||||
from freqtrade.resolvers.exchange_resolver import ExchangeResolver
|
from freqtrade.resolvers.exchange_resolver import ExchangeResolver
|
||||||
from freqtrade.tests.conftest import get_patched_exchange, log_has, log_has_re
|
from tests.conftest import get_patched_exchange, log_has, log_has_re
|
||||||
|
|
||||||
# Make sure to always keep one exchange here which is NOT subclassed!!
|
# Make sure to always keep one exchange here which is NOT subclassed!!
|
||||||
EXCHANGES = ['bittrex', 'binance', 'kraken', ]
|
EXCHANGES = ['bittrex', 'binance', 'kraken', ]
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
from random import randint
|
from random import randint
|
||||||
from unittest.mock import MagicMock
|
from unittest.mock import MagicMock
|
||||||
|
|
||||||
from freqtrade.tests.conftest import get_patched_exchange
|
from tests.conftest import get_patched_exchange
|
||||||
|
|
||||||
|
|
||||||
def test_buy_kraken_trading_agreement(default_conf, mocker):
|
def test_buy_kraken_trading_agreement(default_conf, mocker):
|
||||||
|
@ -8,11 +8,9 @@ from pandas import DataFrame
|
|||||||
from freqtrade.data.history import get_timeframe
|
from freqtrade.data.history import get_timeframe
|
||||||
from freqtrade.optimize.backtesting import Backtesting
|
from freqtrade.optimize.backtesting import Backtesting
|
||||||
from freqtrade.strategy.interface import SellType
|
from freqtrade.strategy.interface import SellType
|
||||||
from freqtrade.tests.conftest import patch_exchange
|
from tests.conftest import patch_exchange
|
||||||
from freqtrade.tests.optimize import (BTContainer, BTrade,
|
from tests.optimize import (BTContainer, BTrade, _build_backtest_dataframe,
|
||||||
_build_backtest_dataframe,
|
_get_frame_time_from_offset, tests_ticker_interval)
|
||||||
_get_frame_time_from_offset,
|
|
||||||
tests_ticker_interval)
|
|
||||||
|
|
||||||
# Test 0: Sell with signal sell in candle 3
|
# Test 0: Sell with signal sell in candle 3
|
||||||
# Test with Stop-loss at 1%
|
# Test with Stop-loss at 1%
|
||||||
|
@ -22,9 +22,8 @@ from freqtrade.optimize.backtesting import Backtesting
|
|||||||
from freqtrade.state import RunMode
|
from freqtrade.state import RunMode
|
||||||
from freqtrade.strategy.default_strategy import DefaultStrategy
|
from freqtrade.strategy.default_strategy import DefaultStrategy
|
||||||
from freqtrade.strategy.interface import SellType
|
from freqtrade.strategy.interface import SellType
|
||||||
from freqtrade.tests.conftest import (get_args, log_has, log_has_re,
|
from tests.conftest import (get_args, log_has, log_has_re, patch_exchange,
|
||||||
patch_exchange,
|
patched_configuration_load_config_file)
|
||||||
patched_configuration_load_config_file)
|
|
||||||
|
|
||||||
|
|
||||||
def trim_dictlist(dict_list, num):
|
def trim_dictlist(dict_list, num):
|
||||||
@ -807,7 +806,7 @@ def test_backtest_record(default_conf, fee, mocker):
|
|||||||
assert dur > 0
|
assert dur > 0
|
||||||
|
|
||||||
|
|
||||||
def test_backtest_start_timerange(default_conf, mocker, caplog):
|
def test_backtest_start_timerange(default_conf, mocker, caplog, testdatadir):
|
||||||
default_conf['exchange']['pair_whitelist'] = ['UNITTEST/BTC']
|
default_conf['exchange']['pair_whitelist'] = ['UNITTEST/BTC']
|
||||||
|
|
||||||
async def load_pairs(pair, timeframe, since):
|
async def load_pairs(pair, timeframe, since):
|
||||||
@ -824,7 +823,7 @@ def test_backtest_start_timerange(default_conf, mocker, caplog):
|
|||||||
args = [
|
args = [
|
||||||
'--config', 'config.json',
|
'--config', 'config.json',
|
||||||
'--strategy', 'DefaultStrategy',
|
'--strategy', 'DefaultStrategy',
|
||||||
'--datadir', 'freqtrade/tests/testdata',
|
'--datadir', str(testdatadir),
|
||||||
'backtesting',
|
'backtesting',
|
||||||
'--ticker-interval', '1m',
|
'--ticker-interval', '1m',
|
||||||
'--timerange', '-100',
|
'--timerange', '-100',
|
||||||
@ -838,7 +837,7 @@ def test_backtest_start_timerange(default_conf, mocker, caplog):
|
|||||||
'Parameter -i/--ticker-interval detected ... Using ticker_interval: 1m ...',
|
'Parameter -i/--ticker-interval detected ... Using ticker_interval: 1m ...',
|
||||||
'Ignoring max_open_trades (--disable-max-market-positions was used) ...',
|
'Ignoring max_open_trades (--disable-max-market-positions was used) ...',
|
||||||
'Parameter --timerange detected: -100 ...',
|
'Parameter --timerange detected: -100 ...',
|
||||||
'Using data directory: freqtrade/tests/testdata ...',
|
f'Using data directory: {testdatadir} ...',
|
||||||
'Using stake_currency: BTC ...',
|
'Using stake_currency: BTC ...',
|
||||||
'Using stake_amount: 0.001 ...',
|
'Using stake_amount: 0.001 ...',
|
||||||
'Backtesting with data from 2017-11-14T21:17:00+00:00 '
|
'Backtesting with data from 2017-11-14T21:17:00+00:00 '
|
||||||
@ -850,7 +849,7 @@ def test_backtest_start_timerange(default_conf, mocker, caplog):
|
|||||||
assert log_has(line, caplog)
|
assert log_has(line, caplog)
|
||||||
|
|
||||||
|
|
||||||
def test_backtest_start_multi_strat(default_conf, mocker, caplog):
|
def test_backtest_start_multi_strat(default_conf, mocker, caplog, testdatadir):
|
||||||
default_conf['exchange']['pair_whitelist'] = ['UNITTEST/BTC']
|
default_conf['exchange']['pair_whitelist'] = ['UNITTEST/BTC']
|
||||||
|
|
||||||
async def load_pairs(pair, timeframe, since):
|
async def load_pairs(pair, timeframe, since):
|
||||||
@ -870,7 +869,7 @@ def test_backtest_start_multi_strat(default_conf, mocker, caplog):
|
|||||||
|
|
||||||
args = [
|
args = [
|
||||||
'--config', 'config.json',
|
'--config', 'config.json',
|
||||||
'--datadir', 'freqtrade/tests/testdata',
|
'--datadir', str(testdatadir),
|
||||||
'backtesting',
|
'backtesting',
|
||||||
'--ticker-interval', '1m',
|
'--ticker-interval', '1m',
|
||||||
'--timerange', '-100',
|
'--timerange', '-100',
|
||||||
@ -892,7 +891,7 @@ def test_backtest_start_multi_strat(default_conf, mocker, caplog):
|
|||||||
'Parameter -i/--ticker-interval detected ... Using ticker_interval: 1m ...',
|
'Parameter -i/--ticker-interval detected ... Using ticker_interval: 1m ...',
|
||||||
'Ignoring max_open_trades (--disable-max-market-positions was used) ...',
|
'Ignoring max_open_trades (--disable-max-market-positions was used) ...',
|
||||||
'Parameter --timerange detected: -100 ...',
|
'Parameter --timerange detected: -100 ...',
|
||||||
'Using data directory: freqtrade/tests/testdata ...',
|
f'Using data directory: {testdatadir} ...',
|
||||||
'Using stake_currency: BTC ...',
|
'Using stake_currency: BTC ...',
|
||||||
'Using stake_amount: 0.001 ...',
|
'Using stake_amount: 0.001 ...',
|
||||||
'Backtesting with data from 2017-11-14T21:17:00+00:00 '
|
'Backtesting with data from 2017-11-14T21:17:00+00:00 '
|
||||||
|
@ -9,9 +9,8 @@ from freqtrade.edge import PairInfo
|
|||||||
from freqtrade.optimize import setup_configuration, start_edge
|
from freqtrade.optimize import setup_configuration, start_edge
|
||||||
from freqtrade.optimize.edge_cli import EdgeCli
|
from freqtrade.optimize.edge_cli import EdgeCli
|
||||||
from freqtrade.state import RunMode
|
from freqtrade.state import RunMode
|
||||||
from freqtrade.tests.conftest import (get_args, log_has, log_has_re,
|
from tests.conftest import (get_args, log_has, log_has_re, patch_exchange,
|
||||||
patch_exchange,
|
patched_configuration_load_config_file)
|
||||||
patched_configuration_load_config_file)
|
|
||||||
|
|
||||||
|
|
||||||
def test_setup_configuration_without_arguments(mocker, default_conf, caplog) -> None:
|
def test_setup_configuration_without_arguments(mocker, default_conf, caplog) -> None:
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
# pragma pylint: disable=missing-docstring,W0212,C0103
|
# pragma pylint: disable=missing-docstring,W0212,C0103
|
||||||
import os
|
import os
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
from pathlib import Path
|
||||||
from unittest.mock import MagicMock, PropertyMock
|
from unittest.mock import MagicMock, PropertyMock
|
||||||
|
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import pytest
|
import pytest
|
||||||
from arrow import Arrow
|
from arrow import Arrow
|
||||||
from filelock import Timeout
|
from filelock import Timeout
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
from freqtrade import OperationalException
|
from freqtrade import OperationalException
|
||||||
from freqtrade.data.converter import parse_ticker_dataframe
|
from freqtrade.data.converter import parse_ticker_dataframe
|
||||||
@ -16,12 +16,12 @@ from freqtrade.optimize import setup_configuration, start_hyperopt
|
|||||||
from freqtrade.optimize.default_hyperopt import DefaultHyperOpts
|
from freqtrade.optimize.default_hyperopt import DefaultHyperOpts
|
||||||
from freqtrade.optimize.default_hyperopt_loss import DefaultHyperOptLoss
|
from freqtrade.optimize.default_hyperopt_loss import DefaultHyperOptLoss
|
||||||
from freqtrade.optimize.hyperopt import Hyperopt
|
from freqtrade.optimize.hyperopt import Hyperopt
|
||||||
from freqtrade.resolvers.hyperopt_resolver import HyperOptResolver, HyperOptLossResolver
|
from freqtrade.resolvers.hyperopt_resolver import (HyperOptLossResolver,
|
||||||
|
HyperOptResolver)
|
||||||
from freqtrade.state import RunMode
|
from freqtrade.state import RunMode
|
||||||
from freqtrade.strategy.interface import SellType
|
from freqtrade.strategy.interface import SellType
|
||||||
from freqtrade.tests.conftest import (get_args, log_has, log_has_re,
|
from tests.conftest import (get_args, log_has, log_has_re, patch_exchange,
|
||||||
patch_exchange,
|
patched_configuration_load_config_file)
|
||||||
patched_configuration_load_config_file)
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope='function')
|
@pytest.fixture(scope='function')
|
||||||
@ -47,14 +47,14 @@ def hyperopt_results():
|
|||||||
|
|
||||||
|
|
||||||
# Functions for recurrent object patching
|
# Functions for recurrent object patching
|
||||||
def create_trials(mocker, hyperopt) -> None:
|
def create_trials(mocker, hyperopt, testdatadir) -> None:
|
||||||
"""
|
"""
|
||||||
When creating trials, mock the hyperopt Trials so that *by default*
|
When creating trials, mock the hyperopt Trials so that *by default*
|
||||||
- we don't create any pickle'd files in the filesystem
|
- we don't create any pickle'd files in the filesystem
|
||||||
- we might have a pickle'd file so make sure that we return
|
- we might have a pickle'd file so make sure that we return
|
||||||
false when looking for it
|
false when looking for it
|
||||||
"""
|
"""
|
||||||
hyperopt.trials_file = Path('freqtrade/tests/optimize/ut_trials.pickle')
|
hyperopt.trials_file = testdatadir / '/optimize/ut_trials.pickle'
|
||||||
|
|
||||||
mocker.patch.object(Path, "is_file", MagicMock(return_value=False))
|
mocker.patch.object(Path, "is_file", MagicMock(return_value=False))
|
||||||
stat_mock = MagicMock()
|
stat_mock = MagicMock()
|
||||||
|
@ -5,7 +5,7 @@ from unittest.mock import MagicMock, PropertyMock
|
|||||||
from freqtrade import OperationalException
|
from freqtrade import OperationalException
|
||||||
from freqtrade.constants import AVAILABLE_PAIRLISTS
|
from freqtrade.constants import AVAILABLE_PAIRLISTS
|
||||||
from freqtrade.resolvers import PairListResolver
|
from freqtrade.resolvers import PairListResolver
|
||||||
from freqtrade.tests.conftest import get_patched_freqtradebot
|
from tests.conftest import get_patched_freqtradebot
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
# whitelist, blacklist
|
# whitelist, blacklist
|
||||||
|
@ -8,7 +8,7 @@ import pytest
|
|||||||
from requests.exceptions import RequestException
|
from requests.exceptions import RequestException
|
||||||
|
|
||||||
from freqtrade.rpc.fiat_convert import CryptoFiat, CryptoToFiatConverter
|
from freqtrade.rpc.fiat_convert import CryptoFiat, CryptoToFiatConverter
|
||||||
from freqtrade.tests.conftest import log_has
|
from tests.conftest import log_has
|
||||||
|
|
||||||
|
|
||||||
def test_pair_convertion_object():
|
def test_pair_convertion_object():
|
||||||
|
@ -14,7 +14,7 @@ from freqtrade.persistence import Trade
|
|||||||
from freqtrade.rpc import RPC, RPCException
|
from freqtrade.rpc import RPC, RPCException
|
||||||
from freqtrade.rpc.fiat_convert import CryptoToFiatConverter
|
from freqtrade.rpc.fiat_convert import CryptoToFiatConverter
|
||||||
from freqtrade.state import State
|
from freqtrade.state import State
|
||||||
from freqtrade.tests.conftest import patch_exchange, patch_get_signal
|
from tests.conftest import patch_exchange, patch_get_signal
|
||||||
|
|
||||||
|
|
||||||
# Functions for recurrent object patching
|
# Functions for recurrent object patching
|
||||||
|
@ -13,9 +13,7 @@ from freqtrade.__init__ import __version__
|
|||||||
from freqtrade.persistence import Trade
|
from freqtrade.persistence import Trade
|
||||||
from freqtrade.rpc.api_server import BASE_URI, ApiServer
|
from freqtrade.rpc.api_server import BASE_URI, ApiServer
|
||||||
from freqtrade.state import State
|
from freqtrade.state import State
|
||||||
from freqtrade.tests.conftest import (get_patched_freqtradebot, log_has,
|
from tests.conftest import get_patched_freqtradebot, log_has, patch_get_signal
|
||||||
patch_get_signal)
|
|
||||||
|
|
||||||
|
|
||||||
_TEST_USER = "FreqTrader"
|
_TEST_USER = "FreqTrader"
|
||||||
_TEST_PASS = "SuperSecurePassword1!"
|
_TEST_PASS = "SuperSecurePassword1!"
|
||||||
|
@ -4,7 +4,7 @@ import logging
|
|||||||
from unittest.mock import MagicMock
|
from unittest.mock import MagicMock
|
||||||
|
|
||||||
from freqtrade.rpc import RPCMessageType, RPCManager
|
from freqtrade.rpc import RPCMessageType, RPCManager
|
||||||
from freqtrade.tests.conftest import log_has, get_patched_freqtradebot
|
from tests.conftest import log_has, get_patched_freqtradebot
|
||||||
|
|
||||||
|
|
||||||
def test__init__(mocker, default_conf) -> None:
|
def test__init__(mocker, default_conf) -> None:
|
||||||
|
@ -21,8 +21,8 @@ from freqtrade.rpc import RPCMessageType
|
|||||||
from freqtrade.rpc.telegram import Telegram, authorized_only
|
from freqtrade.rpc.telegram import Telegram, authorized_only
|
||||||
from freqtrade.state import State
|
from freqtrade.state import State
|
||||||
from freqtrade.strategy.interface import SellType
|
from freqtrade.strategy.interface import SellType
|
||||||
from freqtrade.tests.conftest import (get_patched_freqtradebot, log_has,
|
from tests.conftest import (get_patched_freqtradebot, log_has, patch_exchange,
|
||||||
patch_exchange, patch_get_signal)
|
patch_get_signal)
|
||||||
|
|
||||||
|
|
||||||
class DummyCls(Telegram):
|
class DummyCls(Telegram):
|
||||||
|
@ -8,7 +8,7 @@ from requests import RequestException
|
|||||||
from freqtrade.rpc import RPCMessageType
|
from freqtrade.rpc import RPCMessageType
|
||||||
from freqtrade.rpc.webhook import Webhook
|
from freqtrade.rpc.webhook import Webhook
|
||||||
from freqtrade.strategy.interface import SellType
|
from freqtrade.strategy.interface import SellType
|
||||||
from freqtrade.tests.conftest import get_patched_freqtradebot, log_has
|
from tests.conftest import get_patched_freqtradebot, log_has
|
||||||
|
|
||||||
|
|
||||||
def get_webhook_dict() -> dict:
|
def get_webhook_dict() -> dict:
|
||||||
|
@ -1,19 +1,8 @@
|
|||||||
import json
|
|
||||||
|
|
||||||
import pytest
|
|
||||||
from pandas import DataFrame
|
from pandas import DataFrame
|
||||||
|
|
||||||
from freqtrade.data.converter import parse_ticker_dataframe
|
|
||||||
from freqtrade.strategy.default_strategy import DefaultStrategy
|
from freqtrade.strategy.default_strategy import DefaultStrategy
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def result():
|
|
||||||
with open('freqtrade/tests/testdata/ETH_BTC-1m.json') as data_file:
|
|
||||||
return parse_ticker_dataframe(json.load(data_file), '1m', pair="UNITTEST/BTC",
|
|
||||||
fill_missing=True)
|
|
||||||
|
|
||||||
|
|
||||||
def test_default_strategy_structure():
|
def test_default_strategy_structure():
|
||||||
assert hasattr(DefaultStrategy, 'minimal_roi')
|
assert hasattr(DefaultStrategy, 'minimal_roi')
|
||||||
assert hasattr(DefaultStrategy, 'stoploss')
|
assert hasattr(DefaultStrategy, 'stoploss')
|
||||||
|
@ -10,7 +10,7 @@ from freqtrade.configuration import TimeRange
|
|||||||
from freqtrade.data.converter import parse_ticker_dataframe
|
from freqtrade.data.converter import parse_ticker_dataframe
|
||||||
from freqtrade.data.history import load_tickerdata_file
|
from freqtrade.data.history import load_tickerdata_file
|
||||||
from freqtrade.persistence import Trade
|
from freqtrade.persistence import Trade
|
||||||
from freqtrade.tests.conftest import get_patched_exchange, log_has
|
from tests.conftest import get_patched_exchange, log_has
|
||||||
from freqtrade.strategy.default_strategy import DefaultStrategy
|
from freqtrade.strategy.default_strategy import DefaultStrategy
|
||||||
|
|
||||||
# Avoid to reinit the same object again and again
|
# Avoid to reinit the same object again and again
|
||||||
|
@ -12,12 +12,12 @@ from pandas import DataFrame
|
|||||||
from freqtrade import OperationalException
|
from freqtrade import OperationalException
|
||||||
from freqtrade.resolvers import StrategyResolver
|
from freqtrade.resolvers import StrategyResolver
|
||||||
from freqtrade.strategy.interface import IStrategy
|
from freqtrade.strategy.interface import IStrategy
|
||||||
from freqtrade.tests.conftest import log_has, log_has_re
|
from tests.conftest import log_has, log_has_re
|
||||||
|
|
||||||
|
|
||||||
def test_search_strategy():
|
def test_search_strategy():
|
||||||
default_config = {}
|
default_config = {}
|
||||||
default_location = Path(__file__).parent.parent.parent.joinpath('strategy').resolve()
|
default_location = Path(__file__).parent.parent.joinpath('strategy').resolve()
|
||||||
|
|
||||||
s, _ = StrategyResolver._search_object(
|
s, _ = StrategyResolver._search_object(
|
||||||
directory=default_location,
|
directory=default_location,
|
||||||
|
@ -10,7 +10,8 @@ import pytest
|
|||||||
from jsonschema import Draft4Validator, ValidationError, validate
|
from jsonschema import Draft4Validator, ValidationError, validate
|
||||||
|
|
||||||
from freqtrade import OperationalException, constants
|
from freqtrade import OperationalException, constants
|
||||||
from freqtrade.configuration import Arguments, Configuration, validate_config_consistency
|
from freqtrade.configuration import (Arguments, Configuration,
|
||||||
|
validate_config_consistency)
|
||||||
from freqtrade.configuration.check_exchange import check_exchange
|
from freqtrade.configuration.check_exchange import check_exchange
|
||||||
from freqtrade.configuration.config_validation import validate_config_schema
|
from freqtrade.configuration.config_validation import validate_config_schema
|
||||||
from freqtrade.configuration.directory_operations import (create_datadir,
|
from freqtrade.configuration.directory_operations import (create_datadir,
|
||||||
@ -19,8 +20,8 @@ from freqtrade.configuration.load_config import load_config_file
|
|||||||
from freqtrade.constants import DEFAULT_DB_DRYRUN_URL, DEFAULT_DB_PROD_URL
|
from freqtrade.constants import DEFAULT_DB_DRYRUN_URL, DEFAULT_DB_PROD_URL
|
||||||
from freqtrade.loggers import _set_loggers
|
from freqtrade.loggers import _set_loggers
|
||||||
from freqtrade.state import RunMode
|
from freqtrade.state import RunMode
|
||||||
from freqtrade.tests.conftest import (log_has, log_has_re,
|
from tests.conftest import (log_has, log_has_re,
|
||||||
patched_configuration_load_config_file)
|
patched_configuration_load_config_file)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="function")
|
@pytest.fixture(scope="function")
|
||||||
|
@ -16,13 +16,12 @@ from freqtrade.data.dataprovider import DataProvider
|
|||||||
from freqtrade.freqtradebot import FreqtradeBot
|
from freqtrade.freqtradebot import FreqtradeBot
|
||||||
from freqtrade.persistence import Trade
|
from freqtrade.persistence import Trade
|
||||||
from freqtrade.rpc import RPCMessageType
|
from freqtrade.rpc import RPCMessageType
|
||||||
from freqtrade.state import State, RunMode
|
from freqtrade.state import RunMode, State
|
||||||
from freqtrade.strategy.interface import SellCheckTuple, SellType
|
from freqtrade.strategy.interface import SellCheckTuple, SellType
|
||||||
from freqtrade.tests.conftest import (get_patched_freqtradebot,
|
|
||||||
get_patched_worker, log_has, log_has_re,
|
|
||||||
patch_edge, patch_exchange,
|
|
||||||
patch_get_signal, patch_wallet)
|
|
||||||
from freqtrade.worker import Worker
|
from freqtrade.worker import Worker
|
||||||
|
from tests.conftest import (get_patched_freqtradebot, get_patched_worker,
|
||||||
|
log_has, log_has_re, patch_edge, patch_exchange,
|
||||||
|
patch_get_signal, patch_wallet)
|
||||||
|
|
||||||
|
|
||||||
def patch_RPCManager(mocker) -> MagicMock:
|
def patch_RPCManager(mocker) -> MagicMock:
|
||||||
|
@ -10,7 +10,7 @@ from freqtrade.configuration import Arguments
|
|||||||
from freqtrade.freqtradebot import FreqtradeBot
|
from freqtrade.freqtradebot import FreqtradeBot
|
||||||
from freqtrade.main import main
|
from freqtrade.main import main
|
||||||
from freqtrade.state import State
|
from freqtrade.state import State
|
||||||
from freqtrade.tests.conftest import (log_has, patch_exchange,
|
from tests.conftest import (log_has, patch_exchange,
|
||||||
patched_configuration_load_config_file)
|
patched_configuration_load_config_file)
|
||||||
from freqtrade.worker import Worker
|
from freqtrade.worker import Worker
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ from sqlalchemy import create_engine
|
|||||||
|
|
||||||
from freqtrade import OperationalException, constants
|
from freqtrade import OperationalException, constants
|
||||||
from freqtrade.persistence import Trade, clean_dry_run_db, init
|
from freqtrade.persistence import Trade, clean_dry_run_db, init
|
||||||
from freqtrade.tests.conftest import log_has
|
from tests.conftest import log_has
|
||||||
|
|
||||||
|
|
||||||
def create_mock_trades(fee):
|
def create_mock_trades(fee):
|
||||||
|
@ -19,7 +19,7 @@ from freqtrade.plot.plotting import (add_indicators, add_profit,
|
|||||||
generate_profit_graph, init_plotscript,
|
generate_profit_graph, init_plotscript,
|
||||||
plot_profit, plot_trades, store_plot_file)
|
plot_profit, plot_trades, store_plot_file)
|
||||||
from freqtrade.strategy.default_strategy import DefaultStrategy
|
from freqtrade.strategy.default_strategy import DefaultStrategy
|
||||||
from freqtrade.tests.conftest import get_args, log_has, log_has_re
|
from tests.conftest import get_args, log_has, log_has_re
|
||||||
|
|
||||||
|
|
||||||
def fig_generating_mock(fig, *args, **kwargs):
|
def fig_generating_mock(fig, *args, **kwargs):
|
||||||
|
@ -4,7 +4,7 @@ from unittest.mock import MagicMock, PropertyMock
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from freqtrade.state import RunMode
|
from freqtrade.state import RunMode
|
||||||
from freqtrade.tests.conftest import get_args, log_has, patch_exchange
|
from tests.conftest import get_args, log_has, patch_exchange
|
||||||
from freqtrade.utils import (setup_utils_configuration, start_create_userdir,
|
from freqtrade.utils import (setup_utils_configuration, start_create_userdir,
|
||||||
start_download_data, start_list_exchanges)
|
start_download_data, start_list_exchanges)
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# pragma pylint: disable=missing-docstring
|
# pragma pylint: disable=missing-docstring
|
||||||
from freqtrade.tests.conftest import get_patched_freqtradebot
|
from tests.conftest import get_patched_freqtradebot
|
||||||
from unittest.mock import MagicMock
|
from unittest.mock import MagicMock
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user