update fix failing tests, unitest that resume hyperopt functionality works

This commit is contained in:
Samuel Husso
2018-01-09 11:37:27 +02:00
parent b35fa4c9f6
commit 1647e7a0c1
2 changed files with 67 additions and 11 deletions

View File

@@ -30,7 +30,7 @@ logger = logging.getLogger(__name__)
# set TARGET_TRADES to suit your number concurrent trades so its realistic to 20days of data
TARGET_TRADES = 1100
TOTAL_TRIES = None
TOTAL_TRIES = 0
_CURRENT_TRIES = 0
CURRENT_BEST_LOSS = 100
@@ -116,7 +116,7 @@ def read_trials(trials_path=TRIALS_FILE):
"Read hyperopt trials file"
logger.info('Reading Trials from \'{}\''.format(trials_path))
trials = pickle.load(open(trials_path, 'rb'))
# os.remove(trials_path)
os.remove(trials_path)
return trials
@@ -125,6 +125,7 @@ def log_trials_result(trials):
results = trials.best_trial['result']['result']
logger.info('Best result:\n%s\nwith values:\n%s', results, vals)
def log_results(results):
""" log results if it is better than any previous evaluation """
global CURRENT_BEST_LOSS
@@ -242,12 +243,8 @@ def buy_strategy_generator(params):
def start(args):
<<<<<<< HEAD
global TOTAL_TRIES, PROCESSED, SPACE
=======
global TOTAL_TRIES, PROCESSED, TRIALS, _CURRENT_TRIES
global TOTAL_TRIES, PROCESSED, SPACE, TRIALS, _CURRENT_TRIES
>>>>>>> Hyperopt to handle SIGINT by saving/reading the trials file
TOTAL_TRIES = args.epochs
exchange._API = Bittrex({'key': '', 'secret': ''})
@@ -276,6 +273,7 @@ def start(args):
# read trials file if we have one
if os.path.exists(TRIALS_FILE):
TRIALS = read_trials()
_CURRENT_TRIES = len(TRIALS.results)
TOTAL_TRIES = TOTAL_TRIES + _CURRENT_TRIES
logger.info(