optimize imports

This commit is contained in:
gcarq 2018-03-17 22:44:47 +01:00
parent d8689e5045
commit d2aea7bdc1
36 changed files with 101 additions and 69 deletions

View File

@ -4,12 +4,14 @@ Functions to analyze ticker data with indicators and produce buy and sell signal
from datetime import datetime, timedelta
from enum import Enum
from typing import Dict, List, Tuple
import arrow
from pandas import DataFrame, to_datetime
from freqtrade.exchange import get_ticker_history
from freqtrade.logger import Logger
from freqtrade.strategy.strategy import Strategy
from freqtrade.persistence import Trade
from freqtrade.strategy.strategy import Strategy
class SignalType(Enum):

View File

@ -3,9 +3,9 @@ This module contains the argument manager class
"""
import argparse
import logging
import os
import re
import logging
from typing import List, Tuple, Optional
from freqtrade import __version__

View File

@ -4,8 +4,8 @@ This module contains the configuration class
import json
from argparse import Namespace
from typing import Dict, Any
from jsonschema import Draft4Validator, validate
from jsonschema.exceptions import ValidationError, best_match

View File

@ -1,8 +1,8 @@
import logging
from typing import Dict, List, Optional
from bittrex.bittrex import Bittrex as _Bittrex
from bittrex.bittrex import API_V1_1, API_V2_0
from bittrex.bittrex import Bittrex as _Bittrex
from requests.exceptions import ContentDecodingError
from freqtrade import OperationalException

View File

@ -5,6 +5,7 @@ e.g BTC to USD
import logging
import time
from coinmarketcap import Market
logger = logging.getLogger(__name__)

View File

@ -6,11 +6,14 @@ import copy
import json
import time
import traceback
from typing import Dict, List, Optional, Any, Callable
from datetime import datetime
import requests
from typing import Dict, List, Optional, Any, Callable
import arrow
import requests
from cachetools import cached, TTLCache
from freqtrade import (DependencyException, OperationalException, exchange, persistence)
from freqtrade.analyze import Analyze
from freqtrade.constants import Constants
from freqtrade.fiat_convert import CryptoToFiatConverter
@ -18,7 +21,6 @@ from freqtrade.logger import Logger
from freqtrade.persistence import Trade
from freqtrade.rpc.rpc_manager import RPCManager
from freqtrade.state import State
from freqtrade import (DependencyException, OperationalException, exchange, persistence)
class FreqtradeBot(object):

View File

@ -7,11 +7,12 @@ Read the documentation to know what cli arguments you need.
import logging
import sys
from typing import Dict
from freqtrade.configuration import Configuration
from freqtrade import (__version__)
from freqtrade.arguments import Arguments
from freqtrade.configuration import Configuration
from freqtrade.freqtradebot import FreqtradeBot
from freqtrade.logger import Logger
from freqtrade import (__version__)
logger = Logger(name='freqtrade').get_logger()

View File

@ -2,9 +2,9 @@
Various tool function for Freqtrade and scripts
"""
import re
import json
import logging
import re
from datetime import datetime
from typing import Dict

View File

@ -1,12 +1,12 @@
# pragma pylint: disable=missing-docstring
import gzip
import json
import os
from typing import Optional, List, Dict, Tuple
import gzip
from freqtrade.exchange import get_ticker_history
from freqtrade import misc
from freqtrade.exchange import get_ticker_history
from freqtrade.logger import Logger
from user_data.hyperopt_conf import hyperopt_optimize_conf

View File

@ -5,16 +5,17 @@ This module contains the backtesting logic
"""
from argparse import Namespace
from typing import Dict, Tuple, Any, List, Optional
import arrow
from pandas import DataFrame, Series
from tabulate import tabulate
import freqtrade.optimize as optimize
from freqtrade.arguments import Arguments
from freqtrade.exchange import Bittrex
from freqtrade.configuration import Configuration
from freqtrade import exchange
from freqtrade.analyze import Analyze
from freqtrade.arguments import Arguments
from freqtrade.configuration import Configuration
from freqtrade.exchange import Bittrex
from freqtrade.logger import Logger
from freqtrade.misc import file_dump_json
from freqtrade.persistence import Trade

View File

@ -14,7 +14,7 @@ from argparse import Namespace
from functools import reduce
from math import exp
from operator import itemgetter
from typing import Dict, Any, Callable, List
from typing import Dict, Any, Callable
import numpy
import talib.abstract as ta
@ -23,11 +23,11 @@ from hyperopt.mongoexp import MongoTrials
from pandas import DataFrame
import freqtrade.vendor.qtpylib.indicators as qtpylib
from freqtrade.configuration import Configuration
from freqtrade.optimize import load_data
from freqtrade.arguments import Arguments
from freqtrade.optimize.backtesting import Backtesting
from freqtrade.configuration import Configuration
from freqtrade.logger import Logger
from freqtrade.optimize import load_data
from freqtrade.optimize.backtesting import Backtesting
from user_data.hyperopt_conf import hyperopt_optimize_conf

View File

@ -2,16 +2,18 @@
This module contains class to define a RPC communications
"""
from decimal import Decimal
from datetime import datetime, timedelta
from decimal import Decimal
import arrow
from pandas import DataFrame
import sqlalchemy as sql
from pandas import DataFrame
from freqtrade import exchange
from freqtrade.logger import Logger
from freqtrade.misc import shorten_date
from freqtrade.persistence import Trade
from freqtrade.state import State
from freqtrade import exchange
from freqtrade.misc import shorten_date
class RPC(object):

View File

@ -5,10 +5,12 @@ This module manage Telegram communication
"""
from typing import Any, Callable
from tabulate import tabulate
from telegram import Bot, ParseMode, ReplyKeyboardMarkup, Update
from telegram.error import NetworkError, TelegramError
from telegram.ext import CommandHandler, Updater
from freqtrade.__init__ import __version__
from freqtrade.rpc.rpc import RPC

View File

@ -2,9 +2,10 @@
import talib.abstract as ta
from pandas import DataFrame
import freqtrade.vendor.qtpylib.indicators as qtpylib
from freqtrade.strategy.interface import IStrategy
from freqtrade.indicator_helpers import fishers_inverse
from freqtrade.strategy.interface import IStrategy
class_name = 'DefaultStrategy'

View File

@ -4,6 +4,7 @@ This module defines the interface to apply for strategies
"""
from abc import ABC, abstractmethod
from pandas import DataFrame

View File

@ -7,11 +7,12 @@ import importlib
import os
import sys
from collections import OrderedDict
from pandas import DataFrame
from freqtrade.logger import Logger
from freqtrade.constants import Constants
from freqtrade.strategy.interface import IStrategy
from pandas import DataFrame
from freqtrade.constants import Constants
from freqtrade.logger import Logger
from freqtrade.strategy.interface import IStrategy
sys.path.insert(0, r'../../user_data/strategies')

View File

@ -1,14 +1,15 @@
# pragma pylint: disable=missing-docstring
from datetime import datetime
from unittest.mock import MagicMock
from functools import reduce
import logging
import json
import logging
from datetime import datetime
from functools import reduce
from unittest.mock import MagicMock
import arrow
import pytest
from jsonschema import validate
from telegram import Chat, Message, Update
from sqlalchemy import create_engine
from telegram import Chat, Message, Update
from freqtrade.analyze import Analyze
from freqtrade.constants import Constants

View File

@ -1,15 +1,16 @@
# pragma pylint: disable=missing-docstring, C0103, bad-continuation, global-statement
# pragma pylint: disable=protected-access
from unittest.mock import MagicMock
from random import randint
import logging
from requests.exceptions import RequestException
import pytest
from random import randint
from unittest.mock import MagicMock
import pytest
from requests.exceptions import RequestException
import freqtrade.exchange as exchange
from freqtrade import OperationalException
from freqtrade.exchange import init, validate_pairs, buy, sell, get_balance, get_balances, \
get_ticker, get_ticker_history, cancel_order, get_name, get_fee
import freqtrade.exchange as exchange
from freqtrade.tests.conftest import log_has
API_INIT = False

View File

@ -1,10 +1,12 @@
# pragma pylint: disable=missing-docstring, C0103, protected-access, unused-argument
from unittest.mock import MagicMock
import pytest
from requests.exceptions import ContentDecodingError
from freqtrade.exchange.bittrex import Bittrex
import freqtrade.exchange.bittrex as btx
from freqtrade.exchange.bittrex import Bittrex
# Eat this flake8

View File

@ -1,20 +1,21 @@
# pragma pylint: disable=missing-docstring, W0212, line-too-long, C0103, unused-argument
import json
import random
import math
from typing import List
import random
from copy import deepcopy
from typing import List
from unittest.mock import MagicMock
from arrow import Arrow
import pandas as pd
import numpy as np
from freqtrade import optimize
from freqtrade.optimize.backtesting import Backtesting, start, setup_configuration
from freqtrade.arguments import Arguments
from freqtrade.analyze import Analyze
from freqtrade.tests.conftest import default_conf, log_has
import numpy as np
import pandas as pd
from arrow import Arrow
from freqtrade import optimize
from freqtrade.analyze import Analyze
from freqtrade.arguments import Arguments
from freqtrade.optimize.backtesting import Backtesting, start, setup_configuration
from freqtrade.tests.conftest import default_conf, log_has
# Avoid to reinit the same object again and again
_BACKTESTING = Backtesting(default_conf())

View File

@ -3,6 +3,7 @@ import json
import os
from copy import deepcopy
from unittest.mock import MagicMock
import pandas as pd
from freqtrade.optimize.__init__ import load_tickerdata_file

View File

@ -1,13 +1,14 @@
# pragma pylint: disable=missing-docstring, protected-access, C0103
import os
import json
import os
import uuid
from shutil import copyfile
from freqtrade import optimize
from freqtrade.optimize.__init__ import make_testdata_path, download_pairs,\
download_backtesting_testdata, load_tickerdata_file, trim_tickerlist
from freqtrade.misc import file_dump_json
from freqtrade.optimize.__init__ import make_testdata_path, download_pairs, \
download_backtesting_testdata, load_tickerdata_file, trim_tickerlist
from freqtrade.tests.conftest import log_has
# Change this if modifying BTC_UNITEST testdatafile

View File

@ -6,23 +6,23 @@ Unit test file for rpc/telegram.py
"""
import re
from copy import deepcopy
from datetime import datetime
from random import randint
from unittest.mock import MagicMock
from copy import deepcopy
from sqlalchemy import create_engine
from telegram import Update, Message, Chat
from telegram.error import NetworkError
from freqtrade import __version__
from freqtrade.rpc.telegram import authorized_only
from freqtrade.freqtradebot import FreqtradeBot
from freqtrade.rpc.telegram import Telegram
from freqtrade.persistence import Trade
from freqtrade.rpc.telegram import Telegram
from freqtrade.rpc.telegram import authorized_only
from freqtrade.state import State
from freqtrade.tests.test_freqtradebot import patch_get_signal, patch_coinmarketcap
from freqtrade.tests.conftest import get_patched_freqtradebot, log_has
from freqtrade.tests.test_freqtradebot import patch_get_signal, patch_coinmarketcap
class DummyCls(Telegram):

View File

@ -1,8 +1,10 @@
import json
import pytest
from pandas import DataFrame
from freqtrade.strategy.default_strategy import DefaultStrategy, class_name
from freqtrade.analyze import Analyze
from freqtrade.strategy.default_strategy import DefaultStrategy, class_name
@pytest.fixture

View File

@ -1,6 +1,7 @@
# pragma pylint: disable=missing-docstring, protected-access, C0103
import logging
from freqtrade.strategy.strategy import Strategy

View File

@ -5,8 +5,9 @@ Unit test file for analyse.py
"""
import datetime
from unittest.mock import MagicMock
import logging
from unittest.mock import MagicMock
import arrow
from pandas import DataFrame
@ -14,7 +15,6 @@ from freqtrade.analyze import Analyze, SignalType
from freqtrade.optimize.__init__ import load_tickerdata_file
from freqtrade.tests.conftest import log_has
# Avoid to reinit the same object again and again
_ANALYZE = Analyze({'strategy': 'default_strategy'})

View File

@ -6,6 +6,7 @@ Unit test file for arguments.py
import argparse
import logging
import pytest
from freqtrade.arguments import Arguments

View File

@ -4,10 +4,10 @@
Unit test file for configuration.py
"""
import json
from copy import deepcopy
import pytest
from unittest.mock import MagicMock
import pytest
from jsonschema import ValidationError
from freqtrade.arguments import Arguments

View File

@ -2,8 +2,8 @@
import pandas
from freqtrade.optimize import load_data
from freqtrade.analyze import Analyze
from freqtrade.optimize import load_data
from freqtrade.strategy.strategy import Strategy
_pairs = ['BTC_ETH']

View File

@ -5,22 +5,23 @@ Unit test file for freqtradebot.py
"""
import logging
import re
import time
from unittest.mock import MagicMock
from copy import deepcopy
from typing import Dict, Optional
from unittest.mock import MagicMock
import arrow
import pytest
import requests
import re
from sqlalchemy import create_engine
from freqtrade.tests.conftest import log_has
from freqtrade import DependencyException, OperationalException
from freqtrade.exchange import Exchanges
from freqtrade.freqtradebot import FreqtradeBot
from freqtrade.state import State
from freqtrade.persistence import Trade
from freqtrade.state import State
from freqtrade.tests.conftest import log_has
# Functions for recurrent object patching

View File

@ -1,4 +1,5 @@
import pandas as pd
from freqtrade.indicator_helpers import went_up, went_down

View File

@ -3,6 +3,7 @@ Unit test file for logger.py
"""
import logging
from freqtrade.logger import Logger

View File

@ -4,6 +4,7 @@ Unit test file for main.py
import logging
from unittest.mock import MagicMock
import pytest
from freqtrade.main import main, set_loggers

View File

@ -6,10 +6,11 @@ Unit test file for misc.py
import datetime
from unittest.mock import MagicMock
from freqtrade.analyze import Analyze
from freqtrade.optimize.__init__ import load_tickerdata_file
from freqtrade.misc import (shorten_date, datesarray_to_datetimearray,
common_datearray, file_dump_json)
from freqtrade.optimize.__init__ import load_tickerdata_file
def test_shorten_date() -> None:

View File

@ -1,7 +1,9 @@
# pragma pylint: disable=missing-docstring, C0103
import os
import pytest
from sqlalchemy import create_engine
from freqtrade.exchange import Exchanges
from freqtrade.persistence import Trade, init, clean_dry_run_db

View File

@ -1,12 +1,12 @@
#!/usr/bin/env python3
"""This script generate json data from bittrex"""
import sys
import json
import sys
from freqtrade import exchange
from freqtrade.exchange import Bittrex
from freqtrade import misc
from freqtrade.exchange import Bittrex
parser = misc.common_args_parser('download utility')
parser.add_argument(