def do_classifier_test(name, ticker, data_set_inputs, granularity, min_back, timedelta_back): try: ct = ClassifierTest( name=name, type='mock', symbol=ticker, datasetinputs=data_set_inputs, granularity=granularity, minutes_back=min_back, timedelta_back_in_granularity_increments=timedelta_back) ct.get_classifier() ct.save() return_data = "(ct) {} {} {} {} {} {} returned {}% correct ".format( name, ticker, data_set_inputs, granularity, min_back, timedelta_back, ct.percent_correct) print_and_log(return_data) # Hack to only graph successful charts, until we figure out this warning # http://bits.owocki.com/010Z1M3d170p/Image%202016-03-02%20at%208.30.17%20AM.png if ct.percent_correct > 60 or not settings.MAKE_TRADES: ct.graph(ct.graph_url()) return return_data except Exception as e: return "Exception in {} {} {} {} {} {}: {}".format( name, ticker, data_set_inputs, granularity, min_back, timedelta_back, str(e))
def do_classifier_test(name, ticker, data_set_inputs, granularity, min_back, timedelta_back): try: ct = ClassifierTest(name=name, type='mock', symbol=ticker, datasetinputs=data_set_inputs, granularity=granularity, minutes_back=min_back, timedelta_back_in_granularity_increments=timedelta_back) ct.get_classifier() ct.save() return_data = "(ct) {} {} {} {} {} {} returned {}% correct ".format(name, ticker, data_set_inputs, granularity, min_back, timedelta_back, ct.percent_correct) print_and_log(return_data) # Hack to only graph successful charts, until we figure out this warning # http://bits.owocki.com/010Z1M3d170p/Image%202016-03-02%20at%208.30.17%20AM.png if ct.percent_correct > 60 or not settings.MAKE_TRADES: ct.graph(ct.graph_url()) return return_data except Exception as e: return "Exception in {} {} {} {} {} {}: {}".format(name, ticker, data_set_inputs, granularity, min_back, timedelta_back, str(e))
def get_traders(self): predictors = {} self.confidence = {} self.trs = {} self.predictor_configs.reverse() for i in range(0, len(self.predictor_configs)): config = self.predictor_configs[i] if config['type'] == 'nn': pt = PredictionTest() pt.type = 'real' pt.symbol = config['symbol'] pt.datasetinputs = config['datasetinputs'] pt.hiddenneurons = 5 pt.minutes_back = 100 pt.epochs = 1000 pt.momentum = 0.1 pt.granularity = config['granularity'] pt.bias = True pt.learningrate = 0.05 pt.weightdecay = 0.0 pt.recurrent = True pt.timedelta_back_in_granularity_increments = 0 pt.save() predict_runtime = pt.predict_runtime() predict_confidence = pt.confidence() print_and_log( "(t)predicted trainingtime for nn #{} {}: {}s, predicted confidence: {}%" .format(i, config['name'], round(predict_runtime, 1), int(predict_confidence))) pt.get_nn(train=settings.MAKE_TRADES) print_and_log("(t)done training") predictors[i] = pt self.confidence[i] = predict_confidence else: ct = ClassifierTest(name=config['name'], type='real', symbol=config['symbol'], datasetinputs=config['datasetinputs'], granularity=config['granularity'], minutes_back=config['minutes_back'], timedelta_back_in_granularity_increments=0) predict_runtime = ct.predict_runtime() predict_confidence = ct.confidence() print_and_log( "(t)predicted trainingtime for nn #{} {}: {}s, predicted confidence: {}%" .format(i, config['name'], round(predict_runtime, 1), int(predict_confidence))) ct.get_classifier(test=False) print_and_log("(t)done training") predictors[i] = ct self.confidence[i] = predict_confidence ct.save() self.predictors = predictors return self.predictors
def handle(self, *args, **options): ticker_options = ['BTC_ETH', 'USDT_BTC'] min_back_options = [100, 1000, 24 * 60, 24 * 60 * 2] granularity_options = [10, 15, 20, 30, 40, 50, 60, 120, 240] if not settings.MAKE_TRADES: granularity_options = [1] datasetinput_options = [2] #TODO: enable more than just 1 type timedelta_back_in_granularity_increments_options = [ 10, 30, 60, 100, 1000 ] #sets how far apart (in granularity increments) the datasets are name_options = [ "Nearest Neighbors", "Linear SVM", "RBF SVM", "Decision Tree", "Random Forest", "AdaBoost", "Naive Bayes", "Linear Discriminant Analysis", "Quadratic Discriminant Analysis" ] for ticker in ticker_options: for min_back in min_back_options: for granularity in granularity_options: for datasetinputs in datasetinput_options: for timedelta_back_in_granularity_increments in timedelta_back_in_granularity_increments_options: for name in name_options: try: ct = ClassifierTest( name=name, type='mock', symbol=ticker, datasetinputs=datasetinputs, granularity=granularity, minutes_back=min_back, timedelta_back_in_granularity_increments =timedelta_back_in_granularity_increments ) ct.get_classifier() ct.save() if ct.percent_correct > 60 or not settings.MAKE_TRADES: #hack to only graph successful charts, until we figure out this warning http://bits.owocki.com/010Z1M3d170p/Image%202016-03-02%20at%208.30.17%20AM.png ct.graph(ct.graph_url()) except Exception as e: print("exception:" + str(e))
def get_traders(self): predictors = {} self.confidence = {} self.trs = {} self.predictor_configs.reverse() for i in range(0, len(self.predictor_configs)): config = self.predictor_configs[i] if config['type'] == 'nn': pt = PredictionTest() pt.type = 'real' pt.symbol = config['symbol'] pt.datasetinputs = config['datasetinputs'] pt.hiddenneurons = 5 pt.minutes_back = 100 pt.epochs = 1000 pt.momentum = 0.1 pt.granularity = config['granularity'] pt.bias = True pt.learningrate = 0.05 pt.weightdecay = 0.0 pt.recurrent = True pt.timedelta_back_in_granularity_increments = 0 pt.save() predict_runtime = pt.predict_runtime() predict_confidence = pt.confidence() print_and_log("(t)predicted trainingtime for nn #{} {}: {}s, predicted confidence: {}%". format(i, config['name'], round(predict_runtime, 1), int(predict_confidence))) pt.get_nn(train=settings.MAKE_TRADES) print_and_log("(t)done training") predictors[i] = pt self.confidence[i] = predict_confidence else: ct = ClassifierTest(name=config['name'], type='real', symbol=config['symbol'], datasetinputs=config['datasetinputs'], granularity=config['granularity'], minutes_back=config['minutes_back'], timedelta_back_in_granularity_increments=0) predict_runtime = ct.predict_runtime() predict_confidence = ct.confidence() print_and_log("(t)predicted trainingtime for nn #{} {}: {}s, predicted confidence: {}%". format(i, config['name'], round(predict_runtime, 1), int(predict_confidence))) ct.get_classifier(test=False) print_and_log("(t)done training") predictors[i] = ct self.confidence[i] = predict_confidence ct.save() self.predictors = predictors return self.predictors
def handle(self, *args, **options): ticker_options = ['BTC_ETH', 'USDT_BTC'] min_back_options = [100, 1000, 24 * 60, 24 * 60 * 2] granularity_options = [10, 15, 20, 30, 40, 50, 60, 120, 240] if not settings.MAKE_TRADES: granularity_options = [1] datasetinput_options = [2] # TODO: enable more than just 1 type timedelta_back_in_granularity_increments_options = [10, 30, 60, 100, 1000] # sets how far apart (in granularity increments) the datasets are name_options = ["Nearest Neighbors", "Linear SVM", "RBF SVM", "Decision Tree", "Random Forest", "AdaBoost", "Naive Bayes", "Linear Discriminant Analysis", "Quadratic Discriminant Analysis"] for ticker in ticker_options: for min_back in min_back_options: for granularity in granularity_options: for datasetinputs in datasetinput_options: for timedelta_back_in_granularity_increments in timedelta_back_in_granularity_increments_options: for name in name_options: try: ct = ClassifierTest(name=name, type='mock', symbol=ticker, datasetinputs=datasetinputs, granularity=granularity, minutes_back=min_back, timedelta_back_in_granularity_increments=timedelta_back_in_granularity_increments) ct.get_classifier() ct.save() print_and_log("(ct) {} {} {} {} {} {} returned {}% corrrect ".format(name, ticker, datasetinputs, granularity, min_back, timedelta_back_in_granularity_increments, ct.percent_correct)) if ct.percent_correct > 60 or not settings.MAKE_TRADES: # hack to only graph successful charts, until we figure out this warning http://bits.owocki.com/010Z1M3d170p/Image%202016-03-02%20at%208.30.17%20AM.png ct.graph(ct.graph_url()) except Exception as e: print("exception:" + str(e))