Apply isort to tests
This commit is contained in:
parent
253b7b763e
commit
9df366d943
@ -4,10 +4,8 @@ from unittest.mock import MagicMock
|
|||||||
import pytest
|
import pytest
|
||||||
import rapidjson
|
import rapidjson
|
||||||
|
|
||||||
from freqtrade.commands.build_config_commands import (ask_user_config,
|
from freqtrade.commands.build_config_commands import (ask_user_config, ask_user_overwrite,
|
||||||
ask_user_overwrite,
|
start_new_config, validate_is_float,
|
||||||
start_new_config,
|
|
||||||
validate_is_float,
|
|
||||||
validate_is_int)
|
validate_is_int)
|
||||||
from freqtrade.exceptions import OperationalException
|
from freqtrade.exceptions import OperationalException
|
||||||
from tests.conftest import get_args, log_has_re
|
from tests.conftest import get_args, log_has_re
|
||||||
|
@ -5,19 +5,16 @@ from unittest.mock import MagicMock, PropertyMock
|
|||||||
import arrow
|
import arrow
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from freqtrade.commands import (start_convert_data, start_create_userdir,
|
from freqtrade.commands import (start_convert_data, start_create_userdir, start_download_data,
|
||||||
start_download_data, start_hyperopt_list,
|
start_hyperopt_list, start_hyperopt_show, start_list_data,
|
||||||
start_hyperopt_show, start_list_data,
|
start_list_exchanges, start_list_hyperopts, start_list_markets,
|
||||||
start_list_exchanges, start_list_hyperopts,
|
start_list_strategies, start_list_timeframes, start_new_hyperopt,
|
||||||
start_list_markets, start_list_strategies,
|
start_new_strategy, start_show_trades, start_test_pairlist,
|
||||||
start_list_timeframes, start_new_hyperopt,
|
start_trading)
|
||||||
start_new_strategy, start_show_trades,
|
|
||||||
start_test_pairlist, start_trading)
|
|
||||||
from freqtrade.configuration import setup_utils_configuration
|
from freqtrade.configuration import setup_utils_configuration
|
||||||
from freqtrade.exceptions import OperationalException
|
from freqtrade.exceptions import OperationalException
|
||||||
from freqtrade.state import RunMode
|
from freqtrade.state import RunMode
|
||||||
from tests.conftest import (create_mock_trades, get_args, log_has, log_has_re,
|
from tests.conftest import (create_mock_trades, get_args, log_has, log_has_re, patch_exchange,
|
||||||
patch_exchange,
|
|
||||||
patched_configuration_load_config_file)
|
patched_configuration_load_config_file)
|
||||||
from tests.conftest_trades import MOCK_TRADE_COUNT
|
from tests.conftest_trades import MOCK_TRADE_COUNT
|
||||||
|
|
||||||
|
@ -22,8 +22,9 @@ from freqtrade.freqtradebot import FreqtradeBot
|
|||||||
from freqtrade.persistence import Trade
|
from freqtrade.persistence import Trade
|
||||||
from freqtrade.resolvers import ExchangeResolver
|
from freqtrade.resolvers import ExchangeResolver
|
||||||
from freqtrade.worker import Worker
|
from freqtrade.worker import Worker
|
||||||
from tests.conftest_trades import (mock_trade_1, mock_trade_2, mock_trade_3,
|
from tests.conftest_trades import (mock_trade_1, mock_trade_2, mock_trade_3, mock_trade_4,
|
||||||
mock_trade_4, mock_trade_5, mock_trade_6)
|
mock_trade_5, mock_trade_6)
|
||||||
|
|
||||||
|
|
||||||
logging.getLogger('').setLevel(logging.INFO)
|
logging.getLogger('').setLevel(logging.INFO)
|
||||||
|
|
||||||
|
@ -7,16 +7,11 @@ from pandas import DataFrame, DateOffset, Timestamp, to_datetime
|
|||||||
|
|
||||||
from freqtrade.configuration import TimeRange
|
from freqtrade.configuration import TimeRange
|
||||||
from freqtrade.constants import LAST_BT_RESULT_FN
|
from freqtrade.constants import LAST_BT_RESULT_FN
|
||||||
from freqtrade.data.btanalysis import (BT_DATA_COLUMNS,
|
from freqtrade.data.btanalysis import (BT_DATA_COLUMNS, analyze_trade_parallelism,
|
||||||
analyze_trade_parallelism,
|
calculate_market_change, calculate_max_drawdown,
|
||||||
calculate_market_change,
|
combine_dataframes_with_mean, create_cum_profit,
|
||||||
calculate_max_drawdown,
|
extract_trades_of_period, get_latest_backtest_filename,
|
||||||
combine_dataframes_with_mean,
|
load_backtest_data, load_trades, load_trades_from_db)
|
||||||
create_cum_profit,
|
|
||||||
extract_trades_of_period,
|
|
||||||
get_latest_backtest_filename,
|
|
||||||
load_backtest_data, load_trades,
|
|
||||||
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.optimize.backtesting import BacktestResult
|
from freqtrade.optimize.backtesting import BacktestResult
|
||||||
from tests.conftest import create_mock_trades
|
from tests.conftest import create_mock_trades
|
||||||
|
@ -2,13 +2,11 @@
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
from freqtrade.configuration.timerange import TimeRange
|
from freqtrade.configuration.timerange import TimeRange
|
||||||
from freqtrade.data.converter import (convert_ohlcv_format,
|
from freqtrade.data.converter import (convert_ohlcv_format, convert_trades_format,
|
||||||
convert_trades_format,
|
ohlcv_fill_up_missing_data, ohlcv_to_dataframe,
|
||||||
ohlcv_fill_up_missing_data,
|
trades_dict_to_list, trades_remove_duplicates, trim_dataframe)
|
||||||
ohlcv_to_dataframe, trades_dict_to_list,
|
from freqtrade.data.history import (get_timerange, load_data, load_pair_history,
|
||||||
trades_remove_duplicates, trim_dataframe)
|
validate_backtest_data)
|
||||||
from freqtrade.data.history import (get_timerange, load_data,
|
|
||||||
load_pair_history, validate_backtest_data)
|
|
||||||
from tests.conftest import log_has
|
from tests.conftest import log_has
|
||||||
from tests.data.test_history import _backup_file, _clean_test_file
|
from tests.data.test_history import _backup_file, _clean_test_file
|
||||||
|
|
||||||
|
@ -15,20 +15,19 @@ from freqtrade.configuration import TimeRange
|
|||||||
from freqtrade.constants import AVAILABLE_DATAHANDLERS
|
from freqtrade.constants import AVAILABLE_DATAHANDLERS
|
||||||
from freqtrade.data.converter import ohlcv_to_dataframe
|
from freqtrade.data.converter import ohlcv_to_dataframe
|
||||||
from freqtrade.data.history.hdf5datahandler import HDF5DataHandler
|
from freqtrade.data.history.hdf5datahandler import HDF5DataHandler
|
||||||
from freqtrade.data.history.history_utils import (
|
from freqtrade.data.history.history_utils import (_download_pair_history, _download_trades_history,
|
||||||
_download_pair_history, _download_trades_history,
|
_load_cached_data_for_updating,
|
||||||
_load_cached_data_for_updating, convert_trades_to_ohlcv, get_timerange,
|
convert_trades_to_ohlcv, get_timerange, load_data,
|
||||||
load_data, load_pair_history, refresh_backtest_ohlcv_data,
|
load_pair_history, refresh_backtest_ohlcv_data,
|
||||||
refresh_backtest_trades_data, refresh_data, validate_backtest_data)
|
refresh_backtest_trades_data, refresh_data,
|
||||||
from freqtrade.data.history.idatahandler import (IDataHandler, get_datahandler,
|
validate_backtest_data)
|
||||||
get_datahandlerclass)
|
from freqtrade.data.history.idatahandler import IDataHandler, get_datahandler, get_datahandlerclass
|
||||||
from freqtrade.data.history.jsondatahandler import (JsonDataHandler,
|
from freqtrade.data.history.jsondatahandler import JsonDataHandler, JsonGzDataHandler
|
||||||
JsonGzDataHandler)
|
|
||||||
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.resolvers import StrategyResolver
|
from freqtrade.resolvers import StrategyResolver
|
||||||
from tests.conftest import (get_patched_exchange, log_has, log_has_re,
|
from tests.conftest import get_patched_exchange, log_has, log_has_re, patch_exchange
|
||||||
patch_exchange)
|
|
||||||
|
|
||||||
# Change this if modifying UNITTEST/BTC testdatafile
|
# Change this if modifying UNITTEST/BTC testdatafile
|
||||||
_BTC_UNITTEST_LENGTH = 13681
|
_BTC_UNITTEST_LENGTH = 13681
|
||||||
|
@ -10,14 +10,15 @@ import numpy as np
|
|||||||
import pytest
|
import pytest
|
||||||
from pandas import DataFrame, to_datetime
|
from pandas import DataFrame, to_datetime
|
||||||
|
|
||||||
from freqtrade.exceptions import OperationalException
|
|
||||||
from freqtrade.data.converter import ohlcv_to_dataframe
|
from freqtrade.data.converter import ohlcv_to_dataframe
|
||||||
from freqtrade.edge import Edge, PairInfo
|
from freqtrade.edge import Edge, PairInfo
|
||||||
|
from freqtrade.exceptions import OperationalException
|
||||||
from freqtrade.strategy.interface import SellType
|
from freqtrade.strategy.interface import SellType
|
||||||
from tests.conftest import get_patched_freqtradebot, log_has
|
from tests.conftest import get_patched_freqtradebot, log_has
|
||||||
from tests.optimize import (BTContainer, BTrade, _build_backtest_dataframe,
|
from tests.optimize import (BTContainer, BTrade, _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
|
||||||
# 2) Two complete trades within dataframe (with sell hit for all)
|
# 2) Two complete trades within dataframe (with sell hit for all)
|
||||||
|
@ -4,8 +4,7 @@ from unittest.mock import MagicMock
|
|||||||
import ccxt
|
import ccxt
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from freqtrade.exceptions import (DependencyException, InvalidOrderException,
|
from freqtrade.exceptions import DependencyException, InvalidOrderException, OperationalException
|
||||||
OperationalException)
|
|
||||||
from tests.conftest import get_patched_exchange
|
from tests.conftest import get_patched_exchange
|
||||||
from tests.exchange.test_exchange import ccxt_exceptionhandlers
|
from tests.exchange.test_exchange import ccxt_exceptionhandlers
|
||||||
|
|
||||||
|
@ -9,21 +9,18 @@ import ccxt
|
|||||||
import pytest
|
import pytest
|
||||||
from pandas import DataFrame
|
from pandas import DataFrame
|
||||||
|
|
||||||
from freqtrade.exceptions import (DDosProtection, DependencyException,
|
from freqtrade.exceptions import (DDosProtection, DependencyException, InvalidOrderException,
|
||||||
InvalidOrderException, OperationalException,
|
OperationalException, TemporaryError)
|
||||||
TemporaryError)
|
|
||||||
from freqtrade.exchange import Binance, Exchange, Kraken
|
from freqtrade.exchange import Binance, Exchange, Kraken
|
||||||
from freqtrade.exchange.common import (API_RETRY_COUNT, API_FETCH_ORDER_RETRY_COUNT,
|
from freqtrade.exchange.common import (API_FETCH_ORDER_RETRY_COUNT, API_RETRY_COUNT,
|
||||||
calculate_backoff)
|
calculate_backoff)
|
||||||
from freqtrade.exchange.exchange import (market_is_active,
|
from freqtrade.exchange.exchange import (market_is_active, timeframe_to_minutes, timeframe_to_msecs,
|
||||||
timeframe_to_minutes,
|
timeframe_to_next_date, timeframe_to_prev_date,
|
||||||
timeframe_to_msecs,
|
|
||||||
timeframe_to_next_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 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', 'ftx']
|
EXCHANGES = ['bittrex', 'binance', 'kraken', 'ftx']
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ from tests.conftest import get_patched_exchange
|
|||||||
|
|
||||||
from .test_exchange import ccxt_exceptionhandlers
|
from .test_exchange import ccxt_exceptionhandlers
|
||||||
|
|
||||||
|
|
||||||
STOPLOSS_ORDERTYPE = 'stop'
|
STOPLOSS_ORDERTYPE = 'stop'
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ from freqtrade.exceptions import DependencyException, InvalidOrderException
|
|||||||
from tests.conftest import get_patched_exchange
|
from tests.conftest import get_patched_exchange
|
||||||
from tests.exchange.test_exchange import ccxt_exceptionhandlers
|
from tests.exchange.test_exchange import ccxt_exceptionhandlers
|
||||||
|
|
||||||
|
|
||||||
STOPLOSS_ORDERTYPE = 'stop-loss'
|
STOPLOSS_ORDERTYPE = 'stop-loss'
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ from pandas import DataFrame
|
|||||||
from freqtrade.exchange import timeframe_to_minutes
|
from freqtrade.exchange import timeframe_to_minutes
|
||||||
from freqtrade.strategy.interface import SellType
|
from freqtrade.strategy.interface import SellType
|
||||||
|
|
||||||
|
|
||||||
tests_start_time = arrow.get(2018, 10, 3)
|
tests_start_time = arrow.get(2018, 10, 3)
|
||||||
tests_timeframe = '1h'
|
tests_timeframe = '1h'
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ from tests.conftest import patch_exchange
|
|||||||
from tests.optimize import (BTContainer, BTrade, _build_backtest_dataframe,
|
from tests.optimize import (BTContainer, BTrade, _build_backtest_dataframe,
|
||||||
_get_frame_time_from_offset, tests_timeframe)
|
_get_frame_time_from_offset, tests_timeframe)
|
||||||
|
|
||||||
|
|
||||||
# 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%
|
||||||
tc0 = BTContainer(data=[
|
tc0 = BTContainer(data=[
|
||||||
|
@ -10,8 +10,7 @@ import pytest
|
|||||||
from arrow import Arrow
|
from arrow import Arrow
|
||||||
|
|
||||||
from freqtrade import constants
|
from freqtrade import constants
|
||||||
from freqtrade.commands.optimize_commands import (setup_optimize_configuration,
|
from freqtrade.commands.optimize_commands import setup_optimize_configuration, start_backtesting
|
||||||
start_backtesting)
|
|
||||||
from freqtrade.configuration import TimeRange
|
from freqtrade.configuration import TimeRange
|
||||||
from freqtrade.data import history
|
from freqtrade.data import history
|
||||||
from freqtrade.data.btanalysis import BT_DATA_COLUMNS, evaluate_result_multi
|
from freqtrade.data.btanalysis import BT_DATA_COLUMNS, evaluate_result_multi
|
||||||
@ -26,6 +25,7 @@ from freqtrade.strategy.interface import SellType
|
|||||||
from tests.conftest import (get_args, log_has, log_has_re, patch_exchange,
|
from tests.conftest import (get_args, log_has, log_has_re, patch_exchange,
|
||||||
patched_configuration_load_config_file)
|
patched_configuration_load_config_file)
|
||||||
|
|
||||||
|
|
||||||
ORDER_TYPES = [
|
ORDER_TYPES = [
|
||||||
{
|
{
|
||||||
'buy': 'limit',
|
'buy': 'limit',
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
# pragma pylint: disable=missing-docstring,W0212,C0103
|
# pragma pylint: disable=missing-docstring,W0212,C0103
|
||||||
import locale
|
import locale
|
||||||
import logging
|
import logging
|
||||||
|
from copy import deepcopy
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from copy import deepcopy
|
|
||||||
from typing import Dict, List
|
from typing import Dict, List
|
||||||
from unittest.mock import MagicMock, PropertyMock
|
from unittest.mock import MagicMock, PropertyMock
|
||||||
|
|
||||||
@ -13,14 +13,12 @@ from arrow import Arrow
|
|||||||
from filelock import Timeout
|
from filelock import Timeout
|
||||||
|
|
||||||
from freqtrade import constants
|
from freqtrade import constants
|
||||||
from freqtrade.commands.optimize_commands import (setup_optimize_configuration,
|
from freqtrade.commands.optimize_commands import setup_optimize_configuration, start_hyperopt
|
||||||
start_hyperopt)
|
|
||||||
from freqtrade.data.history import load_data
|
from freqtrade.data.history import load_data
|
||||||
from freqtrade.exceptions import DependencyException, OperationalException
|
from freqtrade.exceptions import DependencyException, OperationalException
|
||||||
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 (HyperOptLossResolver,
|
from freqtrade.resolvers.hyperopt_resolver import HyperOptLossResolver, HyperOptResolver
|
||||||
HyperOptResolver)
|
|
||||||
from freqtrade.state import RunMode
|
from freqtrade.state import RunMode
|
||||||
from freqtrade.strategy.interface import SellType
|
from freqtrade.strategy.interface import SellType
|
||||||
from tests.conftest import (get_args, log_has, log_has_re, patch_exchange,
|
from tests.conftest import (get_args, log_has, log_has_re, patch_exchange,
|
||||||
|
@ -5,21 +5,17 @@ from pathlib import Path
|
|||||||
import pandas as pd
|
import pandas as pd
|
||||||
import pytest
|
import pytest
|
||||||
from arrow import Arrow
|
from arrow import Arrow
|
||||||
|
|
||||||
from freqtrade.configuration import TimeRange
|
from freqtrade.configuration import TimeRange
|
||||||
from freqtrade.constants import LAST_BT_RESULT_FN
|
from freqtrade.constants import LAST_BT_RESULT_FN
|
||||||
from freqtrade.data import history
|
from freqtrade.data import history
|
||||||
from freqtrade.data.btanalysis import (get_latest_backtest_filename,
|
from freqtrade.data.btanalysis import get_latest_backtest_filename, load_backtest_data
|
||||||
load_backtest_data)
|
|
||||||
from freqtrade.edge import PairInfo
|
from freqtrade.edge import PairInfo
|
||||||
from freqtrade.optimize.optimize_reports import (generate_backtest_stats,
|
from freqtrade.optimize.optimize_reports import (generate_backtest_stats, generate_daily_stats,
|
||||||
generate_daily_stats,
|
generate_edge_table, generate_pair_metrics,
|
||||||
generate_edge_table,
|
|
||||||
generate_pair_metrics,
|
|
||||||
generate_sell_reason_stats,
|
generate_sell_reason_stats,
|
||||||
generate_strategy_metrics,
|
generate_strategy_metrics, store_backtest_stats,
|
||||||
store_backtest_stats,
|
text_table_bt_results, text_table_sell_reason,
|
||||||
text_table_bt_results,
|
|
||||||
text_table_sell_reason,
|
|
||||||
text_table_strategy)
|
text_table_strategy)
|
||||||
from freqtrade.resolvers.strategy_resolver import StrategyResolver
|
from freqtrade.resolvers.strategy_resolver import StrategyResolver
|
||||||
from freqtrade.strategy.interface import SellType
|
from freqtrade.strategy.interface import SellType
|
||||||
|
@ -13,8 +13,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 tests.conftest import (create_mock_trades, get_patched_freqtradebot,
|
from tests.conftest import create_mock_trades, get_patched_freqtradebot, patch_get_signal
|
||||||
patch_get_signal)
|
|
||||||
|
|
||||||
|
|
||||||
# Functions for recurrent object patching
|
# Functions for recurrent object patching
|
||||||
|
@ -14,8 +14,8 @@ from freqtrade.loggers import setup_logging, setup_logging_pre
|
|||||||
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 tests.conftest import (create_mock_trades, get_patched_freqtradebot,
|
from tests.conftest import create_mock_trades, get_patched_freqtradebot, log_has, patch_get_signal
|
||||||
log_has, patch_get_signal)
|
|
||||||
|
|
||||||
_TEST_USER = "FreqTrader"
|
_TEST_USER = "FreqTrader"
|
||||||
_TEST_PASS = "SuperSecurePassword1!"
|
_TEST_PASS = "SuperSecurePassword1!"
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
# pragma pylint: disable=missing-docstring, C0103
|
# pragma pylint: disable=missing-docstring, C0103
|
||||||
import time
|
|
||||||
import logging
|
import logging
|
||||||
|
import time
|
||||||
from unittest.mock import MagicMock
|
from unittest.mock import MagicMock
|
||||||
|
|
||||||
from freqtrade.rpc import RPCMessageType, RPCManager
|
from freqtrade.rpc import RPCManager, RPCMessageType
|
||||||
from tests.conftest import log_has, get_patched_freqtradebot
|
from tests.conftest import get_patched_freqtradebot, log_has
|
||||||
|
|
||||||
|
|
||||||
def test__init__(mocker, default_conf) -> None:
|
def test__init__(mocker, default_conf) -> None:
|
||||||
|
@ -23,9 +23,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 tests.conftest import (create_mock_trades, get_patched_freqtradebot,
|
from tests.conftest import (create_mock_trades, get_patched_freqtradebot, log_has, patch_exchange,
|
||||||
log_has, patch_exchange, patch_get_signal,
|
patch_get_signal, patch_whitelist)
|
||||||
patch_whitelist)
|
|
||||||
|
|
||||||
|
|
||||||
class DummyCls(Telegram):
|
class DummyCls(Telegram):
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
|
|
||||||
# --- Do not remove these libs ---
|
# --- Do not remove these libs ---
|
||||||
from freqtrade.strategy.interface import IStrategy
|
|
||||||
from pandas import DataFrame
|
|
||||||
# --------------------------------
|
|
||||||
|
|
||||||
# Add your lib to import here
|
# Add your lib to import here
|
||||||
import talib.abstract as ta
|
import talib.abstract as ta
|
||||||
|
from pandas import DataFrame
|
||||||
|
|
||||||
|
from freqtrade.strategy.interface import IStrategy
|
||||||
|
|
||||||
|
|
||||||
|
# --------------------------------
|
||||||
|
|
||||||
# This class is a sample. Feel free to customize it.
|
# This class is a sample. Feel free to customize it.
|
||||||
class TestStrategyLegacy(IStrategy):
|
class TestStrategyLegacy(IStrategy):
|
||||||
|
@ -19,6 +19,7 @@ from tests.conftest import log_has, log_has_re
|
|||||||
|
|
||||||
from .strats.default_strategy import DefaultStrategy
|
from .strats.default_strategy import DefaultStrategy
|
||||||
|
|
||||||
|
|
||||||
# Avoid to reinit the same object again and again
|
# Avoid to reinit the same object again and again
|
||||||
_STRATEGY = DefaultStrategy(config={})
|
_STRATEGY = DefaultStrategy(config={})
|
||||||
_STRATEGY.dp = DataProvider({}, None, None)
|
_STRATEGY.dp = DataProvider({}, None, None)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import pandas as pd
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
import pandas as pd
|
||||||
|
|
||||||
from freqtrade.strategy import merge_informative_pair, timeframe_to_minutes
|
from freqtrade.strategy import merge_informative_pair, timeframe_to_minutes
|
||||||
|
|
||||||
|
@ -11,20 +11,18 @@ import pytest
|
|||||||
from jsonschema import ValidationError
|
from jsonschema import ValidationError
|
||||||
|
|
||||||
from freqtrade.commands import Arguments
|
from freqtrade.commands import Arguments
|
||||||
from freqtrade.configuration import (Configuration, check_exchange,
|
from freqtrade.configuration import (Configuration, check_exchange, remove_credentials,
|
||||||
remove_credentials,
|
|
||||||
validate_config_consistency)
|
validate_config_consistency)
|
||||||
from freqtrade.configuration.config_validation import validate_config_schema
|
from freqtrade.configuration.config_validation import validate_config_schema
|
||||||
from freqtrade.configuration.deprecated_settings import (
|
from freqtrade.configuration.deprecated_settings import (check_conflicting_settings,
|
||||||
check_conflicting_settings, process_deprecated_setting,
|
process_deprecated_setting,
|
||||||
process_temporary_deprecated_settings)
|
process_temporary_deprecated_settings)
|
||||||
from freqtrade.configuration.load_config import load_config_file, log_config_error_range
|
from freqtrade.configuration.load_config import load_config_file, log_config_error_range
|
||||||
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.exceptions import OperationalException
|
from freqtrade.exceptions import OperationalException
|
||||||
from freqtrade.loggers import _set_loggers, setup_logging, setup_logging_pre
|
from freqtrade.loggers import _set_loggers, setup_logging, setup_logging_pre
|
||||||
from freqtrade.state import RunMode
|
from freqtrade.state import RunMode
|
||||||
from 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")
|
||||||
|
@ -4,8 +4,7 @@ from unittest.mock import MagicMock
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from freqtrade.configuration.directory_operations import (copy_sample_files,
|
from freqtrade.configuration.directory_operations import (copy_sample_files, create_datadir,
|
||||||
create_datadir,
|
|
||||||
create_userdata_dir)
|
create_userdata_dir)
|
||||||
from freqtrade.exceptions import OperationalException
|
from freqtrade.exceptions import OperationalException
|
||||||
from tests.conftest import log_has, log_has_re
|
from tests.conftest import log_has, log_has_re
|
||||||
|
@ -10,12 +10,10 @@ from unittest.mock import ANY, MagicMock, PropertyMock
|
|||||||
import arrow
|
import arrow
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from freqtrade.constants import (CANCEL_REASON, MATH_CLOSE_PREC,
|
from freqtrade.constants import CANCEL_REASON, MATH_CLOSE_PREC, UNLIMITED_STAKE_AMOUNT
|
||||||
UNLIMITED_STAKE_AMOUNT)
|
from freqtrade.exceptions import (DependencyException, ExchangeError, InsufficientFundsError,
|
||||||
from freqtrade.exceptions import (DependencyException, ExchangeError,
|
InvalidOrderException, OperationalException, PricingError,
|
||||||
InsufficientFundsError,
|
TemporaryError)
|
||||||
InvalidOrderException, OperationalException,
|
|
||||||
PricingError, TemporaryError)
|
|
||||||
from freqtrade.freqtradebot import FreqtradeBot
|
from freqtrade.freqtradebot import FreqtradeBot
|
||||||
from freqtrade.persistence import Trade
|
from freqtrade.persistence import Trade
|
||||||
from freqtrade.persistence.models import Order
|
from freqtrade.persistence.models import Order
|
||||||
@ -23,15 +21,12 @@ from freqtrade.rpc import RPCMessageType
|
|||||||
from freqtrade.state import RunMode, State
|
from freqtrade.state import RunMode, State
|
||||||
from freqtrade.strategy.interface import SellCheckTuple, SellType
|
from freqtrade.strategy.interface import SellCheckTuple, SellType
|
||||||
from freqtrade.worker import Worker
|
from freqtrade.worker import Worker
|
||||||
from tests.conftest import (create_mock_trades, get_patched_freqtradebot,
|
from tests.conftest import (create_mock_trades, get_patched_freqtradebot, get_patched_worker,
|
||||||
get_patched_worker, log_has, log_has_re,
|
log_has, log_has_re, patch_edge, patch_exchange, patch_get_signal,
|
||||||
patch_edge, patch_exchange, patch_get_signal,
|
|
||||||
patch_wallet, patch_whitelist)
|
patch_wallet, patch_whitelist)
|
||||||
from tests.conftest_trades import (MOCK_TRADE_COUNT, mock_order_1,
|
from tests.conftest_trades import (MOCK_TRADE_COUNT, mock_order_1, mock_order_2, mock_order_2_sell,
|
||||||
mock_order_2, mock_order_2_sell,
|
mock_order_3, mock_order_3_sell, mock_order_4,
|
||||||
mock_order_3, mock_order_3_sell,
|
mock_order_5_stoploss, mock_order_6_sell)
|
||||||
mock_order_4, mock_order_5_stoploss,
|
|
||||||
mock_order_6_sell)
|
|
||||||
|
|
||||||
|
|
||||||
def patch_RPCManager(mocker) -> MagicMock:
|
def patch_RPCManager(mocker) -> MagicMock:
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import freqtrade.vendor.qtpylib.indicators as qtpylib
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
|
||||||
|
import freqtrade.vendor.qtpylib.indicators as qtpylib
|
||||||
|
|
||||||
|
|
||||||
def test_crossed_numpy_types():
|
def test_crossed_numpy_types():
|
||||||
"""
|
"""
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
# pragma pylint: disable=missing-docstring
|
# pragma pylint: disable=missing-docstring
|
||||||
|
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
|
from pathlib import Path
|
||||||
from unittest.mock import MagicMock, PropertyMock
|
from unittest.mock import MagicMock, PropertyMock
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from pathlib import Path
|
|
||||||
from freqtrade.commands import Arguments
|
from freqtrade.commands import Arguments
|
||||||
from freqtrade.exceptions import FreqtradeException, OperationalException
|
from freqtrade.exceptions import FreqtradeException, OperationalException
|
||||||
from freqtrade.freqtradebot import FreqtradeBot
|
from freqtrade.freqtradebot import FreqtradeBot
|
||||||
|
@ -7,9 +7,8 @@ from unittest.mock import MagicMock
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from freqtrade.data.converter import ohlcv_to_dataframe
|
from freqtrade.data.converter import ohlcv_to_dataframe
|
||||||
from freqtrade.misc import (datesarray_to_datetimearray, file_dump_json,
|
from freqtrade.misc import (datesarray_to_datetimearray, file_dump_json, file_load_json,
|
||||||
file_load_json, format_ms_time, pair_to_filename,
|
format_ms_time, pair_to_filename, plural, render_template,
|
||||||
plural, render_template,
|
|
||||||
render_template_with_fallback, safe_value_fallback,
|
render_template_with_fallback, safe_value_fallback,
|
||||||
safe_value_fallback2, shorten_date)
|
safe_value_fallback2, shorten_date)
|
||||||
|
|
||||||
|
@ -13,13 +13,10 @@ from freqtrade.configuration import TimeRange
|
|||||||
from freqtrade.data import history
|
from freqtrade.data import history
|
||||||
from freqtrade.data.btanalysis import create_cum_profit, load_backtest_data
|
from freqtrade.data.btanalysis import create_cum_profit, load_backtest_data
|
||||||
from freqtrade.exceptions import OperationalException
|
from freqtrade.exceptions import OperationalException
|
||||||
from freqtrade.plot.plotting import (add_indicators, add_profit,
|
from freqtrade.plot.plotting import (add_indicators, add_profit, create_plotconfig,
|
||||||
create_plotconfig,
|
generate_candlestick_graph, generate_plot_filename,
|
||||||
generate_candlestick_graph,
|
generate_profit_graph, init_plotscript, load_and_plot_trades,
|
||||||
generate_plot_filename,
|
plot_profit, plot_trades, store_plot_file)
|
||||||
generate_profit_graph, init_plotscript,
|
|
||||||
load_and_plot_trades, plot_profit,
|
|
||||||
plot_trades, store_plot_file)
|
|
||||||
from freqtrade.resolvers import StrategyResolver
|
from freqtrade.resolvers import StrategyResolver
|
||||||
from tests.conftest import get_args, log_has, log_has_re, patch_exchange
|
from tests.conftest import get_args, log_has, log_has_re, patch_exchange
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import talib.abstract as ta
|
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
import talib.abstract as ta
|
||||||
|
|
||||||
|
|
||||||
def test_talib_bollingerbands_near_zero_values():
|
def test_talib_bollingerbands_near_zero_values():
|
||||||
|
Loading…
Reference in New Issue
Block a user