Update generator.py

This commit is contained in:
MoonGem 2018-03-26 21:12:55 -05:00 committed by GitHub
parent 9034a8e090
commit 9f86cf0cdf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -37,7 +37,7 @@ def backtesting(ind):
if len(sys.argv) > 1:
ncpus = int(sys.argv[1])
# Creates jobserver with ncpus workers restart=True is not needed
# Creates jobserver with ncpus workers
job_server = pp.Server(ncpus, ppservers=ppservers)
else:
# Creates jobserver with automatically detected number of workers
@ -55,37 +55,39 @@ while True:
for job in jobs:
try:
res = job()
string = str(res)
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)
print('~~~~~~')
print('Only enable the above settings, not all settings below are used!')
print('~~~~~~')
if mfi:
print('~~~MFI~~~')
print(mfi.group(1))
if fastd:
print('~~~FASTD~~~')
print(fastd.group(1))
if adx:
print('~~~ADX~~~')
print(adx.group(1))
if rsi:
print('~~~RSI~~~')
print(rsi.group(1))
if res is not None:
string = str(res)
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)
print('~~~~~~')
print('Only enable the above settings, not all settings below are used!')
print('~~~~~~')
if mfi:
print('~~~MFI~~~')
print(mfi.group(1))
if fastd:
print('~~~FASTD~~~')
print(fastd.group(1))
if adx:
print('~~~ADX~~~')
print(adx.group(1))
if rsi:
print('~~~RSI~~~')
print(rsi.group(1))
except exception as e:
print(e)
pass
print("Time elapsed: ", time.time() - start_time, "s")
job_server.print_stats()