From e4b30fc667c78c63dde69857e3b17f9e7fc1d0ce Mon Sep 17 00:00:00 2001 From: MoonGem <34537029+MoonGem@users.noreply.github.com> Date: Sun, 25 Mar 2018 07:54:11 -0500 Subject: [PATCH] Added missing script for backup --- user_data/random/random.py | 58 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 user_data/random/random.py diff --git a/user_data/random/random.py b/user_data/random/random.py new file mode 100644 index 000000000..40915ab3a --- /dev/null +++ b/user_data/random/random.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python3 +import os +import multiprocessing +from itertools import zip_longest +import subprocess +import re +PROC_COUNT = multiprocessing.cpu_count() - 1 +cwd = os.getcwd() +print(cwd) + + +limit = multiprocessing.cpu_count() - 1 +WORK_DIR = os.path.join( + os.path.sep, + os.path.abspath(os.path.dirname(__file__)), + '..', 'freqtrade', 'main.py' +) + +# Spawn workers +command = [ + 'python3.6', + WORK_DIR, + 'backtesting', +] +global current +current = 0 + +DEVNULL = open(os.devnull, 'wb') + +while True: + def Run(command): + global current + processes = [subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) for i in range(PROC_COUNT)] + for proc in processes: + wait = proc.communicate() + string = str(wait) + params = re.search(r'~~~~(.*)\~~~~', string).group(1) + mfi = re.search(r'MFI Value(.*)XXX', string) + fastd = re.search(r'FASTD Value(.*)XXX', string) + adx = re.search(r'ADX Value(.*)XXX', string) + rsi = re.search(r'RSI Value(.*)XXX', string) + tot = re.search(r'TOTAL(.*)', string).group(1) + total = re.search(r'[-+]?([0-9]*\.[0-9]+|[0-9]+)', tot).group(1) + if total and (float(total) > float(current)): + current = total + print('total better profit paremeters: ') + print(total) + if params: + print(params) + if mfi: + print(mfi.group(1)) + if fastd: + print(fastd.group(1)) + if adx: + print(adx.group(1)) + if rsi: + print(rsi.group(1)) + data = Run(command)