Ejemplo n.º 1
0
def runzen(cmdline):
    ansi_escape = re.compile(b'\x1b[^m]*m')
    with open(os.devnull, 'w') as devnull:
        a = subprocess.check_output(shlex.split(cmdline), stderr=devnull)
    profit = a.split(b'}')[-1].splitlines()[3].split(b': ')[-1]
    profit = ansi_escape.sub(b'', profit)[:-1]
    trades = parse_trades(a.split(b'}')[-1].splitlines()[4])
    trades = ansi_escape.sub(b'', trades)
    return float(profit), float(trades)
Ejemplo n.º 2
0
def runzen(cmdline):
    ansi_escape = re.compile(b'\x1b[^m]*m')
    with open(os.devnull, 'w') as devnull:
        a = subprocess.check_output(shlex.split(cmdline), stderr=devnull)
    profit = a.split(b'}')[-1].splitlines()[3].split(b': ')[-1]
    profit = ansi_escape.sub(b'', profit)[:-1]
    trades = parse_trades(a.split(b'}')[-1].splitlines()[4])
    trades = ansi_escape.sub(b'', trades)
    return float(profit), float(trades)
Ejemplo n.º 3
0
def runzen(cmdline):
    os.chdir("/app")
    ansi_escape = re.compile(b'\x1b[^m]*m')
    cmdline = cmdline + " | egrep 'end balance|buy hold|trades over|error rate'"
    with open(os.devnull, 'w') as devnull:
        try:
            #a = subprocess.check_output(shlex.split(cmdline))
            result = subprocess.run(cmdline,
                                    shell=True,
                                    stdout=subprocess.PIPE,
                                    stderr=devnull)
            a = result.stdout
        except Exception as e:
            print("ERRO: " + e)
            return -100.0, 0.0
    profit = a.splitlines()[2].split(b': ')[-1]
    profit = ansi_escape.sub(b'', profit)[:-1]
    trades = parse_trades(a.splitlines()[3])
    trades = ansi_escape.sub(b'', trades)
    return float(profit), float(trades)
Ejemplo n.º 4
0
def runzen(cmdline):
    with open(os.devnull, 'w') as devnull:
        a = subprocess.check_output(shlex.split(cmdline), stderr=devnull)
    profit = a.split(b'}')[-1].splitlines()[3].split(b': ')[-1][:-1]
    trades = parse_trades(a.split(b'}')[-1].splitlines()[4])
    return float(profit), float(trades)