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: if len(sys.argv) > 1:
ncpus = int(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) job_server = pp.Server(ncpus, ppservers=ppservers)
else: else:
# Creates jobserver with automatically detected number of workers # Creates jobserver with automatically detected number of workers
@ -55,37 +55,39 @@ while True:
for job in jobs: for job in jobs:
try: try:
res = job() res = job()
string = str(res) if res is not None:
params = re.search(r'~~~~(.*)~~~~', string).group(1) string = str(res)
mfi = re.search(r'MFI Value(.*)XXX', string) params = re.search(r'~~~~(.*)~~~~', string).group(1)
fastd = re.search(r'FASTD Value(.*)XXX', string) mfi = re.search(r'MFI Value(.*)XXX', string)
adx = re.search(r'ADX Value(.*)XXX', string) fastd = re.search(r'FASTD Value(.*)XXX', string)
rsi = re.search(r'RSI Value(.*)XXX', string) adx = re.search(r'ADX Value(.*)XXX', string)
tot = re.search(r'TOTAL(.*)', string).group(1) rsi = re.search(r'RSI Value(.*)XXX', string)
total = re.search(r'[-+]?([0-9]*\.[0-9]+|[0-9]+)', tot).group(1) tot = re.search(r'TOTAL(.*)', string).group(1)
if total and (float(total) > float(current)): total = re.search(r'[-+]?([0-9]*\.[0-9]+|[0-9]+)', tot).group(1)
current = total if total and (float(total) > float(current)):
print('total better profit paremeters: ') current = total
print(total) print('total better profit paremeters: ')
if params: print(total)
print(params) if params:
print('~~~~~~') print(params)
print('Only enable the above settings, not all settings below are used!') print('~~~~~~')
print('~~~~~~') print('Only enable the above settings, not all settings below are used!')
if mfi: print('~~~~~~')
print('~~~MFI~~~') if mfi:
print(mfi.group(1)) print('~~~MFI~~~')
if fastd: print(mfi.group(1))
print('~~~FASTD~~~') if fastd:
print(fastd.group(1)) print('~~~FASTD~~~')
if adx: print(fastd.group(1))
print('~~~ADX~~~') if adx:
print(adx.group(1)) print('~~~ADX~~~')
if rsi: print(adx.group(1))
print('~~~RSI~~~') if rsi:
print(rsi.group(1)) print('~~~RSI~~~')
print(rsi.group(1))
except exception as e: except exception as e:
print(e) print(e)
pass
print("Time elapsed: ", time.time() - start_time, "s") print("Time elapsed: ", time.time() - start_time, "s")
job_server.print_stats() job_server.print_stats()